scikit-learn 实现了机器学习的大部分基础算法,让我们快速了解一下。
1.逻辑回归大多数问题都可以归结为二元分类问题。这个算法的优点是可以给出数据所在类别的概
率。
from sklearn import metrics
from sklearn.linear_model import LogisticRegression model = LogisticRegression()
model.fit(X, y)
print(model)
# make predictions
expected = y
predicted = model.predict(X)
# summarize the fit of the model
print(metrics.classification_report(expected, predicted))
print(metrics.confusion_matrix(expected, predicted))
结果: