Bin columns
This transform takes column of data and divides the values in a given column into the specified number of bins.
tags: [“EDA”]
Parameters
The table gives a brief description about each parameter in Bin columns transform.
- Name:
By default, the transform name is populated. You can also add a custom name for the transform.
- Raw 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)
- Number of bins:
The total number of bins into which values must be divided.
- Target column:
The column that must be excluded from binning.
- Output Dataset:
The file name with which the output dataset is created returning the dataset after binning columns. (Required: True, Multiple: False)
Sample input for Bin columns transform:
The output after running the Bin columns 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 Bin columns transform:
binned_col_ds_name = dataset_input_name + "_binned"
transform = Transform()
transform.name = "bin columns"
transform.templateId = bin_cols.id
transform.variables = {
"inputDataset": dataset_w_one_hot_encoding.name,
"numOfBins": 5,
"targetCol": targetCol,
"OutputDataset": binned_col_ds_name,
}
recipe_bin = project.addRecipe([dataset_w_one_hot_encoding], name="bin_cols")
# recipe_bin.prepareForLocal(transform, contextId="recipe_bin")
recipe_bin.addTransform(transform)
recipe_bin.run()
Requirements
pandas