Categorical to Numeric
On this Page
Overview
This is a Transform type Snap that converts categorical fields into numeric fields. There are two available encoding options: Integer Encoding and One Hot Encoding.
Input and Output
Expected input
- First input view: A document containing categorical fields.
- Second input view: A document containing data statistics computed by the Profile Snap.
Expected output: A document containing numeric field.
Expected upstream Snaps
- First input view: A Snap that has a document output view. For example, Mapper, CSV Generator, or Categorical to Numeric.
- Second input view: A sequence of File Reader and JSON Parser Snaps. These Snaps read the data statistics computed by the Profile Snap in another pipeline. It is required to select Value distribution in the Profile Snap and set Top value limit according to the number of unique values; or set to 0, which means unlimited.
Expected downstream Snaps: A Snap that has a document input view. For example, Mapper, JSON Formatter, or Type Converter.
Prerequisites
None.
Configuring Accounts
Accounts are not used with this Snap.
Configuring Views
Input | This Snap has exactly two document input views, the Data input view and the Profile 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: Works in Ultra Pipelines.
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. |
---|---|
Policy | The preferences for fields and encoding methods. For each policy, select the input field with categorical values, the encoding method, and the result field. |
Field | Required. The field that must be transformed. This is a suggestible property that lists all available fields in the input documents. Default value: None. |
Rule | Required. The type of transformation to be performed on the selected field. Two options are available:
Default value: Integer Encoding |
Result field | Required. The result field that is used in the output map. If the variable in the Result field property is the same as the one in the Field property, the values are overwritten. If the Result field does not exist in the original input document, a new field is added. Default value: None. |
Snap Execution | Select one of the following three modes in which the Snap executes:
Default Value: Execute only |
Best Practices
We recommend you use the Sort Snap before the Categorical to Numeric Snap to prevent the pipeline from stalling when handling large datasets.
We recommend you use the Profile Snap in another (child/parent pipeline) pipeline and process the results to use with Categorical to Numeric Snap when handling large datasets.
Examples
Assigning Team based on Position
This pipeline demonstrates how you can use the Categorical to Numeric Snap to assign team number for employees (numeric) based on their position (categorical).
Download this pipeline.
Additional Example
The following use case demonstrates a real-world scenario for using this Snap:
Downloads
Important steps to successfully reuse Pipelines
- Download and import the pipeline into the SnapLogic application.
- Configure Snap accounts as applicable.
- Provide pipeline parameters as applicable.
Snap Pack History
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2024 SnapLogic, Inc.