Generate NxN Identity dataset

This transform creates an NxN identity dataset for the specified dimensions using the Numpy library and converts it to a pandas dataset. The matrix has all diagonal elements with the value 1 and the off-diagonal with the value 0.

tags: [“Data Preparation”]

Parameters

The table gives a brief description about each parameter in Generate 10x10 Random Int dataset transform.

Name:

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

Output Dataset:

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

value_1:

The dimension of the dataset. (Required: True, Multiple: False, Datatypes: [“LONG”], Options: [“CONSTANT”])

The sample input for this transform looks as shown in the screenshot.

../../../_images/generateidentittydataset_input.png

The output after running the Generate NxN Identity dataset transform on the dataset appears as below:

../../../_images/identitydataset_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 Generate NxN Identity dataset transform:

template=TemplateV2.get_template_by('Generate NxN Identity dataset')

recipe_Generate_NxN_Identity_dataset= project.addRecipe([car_data, employee_data, temperature_data, only_numeric], name='Generate NxN Identity dataset')

transform=Transform()
transform.templateId = template.id
transform.name='Generate NxN Identity dataset'
transform.variables = {
'output_dataset':'id_dataset_n',
'value_1':1}
recipe_Generate_NxN_Identity_dataset.add_transform(transform)
recipe_Generate_NxN_Identity_dataset.run()

Requirements

pandas numpy