Sklearn Naive Bayes icon

Sklearn Naive Bayes

Naive Bayes classifiers using scikit-learn

Actions2

Predict

AI-generated

Summary

Predict class labels and probabilities for each input record using a saved Naive Bayes model.

Inputs

  • variant — Selects the NB variant (gaussian, multinomial, or bernoulli); not used in Predict but available as a UI option.
  • modelData (required) — JSON string containing the serialized model trained in a previous Train step.
  • predictFeatureColumns (required) — Comma‑separated list of column names to extract as features from each input record.
  • pythonPath — Path to the Python interpreter that has scikit‑learn installed (default: python3).

Output shape

An array of output records, each extending the original input record with prediction (list) and probabilities (list) fields.

If the model cannot be loaded or feature columns are missing, the node raises an error; otherwise it returns one output per input row.

Examples

Example 1: Predict using a pre‑trained model

Set operation to Predict, provide the base64‑encoded model in Model Data, list feature columns (e.g., 'age,income'), optionally adjust Python Path.

Example 2: Predict on a dataset with missing features

Same as above; ensure all listed feature columns exist to avoid errors.

Discussion