Python Docs
Basic Machine Learning using Scikit-Learn
Scikit-Learn provides simple, consistent APIs for common machine learning algorithms such as classification, regression, and clustering, along with utilities for model selection and evaluation.
Quick Example: Logistic Regression on Iris Dataset
Below is a minimal example using LogisticRegression on the classic Iris dataset. We load the features and labels, fit a classifier, and print the training accuracy.
Example
from sklearn.linear_model import LogisticRegression from sklearn.datasets import load_iris X, y = load_iris(return_X_y=True) clf = LogisticRegression(max_iter=200).fit(X, y) print(clf.score(X, y))
Output (example):
0.97 # (Approx training accuracy, depends on solver & version)