Performance assessment

Endpoints to obtain fairness metrics for your AI models

Get performance metrics

GET https://api.expai.io/api/performance/<model_id>/get_metrics

For a given model in your projects, get the available performance metrics

Path Parameters

NameTypeDescription

model_id

string

Unique ID for the model

Headers

NameTypeDescription

access-token

string

Active JWT token

{
    "code": "success",
    "http_code": 200,
    "message": "success",
    "metrics": {
        "Mean absolute error (MAE)": "mean_absolute_error",
        "Mean squared error (MSE)": "mean_squared_error",
        "R2 Score": "r2_score",
        "Root mean squared error (RMSE)": "root_mean_squared_error"
    }
}

Compute Performance Metrics on subgroups

POST https://api.expai.io/api/performance/<model_id>/compute

This endpoint returns the desired performance metrics for your model on specific subset of data given by a variable.

Path Parameters

NameTypeDescription

model_id

string

Unique ID for the model you want to evaluate

Headers

NameTypeDescription

access-token

string

Active JWT token

Request Body

NameTypeDescription

metrics

array

List of metrics to be evaluated. You must provide the value of the dictionary returned by the previous endpoint.

sample_id

string

ID for the sample used to evaluate the model. It must contain a target column (supervised).

variable

string

Variable used to segment the data into groups.

variable_type

object

Dictionary of the shape {variable: <TYPE>}. Available types are: "numerical" and "categorical".

subset_indexes

array

Array containing the indexes of the filtered entries that should be considered.

subset_filters

object

Dictionary containing filtering rules for the dataframe.

target_class

string

If you are explaining a categorical model, choose the class for which you want to obtain insights.

{
    "group_metrics": {
        "2012": {
            "Mean squared error (MSE)": 55597287.77921276,
            "R2 Score": 0.8464727420256901
        },
        "2013": {
            "Mean squared error (MSE)": 131866772.47007993,
            "R2 Score": 0.7984998271644645
        },
        "2014": {
            "Mean squared error (MSE)": 112957338.09533538,
            "R2 Score": 0.8934880347241547
        },
        "2015": {
            "Mean squared error (MSE)": 164460968.7939401,
            "R2 Score": 0.8908172129393476
        },
        "2016": {
            "Mean squared error (MSE)": 260609158.18212545,
            "R2 Score": 0.9406037510358035
        },
    "http_code": 200,
    "message": "success",
    "overall_metrics": {
        "Mean squared error (MSE)": 45145913.93682745,
        "R2 Score": 0.9235097053991715
    }
}

Last updated