predict
Apply a saved model to score new data and obtain predictions, with class probabilities and confidence. Works with inline records or CSV files.
Instructions
Score new data with a previously trained model (from train_model).
Provide the rows to score in ONE of two ways:
* `records`: a list of row dicts, e.g.
[{"Pclass": 3, "Sex": "male", "Age": 22, "Fare": 7.25, "Embarked": "S"}]
* `filename`: a CSV inside datasets/ to score every row of (e.g. a Kaggle
"test.csv").
The saved model is a full pipeline, so missing values and categoricals are
handled automatically; you only need to supply the feature columns used in
training. For classifiers, per-class probabilities and a confidence score
are included.
Args:
model: Saved model name (see list_models), with or without ".joblib".
records: Inline rows to score.
filename: CSV in datasets/ to score instead of `records`.
id_column: Optional identifier column to echo alongside each prediction
(e.g. "PassengerId") — handy for building a submission file.
save_csv: If true, also write the predictions to outputs/ as a CSV.
top_n: Max number of prediction rows to include in the response.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | ||
| top_n | No | ||
| records | No | ||
| filename | No | ||
| save_csv | No | ||
| id_column | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |