Created
December 27, 2018 19:59
-
-
Save rohanjoseph93/aa7e4d5443fd41bf351c26a89d31c519 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
#Split data into attributes and class | |
X = data.drop(['Class'],axis=1) | |
y = data['Class'] | |
#perform training and test split | |
from sklearn.model_selection import train_test_split | |
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) | |
#Dummy Classifier | |
from sklearn.dummy import DummyClassifier | |
clf = DummyClassifier(strategy= 'most_frequent').fit(X_train,y_train) | |
y_pred = clf.predict(X_test) | |
#Distribution of y test | |
print('y actual : \n' + str(y_test.value_counts())) | |
#Distribution of y predicted | |
print('y predicted : \n' + str(pd.Series(y_pred).value_counts())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment