Skip to main content

SVM Classification

Support Vector Machine (SVM) is a popular supervised machine learning algorithm used for classification tasks. It works by finding the optimal hyperplane that separates different classes of data points in the feature space.

Method: POST Authorization: API Key
https://engine.raccoon-ai.io/api/v1/ml/classification/svm

Authorization

TypeKeyValue
API KeyX-Api-Keyrae_######

Request Body

SectionKeyData TypeRequiredDescription
traindatajsontrueData that use to train the model
featureslisttrueInput features (X)
targetslisttrueOutput targets (y)
configjsonfalseTrain configurations
predictdatajsontrueData that need to predicted by the trained model
configjsonfalsePredict configurations

Types

{
"train" : {
"data" : <json_data>,
"features": <list>,
"targets" : <list>,
"config" : {
"std_scale": <boolean>,
"encoder" : <"label" | "drop">,
"val_size" : <float>
}
},
"predict": {
"data": <json_data>,
"config": {
"include_inputs": <boolean>,
"round": <int>
}
}
}

Sample

{
"train": {
"data": {
"R&D Spend": {
"0": 165349.2,
"1": 162597.7,
"2": 153441.51,
"3": 144372.41,
"4": 142107.34,
"5": 131876.9,
"6": 134615.46,
"7": 130298.13,
"8": 120542.52,
"9": 123334.88
},
"Administration": {
"0": 136897.8,
"1": 151377.59,
"2": 101145.55,
"3": 118671.85,
"4": 91391.77,
"5": 99814.71,
"6": 147198.87,
"7": 145530.06,
"8": 148718.95,
"9": 108679.17
},
"Marketing Spend": {
"0": 471784.1,
"1": 443898.53,
"2": 407934.54,
"3": 383199.62,
"4": 366168.42,
"5": 362861.36,
"6": 127716.82,
"7": 323876.68,
"8": 311613.29,
"9": 304981.62
},
"State": {
"0": "New York",
"1": "California",
"2": "Florida",
"3": "New York",
"4": "Florida",
"5": "New York",
"6": "California",
"7": "Florida",
"8": "New York",
"9": "California"
},
"Profit": {
"0": 192261.83,
"1": 191792.06,
"2": 191050.39,
"3": 182901.99,
"4": 166187.94,
"5": 156991.12,
"6": 156122.51,
"7": 155752.6,
"8": 152211.77,
"9": 149759.96
}
},
"features": ["R&D Spend", "Administration", "Marketing Spend", "Profit"],
"targets": ["State"],
"config": {
"std_scale": true,
"encoder": "label"
}
},
"predict": {
"data": {
"R&D Spend": {
"0": 165349.2,
"1": 162597.7
},
"Administration": {
"0": 136897.8,
"1": 151377.59
},
"Marketing Spend": {
"0": 471784.1,
"1": 443898.53
},
"Profit": {
"0": 471784.1,
"1": 443898.53
}
},
"config": {
"include_inputs": true,
"round": 2
}
}
}

Reponse Body

KeyData TypeDescription
successbooleanIndicate the success of the request
msgstringMessage indicators
errorstringError information, only set if success is false
resultjsonResult, only set if success is true
scorejsonAccuracy scores of the training and testing phases, only set if success is true
generated_tsfloatGenerated timestamp

Types

{
"success": <boolean>,
"msg": <string>,
"error": <string>,
"result": <json>,
"score": {
"train": <float>,
"test": <float>
},
"generated_ts": <timestamp>
}

Sample

{
"success": true,
"msg": "Model trained and predicted successfully",
"error": null,
"result": {
"R&D Spend": {
"0": 165349.2,
"1": 162597.7
},
"Administration": {
"0": 136897.8,
"1": 151377.59
},
"Marketing Spend": {
"0": 471784.1,
"1": 443898.53
},
"Profit": {
"0": 190209.72,
"1": 186863.18
},
"State": {
"0": "New York",
"1": "California"
}
},
"score": {
"train": 0.942446542689397,
"test": 0.9649618042060305
},
"saved_in": null,
"generated_ts": 1685439220.425382
}