Get Prediction Model Details

Returns details about trained prediction models.

The Get Prediction Model Details API returns the details of a specified prediction model.

Quick Start

The API has one required parameter, model_name, which you use to specify the prediction model.

/1/api/[async|sync]/getpredictionmodeldetails/v2?model_name=myprediction

You can find a list of your existing prediction models by using the List Resources API.

You can also specify multiple values of model_name, to return the details of multiple prediction models. For example:

/1/api/[async|sync]/getpredictionmodeldetails/v2?model_name=quarterresults&model_name=annualsales

By default, the API returns information about the structure of the training data, as well as information about the performance measures for the trained model (that is, the algorithm chosen, and details of how well the algorithm fits the training data and matches new data).

You can use the performance_measures and structure parameters to select the information that returns in the API results. Both of these parameters have the default value true. Set the parameters to false to hide the information in the results. For example:

/1/api/[async|sync]/getpredictionmodeldetails/v2?model_name=myprediction&prediction_measures=false

For this example, the API returns only the structure information.

Synchronous
https://api.havenondemand.com/1/api/sync/getpredictionmodeldetails/v2
Asynchronous
https://api.havenondemand.com/1/api/async/getpredictionmodeldetails/v2
Authentication

This API requires an authentication token to be supplied in the following parameter:

Parameter Description
apikey The API key to use to authenticate the API request.
Parameters

This API accepts the following parameters:

Required
Name Type Description
model_name
array<resource> The names of the prediction models that you want to retrieve the details for.
Optional
Name Type Description
performance_measures
boolean Set to false if you do not want to retrieve the performance measures for the selected machine learning model. Default value: true.
structure
boolean Set to false if you do not want to retrieve the structure of the training data. Default value: true.

This API returns a JSON response that is described by the model below. This single model is presented both as an easy to read abstract definition and as the formal JSON schema.

Asynchronous Use

Additional requests are required to get the result if this API is invoked asynchronously.

You can use /1/job/status/<job-id> to get the status of the job, including results if the job is finished.

You can also use /1/job/result/<job-id>, which waits until the job has finished and then returns the result.

Model
This is an abstract definition of the response that describes each of the properties that might be returned.
Get Prediction Model Details Response {
models ( array[Models] ) The details of the specified prediction models.
}
Get Prediction Model Details Response:Models {
model_name ( string ) The name of the model.
date_created ( string ) The date when this model was trained.
model_type ( string ) The type of the trained model.
structure ( array[Structure] , optional) The structure of the training data of the prediction model.
performance_measures ( Performance_measures , optional) The details of the algorithm and performance measures of the model.
}
Get Prediction Model Details Response:Models:Structure {
name ( string ) The name of the field.
order ( string ) The numeric index of the field in the data set.
type ( string ) The type of the field.
properties ( Properties , optional) Some additional properties of the field.
}
Get Prediction Model Details Response:Models:Structure:Properties {
label ( boolean , optional) Indicates whether the field is a label.
}
Get Prediction Model Details Response:Models:Performance_measures {
selected_algorithm ( string ) The name of the algorithm that this prediction model uses.
algorithm_params ( array[Algorithm_params] ) The parameters used to train the model.
prediction_field ( string ) The name of the field which this model was trained to predict.
classification_measures ( Classification_measures , optional) The performance measures for a classification model.
regression_measures ( Regression_measures , optional) The performance measures for a regression model.
selection_strategy ( string , optional) The selection strategy which indicates whether the model is selected by the most accurate or the most precise one.
}
Get Prediction Model Details Response:Models:Performance_measures:Algorithm_params {
param_name ( string , optional) The name of the parameter.
param_value ( string , optional) The value of the parameter.
}
Get Prediction Model Details Response:Models:Performance_measures:Classification_measures {
accuracy ( number ) A statistical measure of how well the classification model performs on the test data. For more information see: https://en.wikipedia.org/wiki/Accuracy_and_precision
precision ( number ) A measure that indicates the proportion of true positives out of all the results that the model identifies as positive. For more information see: https://en.wikipedia.org/wiki/Precision_and_recall#Definition_.28classification_context.29
recall ( number ) A measure that indicates the proportion of positives that are correctly identified. For more information see: https://en.wikipedia.org/wiki/Precision_and_recall#Definition_.28classification_context.29
f_measure ( number ) A measure of the accuracy of the model, which uses the harmonic mean of the precision and recall. For more information see: https://en.wikipedia.org/wiki/F1_score
confusion_matrix ( array[Confusion_matrix] ) A table layout that shows the performance of the model on the test data.
train_accuracy ( number ) A statistical measure of how well the classification model performs on the training data. For more information see: https://en.wikipedia.org/wiki/Accuracy_and_precision.
overfitting ( boolean ) Whether the model describes random error or noise instead of the underlying relationship in the data. If overfitting is true, the model describes error or noise. For more information see: https://en.wikipedia.org/wiki/Overfitting
underfitting ( boolean ) Whether the model successfully modelled the training data. If underfitting is set to true, the model is not a successful predictor. For more information see: https://en.wikipedia.org/wiki/Bias%E2%80%93variance_tradeoff
}
Get Prediction Model Details Response:Models:Performance_measures:Classification_measures:Confusion_matrix {
predicted_label ( string ) The predicted label.
actual_label ( string ) The actual label.
amount ( number ) The number of values that have the specified predicted_label and actual_label values.
}
Get Prediction Model Details Response:Models:Performance_measures:Regression_measures {
overfitting ( boolean ) Whether the model describes random error or noise instead of the underlying relationship in the data. If overfitting is true, the model describes error or noise. For more information see: https://en.wikipedia.org/wiki/Overfitting
mean_squared_error ( number ) The mean square error of the regression model on the test data. For more information see: https://en.wikipedia.org/wiki/Mean_squared_error
root_mean_squared_error ( number ) The root mean square error of the regression model on the test data. For more information see: https://en.wikipedia.org/wiki/Root-mean-square_deviation
mean_absolute_error ( number ) The mean absolute error of the regression model on the test data. For more information see: https://en.wikipedia.org/wiki/Mean_absolute_error
coefficient_of_determination ( number ) A statistical measure that indicates the proportion of the variance in the target variable that is predictable from all other variables on the test data. For more information see: https://en.wikipedia.org/wiki/Coefficient_of_determination
train_mean_squared_error ( number ) The mean square error of the regression model on the training data. For more information see: https://en.wikipedia.org/wiki/Mean_squared_error
train_root_mean_squared_error ( number ) The root mean square error of the regression model on the training data. For more information see: https://en.wikipedia.org/wiki/Root-mean-square_deviation
train_mean_absolute_error ( number ) The mean absolute error of the regression model on the training data. For more information see: https://en.wikipedia.org/wiki/Mean_absolute_error
train_coefficient_of_determination ( number ) A statistical measure that indicates the proportion of the variance in the target variable that is predictable from all other variables on the training data. For more information see: https://en.wikipedia.org/wiki/Coefficient_of_determination
}
Model Schema
This is a JSON schema that describes the syntax of the response. See json-schema.org for a complete reference.
{
    "type": "object",
    "properties": {
        "models": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "model_name": {
                        "type": "string"
                    },
                    "date_created": {
                        "type": "string"
                    },
                    "model_type": {
                        "type": "string",
                        "enum": [
                            "Classification",
                            "Regression"
                        ]
                    },
                    "structure": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "name": {
                                    "type": "string"
                                },
                                "order": {
                                    "type": "string"
                                },
                                "type": {
                                    "enum": [
                                        "DOUBLE",
                                        "RICH_TEXT",
                                        "INTEGER",
                                        "NUMERIC",
                                        "STRING"
                                    ],
                                    "type": "string"
                                },
                                "properties": {
                                    "type": "object",
                                    "properties": {
                                        "label": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            },
                            "required": [
                                "name",
                                "order",
                                "type"
                            ]
                        }
                    },
                    "performance_measures": {
                        "type": "object",
                        "properties": {
                            "selected_algorithm": {
                                "type": "string"
                            },
                            "algorithm_params": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "param_name": {
                                            "type": "string"
                                        },
                                        "param_value": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "prediction_field": {
                                "type": "string"
                            },
                            "classification_measures": {
                                "type": "object",
                                "properties": {
                                    "accuracy": {
                                        "type": "number"
                                    },
                                    "precision": {
                                        "type": "number"
                                    },
                                    "recall": {
                                        "type": "number"
                                    },
                                    "f_measure": {
                                        "type": "number"
                                    },
                                    "confusion_matrix": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "predicted_label": {
                                                    "type": "string"
                                                },
                                                "actual_label": {
                                                    "type": "string"
                                                },
                                                "amount": {
                                                    "type": "number"
                                                }
                                            },
                                            "required": [
                                                "predicted_label",
                                                "actual_label",
                                                "amount"
                                            ]
                                        }
                                    },
                                    "train_accuracy": {
                                        "type": "number"
                                    },
                                    "overfitting": {
                                        "type": "boolean"
                                    },
                                    "underfitting": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "accuracy",
                                    "precision",
                                    "recall",
                                    "f_measure",
                                    "confusion_matrix",
                                    "train_accuracy",
                                    "overfitting",
                                    "underfitting"
                                ]
                            },
                            "regression_measures": {
                                "type": "object",
                                "properties": {
                                    "overfitting": {
                                        "type": "boolean"
                                    },
                                    "mean_squared_error": {
                                        "type": "number"
                                    },
                                    "root_mean_squared_error": {
                                        "type": "number"
                                    },
                                    "mean_absolute_error": {
                                        "type": "number"
                                    },
                                    "coefficient_of_determination": {
                                        "type": "number"
                                    },
                                    "train_mean_squared_error": {
                                        "type": "number"
                                    },
                                    "train_root_mean_squared_error": {
                                        "type": "number"
                                    },
                                    "train_mean_absolute_error": {
                                        "type": "number"
                                    },
                                    "train_coefficient_of_determination": {
                                        "type": "number"
                                    }
                                },
                                "required": [
                                    "mean_squared_error",
                                    "root_mean_squared_error",
                                    "mean_absolute_error",
                                    "coefficient_of_determination",
                                    "train_mean_squared_error",
                                    "train_root_mean_squared_error",
                                    "train_mean_absolute_error",
                                    "train_coefficient_of_determination",
                                    "overfitting"
                                ]
                            },
                            "selection_strategy": {
                                "type": "string",
                                "enum": [
                                    "accuracy",
                                    "precision",
                                    "recall",
                                    "f_measure",
                                    "mean_square_error",
                                    "root_mean_square_error",
                                    "mean_absolute_error",
                                    "r_square"
                                ]
                            }
                        },
                        "required": [
                            "selected_algorithm",
                            "algorithm_params",
                            "prediction_field",
                            "measures"
                        ]
                    }
                },
                "required": [
                    "model_name",
                    "date_created",
                    "model_type"
                ]
            }
        }
    },
    "required": [
        "models"
    ]
}


If you would like to provide us with more information then please use the box below:

We will use your submission to help improve our product.