Random Forest Classification (ML_CN_7)

This function combines multiple decision trees and aggregates their results to make predictions.

Random Forest is an ensemble machine learning algorithm that combines multiple decision trees to improve performance and reduce overfitting. It creates a set of decision trees by randomly selecting subsets of the features and data samples, and then aggregates the results of the trees to make predictions.

Sample Request

Build a Random Forest Classification model named, "ClassicModel"

{
    "project_id": 1,
    "parent_id": 7,
    "block_id": 8,
    "function_code": "ML_CN_7",
    "args": {
        "model_name": "ClassicModel",
        "criterion": "gini"
    }
}

Building a Random Forest Classification model

Random Forest Classification

POST https://autogon.ai/api/v1/engine/start

Request Body

NameTypeDescription

project_id*

int

The id of the current project

block_id*

int

The id of the current block

function_code*

string

The function code for current block

parent_id*

int

The id of the previous block

args*

object

Block arguments

model_name*

String

Name of the model to be used for prediction.

random_state

int

Seed for random number generation. If provided, it ensures reproducibility of the random processes in the algorithm. If not provided, a random seed will be used

n_estimators

int

The number of trees in the forest (ensemble) used by the algorithm. Each tree contributes to the final prediction. Larger values generally improve performance, but also increase computation time.

criterion

String

The function to measure the quality of a split in the decision tree. Common criteria include gini for the Gini impurity and entropy for information gain. The choice of criterion affects how the decision tree grows and splits its nodes.

{
    "status": "true",
    "message": {
        "id": 8,
        "project": 1,
        "block_id": 8,
        "parent_id": 7,
        "dataset_url": "",
        "x_value_url": "",
        "y_value_url": "",
        "x_train_url": "",
        "y_train_url": "",
        "x_test_url": "",
        "y_test_url": "",
        "output": "{\"ClassicModel\": {\"function_code\": \"ML_R_3\", \"model_url\": ""}}"
    }
}
// Some code

Sample Request

Make predictions with the pre-built model passing an optional test data.

{
    "project_id": 1,
    "parent_id": 8,
    "block_id": 9,
    "function_code": "ML_CN_7_P",
    "args": {
        "model_name": "ClassicModel",
        "test_data": ""
    }
}

Predicting with Random Forest Classification

Random Forest Classification Predict

POST https://autogon.ai/api/v1/engine/start

Request Body

NameTypeDescription

model_name*

String

Name of previously trained model to be used for prediction

test_data

String

Input data for prediction. Defaults to x_train_url in StateManagment

project_id*

int

ID of the current project

block_id*

int

ID of the current block

parent_id*

int

ID of the previous block

function_code*

String

Function code for the current block

{
    "status": "true",
    "message": {
        "id": 9,
        "project": 1,
        "block_id": 9,
        "parent_id": 8,
        "dataset_url": "",
        "x_value_url": "",
        "y_value_url": "",
        "x_train_url": "",
        "y_train_url": "",
        "x_test_url": "",
        "y_test_url": "",
        "output": "{\"y_pred_url\": ""}"
    }
}
// Some code

Sample Request

Evaluate model metrics

{
    "project_id": 1,
    "parent_id": 8,
    "block_id": 9,
    "function_code": "ML_CN_7_M",
    "args": {
        "model_name": "ClassicModel"
    }
}

Decision Tree Classification Metrics

POST https://autogon.ai/api/v1/engine/start

Request Body

NameTypeDescription

project_id*

int

ID of the current project

parent_id*

int

ID of the previous block

block_id*

int

ID of the current block

function_code*

String

Function code for the current block

model_name*

String

Name of the pre-trained model to be used for evaluation

{
    "status": "true",
    "message": {
        "id": 1,
        "project": 12,
        "block_id": 10,
        "parent_id": 11,
        "dataset_url": "",
        "x_value_url": "",
        "y_value_url": "",
        "x_train_url": "",
        "y_train_url": "",
        "x_test_url": "",
        "y_test_url": "",
        "output": "{'confusion_matrix': '', 'accuracy': 0.9}"
    }
}
// Some code

Last updated