Learning with fit() and predict()
A small, repeatable training interface
Scikit-learn is a Python library for classical machine learning. Classical models include logistic regression, decision trees, and nearest neighbors. They are not large language models or neural networks and can train on small datasets in seconds on a laptop CPU.
Most estimators share two methods. model.fit(X_train, y_train) learns from training features and labels. model.predict(X_test) applies the learned rule to unseen rows. Keeping the same interface makes algorithms easy to compare.
Logistic regression is a classification algorithm despite its name. It estimates the probability of a class. A DummyClassifier deliberately uses a simple rule such as always predicting the most frequent class. It is a baseline: a real model should beat it on the metric that matters.
Features measured on very different scales can hinder some algorithms. StandardScaler centers and scales numeric columns. A scikit-learn Pipeline connects preprocessing and the model so both are fitted only on training data and repeated identically during prediction.
Analogy:fit()is studying worked examples;predict()is sitting the closed-book exam. Reading the answer sheet during study or grading the study questions proves nothing.