The Lasso Regression Prediction component applies a trained Lasso regression model to new data and outputs numerical predictions, such as loan limits or temperatures. It accepts both sparse and dense data formats.
Supported computing engines
MaxCompute, Flink, and Deep Learning Containers (DLC).
How it works
Lasso (Least Absolute Shrinkage and Selection Operator) regression adds an L1 penalty to the standard least-squares objective. This penalty forces the sum of absolute values of the regression coefficients below a fixed threshold, which drives some coefficients exactly to zero. The practical effect is a sparse model: only the most predictive features retain non-zero weights, making Lasso particularly effective when your dataset has many features but few are truly relevant. This method retains the benefits of subset shrinkage and provides a biased estimation for handling multicollinear data.
Configure the component in the GUI
Input ports
Connect the following upstream components to the two input ports (left to right):
| Input port | Recommended upstream component | Required |
|---|---|---|
| Prediction input model | Lasso Regression Training | Yes |
| Prediction input data | Read Table, Feature engineering, or Data pre-processing | Yes |
Parameters
| Tab | Parameter | Description |
|---|---|---|
| Field settings | Reserved algorithm column names | The column reserved for the algorithm. Select the column name from the dataset. |
| Vector column | The name of the vector column. | |
| Parameter settings | Prediction result column | The name of the output column that stores predictions. Predictions are appended to the input dataset as a new column. |
| Number of threads | The number of parallel threads. Default: 1. Increase this value when processing large datasets to reduce execution time. |
|
| Execution tuning | Number of workers | The number of worker nodes. Must be a positive integer from 1 to 9999. Configure together with Memory per worker (MB). |
| Memory per worker (MB) | The memory allocated to each worker node. Must be between 1024 MB and 65536 MB. |
Configure the component using code
Copy the following code to a PyAlink Script component to replicate the GUI configuration.
from pyalink.alink import *
def main(sources, sinks, parameter):
model = sources[0] # Trained Lasso regression model
batchData = sources[1] # Input data for prediction
predictor = LassoRegPredictBatchOp()\
.setPredictionCol("pred") # Name of the output prediction column
result = predictor.linkFrom(model, batchData)
result.link(sinks[0])
BatchOperator.execute()
The result dataset contains all columns from the input data plus a new column named pred (or the name you set in setPredictionCol). The prediction column holds a numerical value for each input row.