Welcome To The Course!: Michael (Mike) Gelbart
Welcome To The Course!: Michael (Mike) Gelbart
Welcome To The Course!: Michael (Mike) Gelbart
course!
LIN EAR CLAS S IF IERS IN P YTH ON
newsgroups = sklearn.datasets.fetch_20newsgroups_vectorized()
X, y = newsgroups.data, newsgroups.target
X.shape
(11314, 130107)
y.shape
(11314,)
knn = KNeighborsClassifier(n_neighbors=1)
knn.fit(X,y)
y_pred = knn.predict(X)
0.99991
knn.fit(X_train, y_train)
knn.score(X_test, y_test)
0.66242
lr = LogisticRegression()
lr.fit(X_train, y_train)
lr.predict(X_test)
lr.score(X_test, y_test)
lr.score(wine.data, wine.target)
0.972
lr.predict_proba(wine.data[:1])
import sklearn.datasets
wine = sklearn.datasets.load_wine()
svm = LinearSVC()
svm.fit(wine.data, wine.target)
svm.score(wine.data, wine.target)
0.893
svm.score(wine.data, wine.target)
1.