miml.data.instance.Instance#

class miml.data.instance.Instance(values: list | None = None, bag=None)#

Bases: object

Class to manage MIML Instance data representation

add_attribute(value=0, position=None) None#

Add an attribute to the instance

Parameters#

valuefloat, default=0

Value for the attribute

position: int, default=None

Position for the attribute

delete_attribute(position) None#

Delete an attribute of the instance

Parameters#

position: int

Position of the attribute

get_attribute(attribute) float#

Get value of an attribute of the instance

Parameters#

attributeint/str

Index/Name of the attribute

Returns#

valuefloat

Value of the attribute

get_attributes() ndarray#

Get data attributes of the instance

Returns#

attributes data: ndarray of shape (n_attributes)

Values of the attributes of the instance

get_attributes_name() list[str]#

Get attributes name of the instance

Returns#

attributeslist[str]

Attributes name of the instance

get_features() ndarray#

Get features values of the instance

Returns#

features data: ndarray of shape (n_features)

Values of the features of the instance

get_features_name() list[str]#

Get features name of the instance

Returns#

featureslist[str]

features name of the instance

get_labels() ndarray#

Get labels values of the instance

Returns#

labels datandarray of shape (n_labels)

Values of the labels of the instance

get_labels_name() list[str]#

Get labels name of the instance

Returns#

labelslist[str]

Labels name of the instance

get_number_attributes() int#

Get numbers of attributes of the instance

Returns#

numbers of attributes: int

Numbers of attributes of the instance

get_number_features() int#

Get numbers of features of the instance

Returns#

numbers of features: int

Numbers of features of the instance

get_number_labels() int#

Get numbers of labels of the instance

Returns#

numbers of labelsint

Numbers of labels of the instance

set_attribute(attribute, value: float) None#

Update value of an attribute of the instance

Parameters#

attributeint/str

Index/Name of the attribute

valuefloat

New value for the attribute

set_bag(bag) None#

Set the bag of the instance

Parameters#

bagBag

Bag of the instance

show_instance() None#

Show instance info in table format