Decision Tree Classification (ML_CN_6)

This function finds the K number of training examples closest (nearest neighbors) to the input data and then classifying the input data based on the majority class of its nearest neighbors.

This algorithm works by creating a tree-like model of decisions and their possible consequences. The model starts with a root node that represents the entire dataset and branches out into different nodes that represent possible decisions or features that can be used to split the data into smaller groups.

At each node, the algorithm chooses the feature that results in the greatest information gain, meaning the feature that provides the most information about the class labels of the data points. The process continues recursively until a leaf node is reached, which represents a final decision or classification for the data point.

Decision tree classification is a popular algorithm because it is easy to understand and interpret, and it can work well with both categorical and numerical data.

Sample Request

Build a Decision Tree Classification model named, "ClassicModel"

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

Building a Decision Tree Classification model

Decision Tree Classification

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

Request Body

{
    "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_6_P",
    "args": {
        "model_name": "ClassicModel",
        "test_data": ""
    }
}

Predicting with Decision Tree Classification

Decision Tree Classification Predict

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

Request Body

{
    "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_6_M",
    "args": {
        "model_name": "ClassicModel"
    }
}

Decision Tree Classification Metrics

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

Request Body

{
    "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