Sklearn Ridge/Lasso icon

Sklearn Ridge/Lasso

Ridge (L2) and Lasso (L1) regularized regression using scikit-learn

Actions2

Train

AI-generated

Summary

Trains a Ridge or Lasso regression model on specified feature and target columns, returning model metadata

Inputs

  • modelType — Select model type: Ridge (L2) or Lasso (L1)
  • featureColumns (required) — Comma-separated list of feature column names
  • targetColumn (required) — Name of the target column
  • alpha — Regularization strength (higher = more regularization)
  • maxIter — Maximum number of iterations for Lasso
  • pythonPath — Path to Python executable with scikit-learn installed

Output shape

A JSON object per training row containing model metadata and metrics

Includes model (base64-encoded pickle), model_type, r2_score, coefficients (mapped to feature names), intercept, alpha, feature_columns; for Lasso also n_nonzero_coefficients and n_iterations.

Examples

Example 1: Train a Ridge regression on columns feature1,feature2,feature3 to predict target

modelType=Ridge, featureColumns=feature1,feature2,feature3, targetColumn=target, alpha=0.5

Example 2: Train a Lasso model with 500 max iterations and alpha 0.1

modelType=Lasso, featureColumns=feature1,feature2,feature3, targetColumn=target, alpha=0.1, maxIter=500

Example 3: Train using a custom Python interpreter

modelType=Lasso, featureColumns=feature1,feature2,feature3, targetColumn=target, alpha=0.05, maxIter=2000, pythonPath=/usr/bin/python3.9

Discussion