Discretize by Frequency

This transform allows you to create discrete bins from a continuous variable based on specified intervals.

tags: [“Data Preparation”]

Parameters

The table gives a brief description about each parameter in Discretize by Frequency transform.

Name:

By default, the transform name is populated. You can also add a custom name for the transform.

Input Dataset:

The file name of the input dataset. You can select the dataset that was uploaded from the drop-down list. (Required: True, Multiple: False)

Output Dataset:

The file name with which the output dataset is created with bin intervals. (Required: True, Multiple: False)

Column Name:

The column to which discretize by frequency must be applied. (Required: True, Multiple: False, Datatypes: [“STRING”], Options: [‘FIELDS’], Datasets: [‘df’])

Number of bins:

The number of bins that contains the frequency of values. (Required: True, Multiple: False, Datatypes: [‘LONG’], Options: [‘CONSTANT’])

The sample input for this transform looks as below:

../../../_images/discretebyfrequency_input.png

The output after running the Discretize by Frequency transform on the dataset appears as below:

../../../_images/discretebyfrequency_output.png

How to use it in Notebook

The following is the code snippet you must use in the Jupyter Notebook editor to run the Discretize by Frequency transform:

template=TemplateV2.get_template_by('Discretize by Frequency')

recipe_Discretize_by_Frequency= project.addRecipe([car_data, employee_data, temperature_data, only_numeric], name='Discretize by Frequency')

transform=Transform()
transform.templateId = template.id
transform.name='Discretize by Frequency'
transform.variables = {
'input_dataset':'car',
'output_dataset':'car_d_frequency',
'col':"enginesize",
'n':3}
recipe_Discretize_by_Frequency.add_transform(transform)
recipe_Discretize_by_Frequency.run()

Requirements

pandas