Created
February 3, 2019 21:00
-
-
Save terrah27/416f586e06b860152de9d478cc45599b to your computer and use it in GitHub Desktop.
This file contains 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
# Separate input features and target | |
y = df.Class | |
X = df.drop('Class', axis=1) | |
# setting up testing and training sets | |
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=27) | |
# DummyClassifier to predict only target 0 | |
dummy = DummyClassifier(strategy='most_frequent').fit(X_train, y_train) | |
dummy_pred = dummy.predict(X_test) | |
# checking unique labels | |
print('Unique predicted labels: ', (np.unique(dummy_pred))) | |
# checking accuracy | |
print('Test score: ', accuracy_score(y_test, dummy_pred)) | |
Unique predicted labels: [0] | |
Test score: 0.9981461194910255 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment