Skip to content

Machine Learning Quick Start

Ciaren has built-in nodes for the tabular ML lifecycle (clean, split, train with preprocessing, predict, evaluate) on the same canvas as the rest of your flow. Models are tracked with MLflow. This guide builds a churn classifier in about 10 minutes.

Ciaren editor: Drop Nulls and Remove Duplicates cleaning nodes feeding a Train/Test Split, Train Regressor, Predict, and Evaluate ML pipeline in the same flow

Prerequisites

None. A plain pip install ciaren includes scikit-learn, MLflow and joblib, and ciaren init creates a local MLflow store (./mlruns) and enables ML. Run ciaren check and look for [ok] ml: enabled. If the line is missing or the Machine Learning palette section is empty, CIAREN_ML_ENABLED may be set to false or the install is stripped down.

pip install "ciaren[ml]" adds XGBoost and LightGBM to the model choices. To use an existing MLflow server, see MLflow and the Models Page.

ML pipeline at a glance

  1. 1Input
    File Input
    churn dataset
  2. 2ML
    Train / Test Split
    seed + stratify
  3. 3ML
    Train Classifier
    preprocessing + Random Forest → MLflow
  4. 4ML
    Predict
    test output + model wire
  5. 5ML
    Evaluate
    accuracy, AUC, F1
  6. 6Output
    File Output
    save metrics

Train / Test Split sends train rows to Train Classifier and test rows to Predict. Train Classifier saves the fitted model to MLflow and sends a model reference to Predict over a purple wire. Predict feeds Evaluate

Purple model wire

Train / Test Split has two output handles: train feeds Train Classifier and test feeds the data input of Predict. Train Classifier's bundled preprocessing fits on the training rows and travels with the model. Its model output connects to Predict's model input with a purple wire.

The nodes

Open a flow and expand Machine Learning in the node palette:

NodeWhat it does
Train / Test SplitSplits rows into train and test outputs (seed required).
Scale FeaturesFit scaling on the incoming frame for exploration.
Encode CategoriesFit one-hot or ordinal encoding on the incoming frame.
Select FeaturesKeep columns by variance, correlation or top-K relevance.
Reduce DimensionsFit PCA and replace selected numeric columns with components.
Classifier Model / Regressor ModelDefine an unfitted estimator for Cross-Validate.
Train Classifier / Train RegressorFit a final model artifact and log it to MLflow.
Train ClusteringFit K-Means, DBSCAN or Agglomerative Clustering; only K-Means supports Predict on new rows.
Train Dim. ReductionSave a fitted PCA pipeline; use Reduce Dimensions for a components table in the flow.
Train ForecasterScaffold with no built-in forecasting estimator; check availability before using it.
PredictScore rows with a trained model.
EvaluateCompute metrics from predictions.
Feature ImportanceRank which features the model relied on.
Cross-ValidateEstimate generalization from a Classifier / Regressor Model definition with k-fold, stratified, time-series, group, or other CV strategies.

Model definitions vs. trained models

Use Classifier Model or Regressor Model before Cross-Validate. These nodes only describe the algorithm, target, features, hyperparameters, and preprocessing; Cross-Validate then fits fresh clones inside each fold.

Use Train Classifier or Train Regressor after you have chosen a model and need a final trained artifact for Predict, Feature Importance, model registration, or MLflow tracking. Train nodes are intentionally not accepted by Cross-Validate, because that would train one full-data model and then train fold models again.

Keep preprocessing with the trained model

Scale Features and Encode Categories are useful for exploration, but refit on each input. Independently fitting them on train and test branches changes the feature representation. For this training flow, configure scaling, imputation and categorical encoding in Train Classifier's Advanced → Preprocessing. Predict then applies those fitted steps to the raw test rows. Standalone feature selection and PCA are not added to the model automatically; retain fitted steps in your own exported pipeline when you need them.

Build the flow

  1. Input: drag a File Input, set File type to CSV, and pick your dataset (it needs a target column, e.g. churn).
  2. Train / Test Split: connect the input. Set a seed (required for reproducibility) and, for classification, stratify on your target.
  3. Train Classifier: connect the split's train output.
    • Pick a Model (grouped by task). Random Forest is a solid default.
    • Choose the Target column (churn). Empty Feature columns uses every other column. For the customer sample, choose tenure, monthly_charges and support_calls, leaving out the ID.
    • Tweak basic hyperparameters inline, or open Advanced options for the full set, tracking, and preprocessing.
  4. Predict: connect the split's test output to its data input, and the Train Classifier's model output (the purple wire) to its model input.
  5. Evaluate: connect Predict. Set the task type and the prediction column (prediction); choose metrics or accept the defaults.
  6. Output: connect a File Output to Evaluate to save the metrics table.

Prefer to describe it?

With a provider key set up, the Flow assistant can propose a flow like this from a request such as "train a random forest with 5-fold cross validation and show feature importance". You review the nodes, settings and wiring before saving, and training starts only when you choose Run. The assistant does not add forecasting models. Build those by hand.

What travels on a model wire

A model wire never carries the model itself. Train nodes save the fitted estimator to MLflow and pass a small model reference downstream: the MLflow run or model URI plus the task, model type, target and feature columns. Predict and Feature Importance read the reference and load the artifact themselves. Production flows can instead put a registry alias URI such as models:/churn@production in Predict's config (see MLflow and the Models Page).

Loading checks the URI and confines local artifacts to the artifact directory, but that is not a sandbox: MLflow and joblib models can run Python while loading, so load only artifacts you trust.

Models from plugins

Plugins can contribute additional algorithms to the model picker. They appear in the same dropdown, grouped by task, and train/log/export exactly like the built-ins (a warning shows if the plugin's library isn't installed). Plugins can also ship whole custom train nodes whose model output feeds Predict like any other. Try the bundled MLP Classifier example from the Plugins page, or see ML Model Plugins to build your own.

Add cross-validation

To estimate generalization before training the final artifact:

  1. Add Classifier Model or Regressor Model.
  2. Configure the same model type, target, features, preprocessing, and hyperparameters you want to evaluate.
  3. Connect the data frame to Cross-Validate's in input.
  4. Connect the model definition node's model output to Cross-Validate's model input.

Cross-Validate returns one row per fold and can end the flow by itself. After you pick the best setup, use Train Classifier or Train Regressor in a final training flow to create the model artifact used by Predict or registration.

Run it and read the results

Run the flow, then open the run. The run detail page shows the full DAG with green checkmarks on every node and row counts at each step:

Running an ML flow: the DAG fills in green with per-node row counts, and selecting the Evaluate node surfaces accuracy, precision, recall and F1

Click the Train Classifier node to see its Machine learning panel:

  • training metrics,
  • a confusion-matrix heatmap (classification),
  • the model URI and MLflow run id,
  • a Register in registry button to promote the model; see MLflow and the Models Page.

Click the Evaluate node for the held-out test metrics, and Feature Importance (wire it to the model output) for an importance bar chart.

Try the demo flows

With ML enabled (the default), the built-in Demo project includes nine ready-to-run ML flows: the four tutorial flows above (Iris — Quick Classifier, Iris — Train, Validate & Evaluate, House Prices — Regression, Iris — PCA Explore) plus five more covering cross-validation, KNN with encoded features, feature selection, and clustering (Iris — Logistic CV Report, Iris — KNN with Encoded Species, House Prices — Feature Selection, House Prices — Customer Segments, House Prices — PCA Model). Boot with ciaren serve --run-seed-flows to run them all once on first start, so the Runs history and the Models page are populated out of the box.

Next steps