Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 978 Bytes

linear-models.md

File metadata and controls

28 lines (19 loc) · 978 Bytes

Linear models

AUC regressor

This is the AUC regressor Paul Duan used for his winning solution to the Amazon Employee Access Challenge.

>>> from sklearn import datasets
>>> from sklearn import metrics
>>> from sklearn import model_selection
>>> import xam

>>> X, y = datasets.load_digits(n_class=2, return_X_y=True)
>>> X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=0.5, random_state=42)

>>> model = xam.linear_model.AUCRegressor()
>>> model.fit(X_train, y_train)

>>> train_score = metrics.roc_auc_score(y_train, model.predict(X_train))
>>> test_score = metrics.roc_auc_score(y_test, model.predict(X_test))

>>> print('Train score: {:.2f}'.format(train_score))
Train score: 1.00

>>> print('Test score: {:.2f}'.format(test_score))
Test score: 1.00