Train
AI-generatedSummary
Trains a Random Forest classifier or regressor using scikit-learn on the supplied data, returning the trained model as a base64‑encoded pickle along with performance metrics and metadata.
Inputs
- modelType — Whether to train a classifier (categorical target) or regressor (continuous target). Options: 'classifier' (default) or 'regressor'.
- featureColumns (required) — Comma‑separated list of column names to use as features. Must exist in each input item.
- targetColumn (required) — Column name containing the target variable.
- nEstimators — Number of trees in the forest. Default: 100.
- maxDepth — Maximum depth of each tree. 0 means unlimited. Default: 0.
- minSamplesSplit — Minimum samples required to split an internal node. Default: 2.
- randomState — Random seed for reproducibility. Default: 42.
- pythonPath — Path to the Python executable that has scikit‑learn installed. Default: 'python3'.
Output shape
array of objects
The node returns a single element array. The object contains the trained model and diagnostic information: the raw base64‑encoded pickle, model type, training score, feature importances, and other metadata. For classifiers, an additional 'classes' field lists the unique labels encountered during training.
Examples
Example 1: Train a classifier on CSV data
Set modelType to 'classifier', list feature columns (e.g., 'age,income'), target column (e.g., 'bought'), keep defaults for other hyper‑parameters, and point pythonPath at a suitable Python environment.