arthurai.core.attributes.ArthurAttribute#

class arthurai.core.attributes.ArthurAttribute(name, value_type, stage, id=None, label=None, position=None, categorical=False, min_range=None, max_range=None, monitor_for_bias=False, categories=None, bins=None, is_unique=False, is_positive_predicted_attribute=False, attribute_link=None, gt_class_link=None, token_attribute_link=None, implicit=False)#

Bases: arthurai.core.base.ArthurBaseJsonDataclass

ArthurAttribute encapsulates data associated with a model attribute

Parameters
  • attribute_link (Optional[str]) – Only applicable for GroundTruth or PredictedValue staged attributes. If stage is equal to GroundTruth, this represents the associated PredictedValue attribute and vice versa

  • is_positive_predicted_attribute (bool) – Only applicable for PredictedValue attributes on a Binary Classification model. Should be set to True on the positive predicted value attribute.

  • is_unique (bool) – Boolean value used to signal if the values of this attribute are unique. To set an attribute to be unique, use arthur_model.get(name=attribute_name).set(is_unique=True).

  • bins (Optional[List[AttributeBin]]) – List of bin cut-offs used to discretize continuous attributes. Use None as an open ended value. [None, 18, 65, None] represents the three following bins: value < 18, 18 < value < 65, value > 65. To modify an attribute’s bins, use arthur_model.get_attribute(name=attribute_name).set(bins=[None, cutoff_1, ..., cutoff_n, None]).

  • monitor_for_bias (bool) – boolean value set to True if the attribute should be monitored for bias. To modify an attributes’s bias monitoring status, use arthurai.core.models.ArthurModel.set_attribute_as_sensitive().

  • max_range (Union[int, float, None]) – Max value for a continuous attribute. To modify an attribute’s range, use arthur_model.get(name=attribute_name).set(range=[min_value, max_value]).

  • min_range (Union[int, float, None]) – Min value for a continuous attribute. To modify an attribute’s range, use arthur_model.get(name=attribute_name).set(range=[min_value, max_value]).

  • categorical (Optional[bool]) – Boolean value set to True if the attribute has categorical values. To set an attribute to be categorical, use arthur_model.get_attribute(name=attribute_name).set(categorical=true).

  • position (Optional[int]) – The array position of attribute within the stage. Required in the PREDICT_FUNCTION_INPUT stage.

  • label (Optional[str]) – Label for attribute. If attribute has an encoded name, a more readable label can be set.

  • stage (Stage) – arthurai.common.constants.Stage of this attribute in the model pipeline. To modify an attribute’s stage, use arthur_model.get(name=attribute_name).set(stage=stage_value). See arthurai.common.constants.Stage for the different stage values an attribute can have.

  • value_type (ValueType) – arthurai.common.constants.ValueType associated with this attributes values. Non-modifiable.

  • name (str) – Name of the attribute. Attribute names can only contain alpha-numeric characters and underscores and cannot start with a number. To modify an attribute’s name, use arthurai.core.models.ArthurModel.rename_attribute().

  • categories (Optional[List[AttributeCategory]]) – [Only for Categorical Attributes] If the attribute is categorical, this will contain the attribute’s categorical values and the labels for each value. It is required only if the categorical flag is set to true. To modify the category values, use arthur_model.get(name=attribute_name).set([{'value': value_1}, ..., {'value': value_n}]). To mofidy the category labels, use arthurai.core.models.ArthurModel.set_attribute_labels().

  • gt_class_link (Optional[str]) – Optional link for a predicted attribute to its corresponding value in a ground truth class attribute

  • implicit (bool) – is the attribute implicitly created by the API

Methods

clean_nones

Helper function to filter out None objects from a json or dictionary representation of an object

from_dict

rtype

TypeVar(A, bound= DataClassJsonMixin)

from_json

rtype

TypeVar(A, bound= DataClassJsonMixin)

schema

rtype

SchemaF[TypeVar(A)]

set

Set one or many of the available properties of the ArthurAttribute class

short_name

to_dict

Creates a dictionary representation of this object

to_json

Creates a json representation of this object

Attributes

attribute_link

bins

categorical

categories

dataclass_json_config

gt_class_link

id

implicit

is_positive_predicted_attribute

is_unique

label

max_range

min_range

monitor_for_bias

position

token_attribute_link

name

value_type

stage

static clean_nones(d)#

Helper function to filter out None objects from a json or dictionary representation of an object

Parameters

d – a Dictionary or Json representation of an ArthurBaseJsonDataclass object

Returns

Dictionary of the object with all None components removed

set(**kwargs)#

Set one or many of the available properties of the ArthurAttribute class

to_dict(skip_none=True)#

Creates a dictionary representation of this object

This function can be applied to any extension of the ArthurBaseJsonDataClass

Return type

dict

Returns

Dictionary of object data

to_json(skip_none=True)#

Creates a json representation of this object

This function can be applied to any extension of the ArthurBaseJsonDataClass

Return type

str

Returns

json of object data