AcroLearner

FREE
By Samurai | Updated vor einem Monat | Artificial Intelligence/Machine Learning
Health Check

N/A

Back to All Tutorials (8)

How to generate AcroLearner NLP/Linear/Logistic Model

AcroLearner includes a set of RESTful APIs about TextClassification(Naive Bayes Classifier Model) for Natural Language Processing, Linear Regression Prediction and Logistic Regression Classification. Generally, the following steps is necessary.

  1. First of all, a new Machine Learning Theme is posted with some parameters and its items or not. You will get "trainKey" and “resultKey”.
    "trainKey" is unique only for this theme. “resultKey” is changeable. Actually a different “resultKey” will available when you call the Theme every time.

  2. Then you may individually post or put some items of the theme above.

  3. Once you finish the registration of Machine Learning Theme and its items, you may start a training/learning process to generate a Machine Learning Model using “trainKey”.

  4. Finally, you may post your original data to Machine Learning Model above and get the result of Classification/Prediction using “resultKey”.

*Only Japanese morphological analysis is processed, other alphabet languages should be partially supported.
*Test data for Text Classification
https://www.kaggle.com/uciml/sms-spam-collection-dataset
*Test data for Linear Regression Prediction
http://lib.stat.cmu.edu/datasets/boston
*Test data for Logistic Regression Classification
https://archive.ics.uci.edu/ml/machine-learning-databases/iris/

##0301. Generate Text Classification Model
Generate a Naive Bayes Classifier Model according to the trainText(text datasets) whick inputed in Learning item in advance. Maybe it will some time depending on the amount of learning items.
https://acrolearner.p.rapidapi.com/AcroLearner/v0_1/CltService/ml/trains/{trainKey}/bayesmodel
http method: get

Request Header parameters:

x-rapidapi-host: acrolearner.p.rapidapi.com
x-rapidapi-key: [your rapidapi-key]

Request Path parameters:

{trainKey}: XXXXXXXXXX

Response JSON Example:

-Successful case:

{
    "contents": {
        "code": "0000",
        "list": null,
        "message": "Congratulations on your success!",
        "subject": "generateBayesModel"
    },
    "errors": null,
    "memo": "",
    "result": true
}

##0302. Generate Linear Regression Prediction Model
Generate a Linear Single or Multiple Regression Prediction Model according to the trainText(Space-separated numeric string datasets) whick inputed in Learning item in advance.
https://acrolearner.p.rapidapi.com/v0_1/CltService/ml/trains/{trainKey}/linearmodel
http method: get

Request Header parameters:

x-rapidapi-host: acrolearner.p.rapidapi.com
x-rapidapi-key: [your rapidapi-key]

Request Path parameters:

{trainKey}: XXXXXXXXXX

Request Query parameters Example:

learnCount=1000&learnRate=0.001&interval=100
learnCount: learning times
learnRate: learning increment rate
interval: the output interval of learning result

Response JSON Example:

Linear Regression Prediction successful case

{
    "contents": {
        "code": "0000",
        "list": [
            "SN,Weight,Loss,Score",
            "1,{1; 1},308.4498676818182,0.9927791053815644",
            "101,{1.3335372143; 3.404064965},59.63488444027081,0.9986039312664904",
            "201,{1.2960080365; 3.447393481},59.53875654442126,0.9986061816464663",
            "301,{1.2528762643; 3.4547443018},59.500462022920274,0.998607078131546",
            "401,{1.2097102695; 3.4615389043},59.46227285172398,0.9986079721503467",
            "501,{1.1665948339; 3.4683170017},59.424175408217614,0.9986088640217774",
            "601,{1.1235311877; 3.4750868272},59.386169468981585,0.9986097537510685",
            "701,{1.0805192885; 3.4818485159},59.34825481423575,0.998610641343365",
            "801,{1.0375590744; 3.4886020793},59.31043122472871,0.9986115268037997",
            "901,{0.9946504833; 3.4953475274},59.27269848173554,0.998612410137493",
            "1000,{0.9522217683; 3.5020175365},59.23543234030855,0.9986132825479177",
            "****,{0.951793453; 3.5020848698},59.23505636705676,0.998613291349553"
        ],
        "message": "Congratulations on your success!",
        "subject": "generateLinearModel"
    },
    "errors": null,
    "memo": "",
    "result": true
}

SN: Serial Number
Weight: Weight vector value for Linear Regression calculation.
Loss: difference square between actual value and predicting value.
Score: if the coefficient of determination(Score) in last row is close to 1, a satisfying prediction will be available.

##0303. Generate Logistic Regression Classification Model
Generate a Logistic Regression Classification Model according to the trainText(Space-separated numeric string datasets) whick inputed in Learning item in advance.
https://acrolearner.p.rapidapi.com/v0_1/CltService/ml/trains/{trainKey}/logisticmodel
http method: post

Request Header parameters:

Content-Type: application/json
x-rapidapi-host: acrolearner.p.rapidapi.com
x-rapidapi-key: [your rapidapi-key]

Request Path parameters:

{trainKey}: XXXXXXXXXX

Request Query parameters Example:

testPercent=30&learnCount=1000&learnRate=0.001&interval=100
testPercent: test data ratio in the input training data set
learnCount: learning times
learnRate: learning increment rate
interval: the output interval of learning result

Request JSON Example:

Logistic Regression Classification case

[
  {
    "trainText": "10 20 30 40"
  },
  {
    "trainText": "11 21 31 41"
  }
]

trainText: Besides test data from the Theme Items’ trainText by “testPercent” in Query parameters is available, you may also directly put some test data here.
Important
"testPercent>0 or Test data is not null here" is required! And it is necessary for every “trainText” to keep the same demension.

Response JSON Example:

Logistic Regression Classification case

{
    "contents": {
        "code": "0000",
        "list": [
            "SN,Weight,Loss,Score",
            "1,{{1,1},{1,1},{1,1},{1,1},{1,1}},0.6931471805599453,0.6086956521739131",
            "101,{{1.0105116143,0.9894883857},{1.034745432,0.965254568},{1.0487071501,0.9512928499},{0.9667639716,1.0332360284},{0.9838399563,1.0161600437}},0.6203867696736458,0.6086956521739131",
            "201,{{1.015722338,0.984277662},{1.042430487,0.957569513},{1.0791300859,0.9208699141},{0.9250720304,1.0749279696},{0.9660924127,1.0339075873}},0.5548075279601609,0.6086956521739131",
            "301,{{1.0201100109,0.9798899891},{1.0471591866,0.9528408134},{1.105762125,0.894237875},{0.8855230979,1.1144769021},{0.9494210873,1.0505789127}},0.4962777326422268,0.6956521739130435",
            "401,{{1.0241633336,0.9758366664},{1.0514576501,0.9485423499},{1.1302782648,0.8697217352},{0.8489646716,1.1510353284},{0.9339984288,1.0660015712}},0.44654697748400485,0.9565217391304348",
            "501,{{1.027952374,0.972047626},{1.0555795366,0.9444204634},{1.1530122773,0.8469877227},{0.8152021782,1.1847978218},{0.9197284667,1.0802715333}},0.404368534565998,1.0",
            "601,{{1.0315017209,0.9684982791},{1.0595358926,0.9404641074},{1.1741457389,0.8258542611},{0.7839445643,1.2160554357},{0.9064925225,1.0935074775}},0.3684118520898674,1.0",
            "701,{{1.0348312587,0.9651687413},{1.0633209408,0.9366790592},{1.1938355221,0.8061644779},{0.7549176184,1.2450823816},{0.8941798249,1.1058201751}},0.337565543032037,1.0",
            "801,{{1.0379598772,0.9620401228},{1.0669340316,0.9330659684},{1.2122249301,0.7877750699},{0.7278772042,1.2721227958},{0.8826913842,1.1173086158}},0.3109303228696772,1.0",
            "901,{{1.0409053569,0.9590946431},{1.0703793399,0.9296206601},{1.2294436691,0.7705563309},{0.7026089544,1.2973910456},{0.8719398952,1.1280601048}},0.28778234805224806,1.0",
            "1000,{{1.0436570899,0.9563429101},{1.0736318725,0.9263681275},{1.2454510515,0.7545489485},{0.6791551488,1.3208448512},{0.8619466671,1.1380533329}},0.26772835004395334,1.0",
            "****,{{1.0436841023,0.9563158977},{1.0736639506,0.9263360494},{1.2456078217,0.7543921783},{0.6789256061,1.3210743939},{0.8618487977,1.1381512023}},0.2675386627621387,1.0"
        ],
        "message": "Congratulations on your success!",
        "subject": "generateLogisticModel"
    },
    "errors": null,
    "memo": "",
    "result": true
}

SN: Serial Number
Weight: Weight vector value for Linear Regression calculation.
Loss: difference between actual value and predicting value.
Score: if Score in last row is close to 1, a satisfying calculation accuracy will be available.