Last active
March 12, 2018 11:56
-
-
Save dim4o/8c687df16b1ac7c1d0c26cf7f41e8a6f to your computer and use it in GitHub Desktop.
Anaconda Defect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
from nose.tools import * | |
from sklearn.linear_model import LogisticRegression | |
from sklearn.preprocessing import PolynomialFeatures | |
bank_data = pd.read_csv('./data/bank.csv', sep=";") | |
bank_features = bank_data.drop('y', axis=1) | |
bank_features = pd.get_dummies(bank_features) | |
bank_output = bank_data.loc[:,'y'] | |
quad_feature_transformer = PolynomialFeatures(degree=2, interaction_only=True) | |
bank_features_quad = quad_feature_transformer.fit_transform(bank_features) | |
bank_model_quad = LogisticRegression(C=1e6) | |
bank_model_quad.fit(bank_features_quad, bank_output) | |
accuracy_score_quad = bank_model_quad.score(bank_features_quad, bank_output) | |
print("Accuracy: {}".format(accuracy_score_quad)) | |
# Ubuntu output: 0.90400353904 | |
# Windows output: 0.89869497895 | |
assert_almost_equal(accuracy_score_quad, 0.8986949789869498, delta = 0.001) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment