Machine Learning with scikit-learn: Complete Guide

Build ML models with scikit-learn.

Learn supervised and unsupervised learning.

Classification

from sklearn.ensemble import RandomForestClassifier

from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(X, y)

model = RandomForestClassifier()

model.fit(X_train, y_train)

accuracy = model.score(X_test, y_test)

Pipelines

from sklearn.pipeline import Pipeline

from sklearn.preprocessing import StandardScaler

pipeline = Pipeline([

(‘scaler’, StandardScaler()),

(‘classifier’, RandomForestClassifier())

])

Conclusion

scikit-learn makes ML accessible!

Leave a Comment