-
Notifications
You must be signed in to change notification settings - Fork 0
Scikit Learn
Alex Albenstetter edited this page Jun 5, 2023
·
5 revisions
Genrally one can apply this step-by-step approach for machine learning in scikit-learn:
- Import the model you want to use
e.g.
from sklearn.tree import DecisionTreeClassifier
- Make an instance of the Model
clf = DecisionTreeClassifier(max_depth = 2, random_state = 0)
- Train the model on the data
clf.fit(X_train, Y_train)
- Predict labels of unseen (test) data
clf.predict(X_test)
Import
from sklearn import tree
from sklearn.tree import DecisionTreeClassifier
Import
from sklearn.ensemble import RandomForestClassifier
Import
from sklearn.svm import SVC
Import
from sklearn.preprocessing import StandardSclaer, LabelEncoder
from sklearn.model_selection import train_test_split