Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this Page

Table of Contents
maxLevel32
excludeOlder Versions|Additional Resources|Related Links|Related Information

Overview

This is a Transform type Snap that converts numeric fields into categoricalfields. There are two available splitting options: splitting by values and binning.

Image RemovedImage Added

Input and Output

Expected input

  • Dataset in the first First input view: A document that contains numeric fields.Profile information in the second
  • Second input view: A document that contains data statistics computed by the Profile Snap.

Expected output: Document data containing the original dataset along with the data converted from numeric to categorical format A document that contains categorical fields.

Expected upstream Snaps:

  • First Input View: Any Snap, such as the CSV Generator Snap, that offers a document view in its output.Second Input View: A Profile Snap that offers data statistics necessary for performing a numeric to categorical conversion, or a combination of a File Reader Snap and JSON Parser Snap to read the profile information from SLDBinput view: A Snap that has a document output view. Example: CSV Generator Snap.
  • 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.

Expected downstream Snaps: Any Snap that accepts document data in the  A Snap that has a document input view. Example: Mapperthe Aggregate Snap, or a combination of JSON Formatter and File Writer to write the file to SLDB.

Prerequisites

A basic understanding of the sampling algorithms supported by the Snap is preferableNone.

Configuring Accounts

Accounts are not used with this Snap.

Configuring Views

 Input

This Snap has exactly two

input views

document input views, the Data input view and the Profile input view.

OutputThis Snap has exactly one document output view.
ErrorThis Snap has at most one document error view.

Troubleshooting

None

Limitations and Known Issues

None

Modes

  • Ultra pipelinesPipelines: Works with Ultra Pipelines only when the Profile Snap is not used upstream.Spark mode: Does not support Spark mode Works in Ultra Pipelines.


Snap Settings


LabelRequired. 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

This setting allows you to specify your preferences about The preferences for fields and transformationsencoding methods. For each policy, select the input field , it is possible to apply multiple transformations, this results in multiple

output fields. Note that the policy is applied from top to bottom

with categorical values, the encoding method, and the result field.

Field

The field to be Required. The field that must be transformed. This is a suggestible field and will suggest all property that lists all available fields in the datasetinput documents.

Default value: None

Rule

Required. The type of transformation to be performed on the selected field. Two options are available:

  • Split by valuesValues: Splitting the data range into ranges specifies by "Split points" optionspecified by the Splits/Bins property. Each range will be is replaced with the text specified in in the Prefix/Values property.
  • Binning: Splitting the data range into equally-sized ranges based on the number of ranges items specified by in the number of Prefix/Values property below.

Please see the example below for better understanding.

  • . If you specify a prefix value in the Prefix/Values property, you must specify the number of bins in the Splits/Bins property.

Default value: Split by Values

Prefix/Values

Categorical values to be used to replace original numeric values. You can use the values in this field either as specify either a prefix or multiple values in this property. For example, if the prefix is "group", the values will be "group_1", "group_2" and so on. In case of specifying values, use comma "," to separate them.

Default value: None

Splits/Bins

The values to be entered into this field change based property depends on the selection you made in the Rule fieldproperty.

  • If you chose Split by valuesValues: This setting must contain a list of split points. "2,4,6,8,10" is the same as "2,4,...,10".
  • If you chose Binning: This setting is property specifies the number of bins into which you want to divide the input data range.

Default value: None

Result field

Required. The result field that must be used in the output map. If the Result field is the same as Field, the values are overwritten. If the Result field does not exist in the original input document, a new field is added. 

Default value: None

Additional Resources

Snap History

Snap Execution


Select one of the following three modes in which the Snap executes:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.

  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.

  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default ValueExecute only
Example: Validate & Execute


Examples


Converting Numeric Data into Categorical Values

This pipeline demonstrates how you can use the Numeric to Categorical Snap to convert numeric fields into categorical fields.
Image Added

Download this pipeline.

Expand
titleUnderstanding the Pipeline

In this example, the CSV Generator Snap contains sample data with numeric fields. The Copy Snap duplicates the data flow and feeds it into the Numeric to Categorical and Profile Snaps. The Profile Snap generates input data statistics and feeds them into the Numeric to Categorical Snap. The Numeric to Categorical Snap then converts the numeric values in the fields of your choice into categorical values, based on the splitting method you select.


Enter the following data into the CSV Generator Snap:

Image Added


First, we need to convert values in $experience into numeric values. We do this using a Type Converter Snap with the Auto check box selected.

We want to categorize employees based on their years of experience into "junior", "senior", and "principal". We choose Binning in the Rule property to ensure that the data ranges after splitting are equally spaced.

The Numeric to Categorical Snap contains the following settings:

Image Added

The Profile Snap computes the min and max values in the input data, which is required by Binning.

Image Added


As you can see, $experience contains min and max values, which are 1 and 22 respectively.

Image Added

The preview output of the Numeric to Categorical Snap is shown below. This Snap adds one field to the output.

  • $level: This field displays categories of employees based on their years of experience.

Image Added


Downloads

Multiexcerpt include macro
namedownload_instructions
pageOpenAPI

Attachments
uploadfalse
oldfalse
patterns*.slp, *.zip


Insert excerpt
ML Data Preparation Snap Pack
ML Data Preparation Snap Pack
nopaneltrue