Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
x = np.array(data[["Age", "EstimatedSalary"]])
y = np.array(data[["Purchased"]])
xtrain, xtest, ytrain, ytest = train_test_split(x, y, test_size=0.10, random_state=42)
decisiontree = DecisionTreeClassifier()
logisticregression = LogisticRegression()
knearestclassifier = KNeighborsClassifier()
svm_classifier = SVC()
bernoulli_naiveBayes = BernoulliNB()
passiveAggressive = PassiveAggressiveClassifier()
knearestclassifier.fit(xtrain, ytrain)
decisiontree.fit(xtrain, ytrain)
logisticregression.fit(xtrain, ytrain)
passiveAggressive.fit(xtrain, ytrain)
data1 = {"Classification Algorithms": ["KNN Classifier", "Decision Tree Classifier",
"Logistic Regression", "Passive Aggressive Classifier"],
"Score": [knearestclassifier.score(x,y), decisiontree.score(x, y),
logisticregression.score(x, y), passiveAggressive.score(x,y) ]}
score = pd.DataFrame(data1)
score
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment