Table of Contents | ||
---|---|---|
|
Overview
This is a Transform type Snap that builds ML model for an input regression dataset. In the Snap's settings, you can select the target field in the dataset, algorithm, and configure parameters for the selected algorithm.
Note |
---|
If you want to build the model on regression dataset, use Trainer -- Classification Snap instead. |
Input and Output
Expected input: The regression dataset.
Expected output: The output from the Snap is a serialization of the ML model, and metadata which are not human-readable. Additionally, the output includes a human-readable representation of the ML model if the Readable checkbox is selected.
Expected upstream Snap: Any Snap that generates a regression dataset document is usable as an upstream Snap. For example, CSV Generator, JSON Generator, XML Generator, Copy, and so on.
Expected downstream Snap: Snaps that require a ML model input are used downstream of the Snap. For example, the Predictor (Regression) Snap. Alternatively, file writing Snaps such as File Writer are used downstream to write the ML model into a file to be used with Predictor (Regression) Snap in another pipeline.
Prerequisites
- The data from upstream Snap must be in tabular format (no nested structure).
- This Snap automatically derives the schema (column names and types) from the first row. Therefore, the first row must not have any missing values.
Configuring Accounts
Accounts are not used with this Snap.
Configuring Views
Input | This Snap has exactly one document input view. |
---|---|
Output | This Snap has exactly one document output view. |
Error | This Snap has at most one document error view. |
Troubleshooting
None.
Limitations and Known Issues
None.
Modes
- Ultra pipelines: Does not work in Ultra pipelines.
- Spark mode: Does not work in Spark mode.
Snap Settings
Label | Required. The name for the Snap. Modify this to be more specific, especially if there are more than one of the same Snap in the pipeline. |
---|---|
Label field | Required. The label or output field in the dataset. This must be numeric. This is the field that the ML model will be trained to predict. Default value: None Example: $price |
Algorithm | Required. The regression algorithm to be used to build the model. There are four regression algorithms currently available:
The implementations are from WEKA, an open source machine learning library in Java. Default value: K-Nearest Neighbors |
Options | The parameters to be applied on the selected regression algorithm. Each algorithm has a different set of parameters to be configured in this field. If the field is left blank, the default values are applied for all the parameters. If specifying multiple parameters, separate them with a comma (,). See Options for Algorithms section below for details. Default value: None Examples:
|
Readable | Select this to output the model in human-readable format. When selected, a $readable field is added in the output, this displays the ML model in a readable format. Default value: Not selected |
Best Practices
Using Type Converter Snap Upstream
In some cases, the numerical fields may be represented as text. You can use the Type Converter Snap to convert data into appropriate types before feeding into the Trainer (Regression) Snap.
Algorithm Selection
In order to choose the best possible algorithm for your dataset, use the Cross Validator (Regression) Snap first. This Snap performs k-fold cross validation on the dataset and outputs error and other statistics. The algorithm that produces the best accuracy is likely to be the one most suitable for your dataset. Apply the same algorithm for your dataset in the Trainer (Regression) Snap to built the ML model.
Excerpt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Options for Algorithms
|
Example
Heating Load Prediction – Model Training
This pipeline demonstrates training a ML model to predict whether a weighing scale is balanced. The regression algorithm is selected based on the algorithm evaluation in the Cross Validator (Regression) Snap's example.
Download this pipeline.
Expand | ||
---|---|---|
| ||
InputThe input is generated by the CSV Generator Snap and is composed of the following fields:
ObjectiveUse Trainer (Regression) Snap to train the ML model for the dataset. Data PreparationThis input document is passed through the Type Converter Snap that is configured to automatically detect and convert the data types. In any ML pipeline, you must first analyze the input document using the Profile Snap and the Type Inspector Snap to ensure that there are no null values or that the data types are accurate. This step is skipped in this example for simplicity's sake. Below is a preview of the output from the Type Converter Snap: Model TrainingSince the training algorithm was evaluated in the Cross Validator (Regression) Snap, the Trainer (Regression) Snap is configured with the same settings as shown below: The output from the Snap is the model for the dataset as shown below: The model is written into a file using the File Writer Snap which is configured as shown below: Download this pipeline. |
Additional Example
The following use case demonstrates a real-world scenario for using this Snap:
Downloads
Attachments | ||
---|---|---|
|
Snap History
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|