Compartir a través de


Role Class

Some columns play a specific role for specific learners or transforms. This is the complete list.

Inheritance
builtins.object
Role

Examples


   from nimbusml import Role
   from nimbusml import Pipeline  # similar to Pipeline
   from nimbusml.linear_model import FastLinearRegressor
   import pandas
   X = pandas.DataFrame(dict(education=[2,4,6,4,3],
                               workclass=[0,2,3,4,0],
                               weights=[1., 1., 1., 2., 1.],
                               y=[1.1, 2.2, 1.24, 3.4, 3.4]))
   lr = FastLinearRegressor()                 << {Role.Label:'y', Role.Feature:['weights', 'workclass']}

   # equivalent to
   # FastLinearRegressor(label = 'y',
                         feature = ['weights', 'workclass'])

   exp = Pipeline([lr])
   exp.fit(X)
   prediction = exp.predict(X)

Remarks

Column roles can be specified for each transform and learner during initialization. For more details, please refer to Roles.

Methods

to_attribute

Converts a role into an attribute name. GroupId --> row_group_column_name.

to_parameter

Converts a role into (as per manifesrt.json) parameter name. GroupId --> RowGroupColumnName.

to_role

Converts an attribute name to role row_group_column_name -> group_id.

to_attribute

Converts a role into an attribute name. GroupId --> row_group_column_name.

to_attribute(role, suffix='_column_name')

Parameters

Name Description
role
Required
suffix
Default value: _column_name

to_parameter

Converts a role into (as per manifesrt.json) parameter name. GroupId --> RowGroupColumnName.

to_parameter(role, suffix='ColumnName')

Parameters

Name Description
role
Required
suffix
Default value: ColumnName

to_role

Converts an attribute name to role row_group_column_name -> group_id.

to_role(column_name, suffix='_column_name')

Parameters

Name Description
column_name
Required
suffix
Default value: _column_name

Attributes

Feature

Feature = 'Feature'

GroupId

GroupId = 'GroupId'

Item

Item = 'Item'

Label

Label = 'Label'

Name

Name = 'Name'

RowId

RowId = 'RowId'

User

User = 'User'

Weight

Weight = 'Weight'