Discretize by Size
This transform allows you to create discrete bins from a continuous variable based on specified quantiles.
tags: [“Data Preparation”]
Parameters
The table gives a brief description about each parameter in Discretize by Size 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 quantile values. (Required: True, Multiple: False)
- Column:
The column to discretize. (Required: True, Multiple: False, Datatypes: [“STRING”], Options: [‘FIELDS’], Datasets: [‘df’])
- Bins:
The number of bins with quantile of values. (Required: True, Multiple: False, Datatypes: [“STRING”], Options: [‘CONSTANT’])
The sample input for this transform looks as below:
The output after running the Discretize by Size transform on the dataset appears as below:
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 Size transform:
template=TemplateV2.get_template_by('Discretize by Size')
recipe_Discretize_by_Size= project.addRecipe([car_data, employee_data, temperature_data, only_numeric], name='Discretize by Size')
transform=Transform()
transform.templateId = template.id
transform.name='Discretize by Size'
transform.variables = {
'input_dataset':'car',
'output_dataset':'car_d_size',
'col':"enginesize",
'bin':"[50,100,150,200]"}
recipe_Discretize_by_Size.add_transform(transform)
recipe_Discretize_by_Size.run()
Requirements
pandas