Learn scikit-learn’s small, repeatable interface.
from sklearn.tree import DecisionTreeClassifier
model = DecisionTreeClassifier(max_depth=3, random_state=42)
model.fit(X_train, y_train)
predictions = model.predict(X_valid)
probabilities = model.predict_proba(X_valid)[:, 1]
An estimator stores learned state during fit, then applies it during predict. Fixed random_state makes stochastic choices reproducible.[1]
A shallow tree gives a fast sanity check. Confirm row counts, target direction, score above baseline, and plausible predictions before tuning. A sophisticated model cannot rescue the wrong target or leaked data.
fit receives the validation rows too?Run the estimator example in scikit-learn’s Getting Started guide.