RAI.AISystem

RAI.AISystem.ai_system module

class RAI.AISystem.ai_system.AISystem(name: str, task: str, meta_database: MetaDatabase, dataset: Dataset, model: Model, enable_certificates: bool = True)[source]

Bases: object

AI Systems are the main class users interact with in RAI. When constructed, AISystems are passed a name, a task type, a MetaDatabase, a Dataset and a Model.

Parameters:
  • name – Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

  • task – Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

  • meta_database – The RAI MetaDatabase class holds Meta information about the Dataset. It includes information about the features, and contains maps and masks to quick get access to the different feature data of different information.

  • dataset – The RAI Dataset class holds a dictionary of RAI Data classes, for example {‘train’: trainData, ‘test’: testData}, where trainData and testData are RAI Data objects.

  • model – Model is RAIs abstraction for the ML Model performing inferences. When constructed, models are optionally passed the name, the models functions for inferences, its name, the model, its optimizer, its loss function, its class and a description. Attributes of the model are used to determine which metrics are relevant.

  • enable_certificates – Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

add_certificates()[source]

Add certificates values to the existing metrics :return: None

add_custom_metrics()[source]

Add custom metrics to existing metrics

Returns:

None

compute(predictions: dict, tag=None) None[source]

Compute will tell RAI to compute metric values across each dataset which predictions were made on

Parameters:
  • predictions(dict) – Prediction value from the classifier

  • tag – by default None

Returns:

None

display_metric_values(display_detailed: bool = False)[source]
Parameters:

display_detailed – if True we need to display metric explanation if False we don’t have to display

Returns:

None

Displays the metric values

get_certificate_info()[source]

Returns the metadata of the certificate_manager class

Parameters:

self – None

Returns:

Certificate info from certificate_manager

get_certificate_values() dict[source]

Returns the last used certificate information

Parameters:

self – None

Returns:

Certificate infomation(dict) Returns the last used certificate information

get_data(data_type: str) Data[source]

get_data accepts data_type and returns the data object information

Parameters:

data_type(str) – Get the data type information

Returns:

Dataset datatype information(str)

get_data_summary() dict[source]

process the data and returns the summary consisting of prediction, label details

Parameters:

self – None

Returns:

Data Summary(Dict)

get_metric_info()[source]

Returns the metadata of the metric_manager class

Parameters:

self – None

Returns:

metric Manager metadata

get_metric_values() dict[source]

Returns the last metric values in the form of key value pair

Parameters:

self – None

Returns:

last metric values(dict)

get_project_info() dict[source]

Fetch the project information like name, configuration, metric user config and Returns the project details

Parameters:

self – None

Returns:

Project details(dict)

initialize(user_config: dict = {}, custom_certificate_location: str | None = None, custom_metrics: dict = {}, custom_functions: list | None = None)[source]
Parameters:
  • user_config – Takes user config as a dict

  • custom_certificate_location – certificate path by default it is None

  • custom_metrics – dict of custom metrics you want to display on the dashboard

  • custom_functions – list of custom functions that take the existing metrics as input and return a value

Returns:

None

run_compute(tag=None) None[source]

Run Compute automatically generates outputs from the model, and compute metrics based on those outputs

Parameters:

tag – tag by default None or we can pass model as a string

Returns:

Data Summary(Dict)

update(data)[source]

RAI.AISystem.model module

class RAI.AISystem.model.Model(output_features=None, predict_fun=None, predict_prob_fun=None, generate_text_fun=None, generate_image_fun=None, name=None, display_name=None, agent=None, loss_function=None, optimizer=None, model_class=None, description=None)[source]

Bases: object

Model is RAIs abstraction for the ML Model performing inferences. When constructed, models are optionally passed the name, the models functions for inferences, its name, the model, its optimizer, its loss function, its class and a description. Attributes of the model are used to determine which metrics are relevant.