Назад ко всем руководствам (8)

Description and Examples for AcroLearner Learning Theme

AcroLearner is a set of Machine Learning RESTful APIs including TextClassification(Naive Bayes Classifier Model) for Natural Language Processing, Linear Regression Prediction, Logistic Regression Classification and Time Seris Prediction. 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/

##0101. Get Learning Theme
Get the property information of Learning Theme including resultKey.
https://acrolearner.p.rapidapi.com/AcroLearner/v0_1/CltService/ml/trains/{trainKey}
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": {
        "createDT": "2021-10-10 14:25:32.0",
        "itemCount": 2,
        "items": null,
        "language": 0,
        "memo": null,
        "noSymbol": 0,
        "partOfSpeech": null,
        "predictWeight": "{0.951793453; 3.5020848698}",
        "resultKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "searchMode": 0,
        "statusId": 1,
        "subject": "Linear Regression Test1",
        "trainId": 10014,
        "trainKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "trainType": 1,
        "updateDT": "2021-10-10 14:25:32.0"
    },
    "errors": null,
    "memo": "Congratulations on your success!",
    "result": true
}

“trainType”: 1:NaivebayesTextClassification, 2:LinearRegression, 3:LogisticRegression, 4:TimeSeriesAR, 5:TimeSeriesMA, 6:TimeSeriesARMA, 7:TimeSeriesARIMA
"trainKey": the key automatically generated for training/learning
"resultKey": the key automatically generated for the result Prediction/Classification
"language": 0:English, 1:Japanese, 2:Other; only for Natural Language Process
"noSymbol",“partOfSpeech”,“searchMode”: only for Natural Language Process Classification
"itemCount": the item count number of this theme
"predictWeight": the weight by Machine Learning for Linear Regression Prediction, Logistic Regression Classification and Time Series Prediction
"statusId": the status of Learning Theme.(0:new; 1:validate; 2:logical deletion)
** Important **please set [StatusId] to [1] in advance before calling the following Learning/Classification/Prediction API.

##0102. Add Learning Theme
Add a new Machine Learning Theme. It is also possible to add the learning theme together with its item data. “category” is only used in natural language classification learning, and Multiple items can be kept in a same category. If successfully, please record the trainKey and resultKey.
https://acrolearner.p.rapidapi.com/AcroLearner/v0_1/CltService/ml/trains
http method: post

Request Header parameters:

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

Request JSON Example:

Text Classification case

{
    "subject": "Test1",
    "trainType": 0,
    "searchMode": 0,
    "partOfSpeech": null,
    "language": 1,
    "noSymbol": 1,
    "statusId": 1,
    "memo": "BBBB",
    "items": [
            {
                "category": "spam",
                "trainText": "XXXXXXXXXXXXXXXXX",
                "memo": "test"
            },
            {
                "category": "usual",
                "trainText": "XXXXXXXXXXXXXXXXX",
                "memo": "test"
            }
     ]
}

“trainType”: 1:NaivebayesTextClassification, 2:LinearRegression, 3:LogisticRegression, 4:TimeSeriesAR, 5:TimeSeriesMA, 6:TimeSeriesARMA, 7:TimeSeriesARIMA
"language": 0:English, 1:Japanese, 2:Other; only for Natural Language Process
"noSymbol",“partOfSpeech”,“searchMode”: only for Natural Language Process Classification
"statusId": the status of Learning Theme.(0:new; 1:validate; 2:logical deletion)
Important please set [StatusId] to [1] in advance before calling the following Learning/Analyse/Prediction API.
“items”.“category”: category is only used in natural language classification learning, and multiple items may be kept in a same category.
“items”.“trainText”:

  • For NaivebayesTextClassification: category is used here, and Multiple items can be kept in a same category.
  • For Linear Repression Prediction: at least two items are required, put a numerical string in trainText which are separated with spaces, the splitting count of every string is identical. The numerical string in the last trainText is the true value.
  • For Logistic Repression Classification: at least two items are required. The classification values is stored in the last trainText, and they can be a character strings. These numerical strings or character string in trainText are separated with spaces, the splitting count of every strings is identical.
  • For Time Series Prediction: only a trainText is required. put a numerical string in trainText which are separated with spaces.

Response JSON Example:

Linear Regression Prediction successful case

{
    "contents": {
        "createDT": "2021-10-24 19:49:39.950",
        "itemCount": 0,
        "items": [
            {
                "category": "RM",
                "createDT": "2021-10-24 19:49:39.970",
                "itemNo": 1,
                "memo": "test",
                "trainId": 10017,
                "trainText": "6.575 6.421 7.185 6.998 7.147 6.43 6.012 6.172 5.631 6.004 6.377 6.009 5.889 5.949 6.096 5.834 5.935 5.99 5.456 5.727 ...... 6.12 6.976 6.794 6.03",
                "updateDT": "2021-10-24 19:49:39.970"
            },
            {
                "category": "MEDV",
                "createDT": "2021-10-24 19:49:39.971",
                "itemNo": 2,
                "memo": "test",
                "trainId": 10017,
                "trainText": "24 21.6 34.7 33.4 36.2 28.7 22.9 27.1 16.5 18.9 15 18.9 21.7 20.4 18.2 19.9 23.1 17.5 20.2 18.2 ...... 13.6 19.6 15.2 14.5",
                "updateDT": "2021-10-24 19:49:39.971"
            }
        ],
        "language": 0,
        "memo": null,
        "noSymbol": 0,
        "partOfSpeech": null,
        "predictWeight": null,
        "resultKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx",
        "searchMode": 0,
        "statusId": 1,
        "subject": "Linear Single Regression Test",
        "trainId": 10017,
        "trainKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "trainType": 1,
        "updateDT": "2021-10-24 19:49:39.950"
    },
    "errors": null,
    "memo": "Congratulations on your success!",
    "result": true
}

“trainType”: 1:NaivebayesTextClassification, 2:LinearRegression, 3:LogisticRegression, 4:TimeSeriesAR, 5:TimeSeriesMA, 6:TimeSeriesARMA, 7:TimeSeriesARIMA
"language": 0:English, 1:Japanese, 2:Other; only for Natural Language Process
"noSymbol",“partOfSpeech”,“searchMode”: only for Natural Language Process Classification
"statusId": the status of Learning Theme.(0:new; 1:validate; 2:logical deletion)
Important please set [StatusId] to [1] in advance before calling the following Learning/Analyse/Prediction API.
“items”: items of Machine Learning Theme

##0103. Update Learning Theme
https://acrolearner.p.rapidapi.com/v0_1/CltService/ml/trains
http method: put

Request Header parameters:

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

Request Query parameters:

nullable=false
nullable: true: even null item will be updated, false(default): null item will be not update.

Request JSON Example:

Logistic Regression Classification case

{
    "trainKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "subject": "iris Test1",
    "trainType": 3,
    "items": [
            {
                "category": "sepal length",
                "trainText": "5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 5.4 4.8 4.8 4.3 5.8 5.7 5.4 5.1 5.7 5.1 5.4 5.1 4.6 5.1 4.8 5 5 5.2 5.2 4.7 4.8 5.4 5.2 5.5 4.9 5 5.5 4.9 4.4 5.1 5 4.5 4.4 5 5.1 4.8 5.1 4.6 5.3 5 7 6.4 6.9 5.5 6.5 5.7 6.3 4.9 6.6 5.2 5 5.9 6 6.1 5.6 6.7 5.6 5.8 6.2 5.6 5.9 6.1 6.3 6.1 6.4",
                "memo": "Test"
            },
            {
                "category": "sepal width",
                "trainText": "3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 3.7 3.4 3 3 4 4.4 3.9 3.5 3.8 3.8 3.4 3.7 3.6 3.3 3.4 3 3.4 3.5 3.4 3.2 3.1 3.4 4.1 4.2 3.1 3.2 3.5 3.1 3 3.4 3.5 2.3 3.2 3.5 3.8 3 3.8 3.2 3.7 3.3 3.2 3.2 3.1 2.3 2.8 2.8 3.3 2.4 2.9 2.7 2 3 2.2 2.9 2.9 3.1 3 2.7 2.2 2.5 3.2 2.8 2.5 2.8 2.9",
                "memo": "Test"
            },
            {
                "category": "petal length",
                "trainText": "1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 1.5 1.6 1.4 1.1 1.2 1.5 1.3 1.4 1.7 1.5 1.7 1.5 1 1.7 1.9 1.6 1.6 1.5 1.4 1.6 1.6 1.5 1.5 1.4 1.5 1.2 1.3 1.5 1.3 1.5 1.3 1.3 1.3 1.6 1.9 1.4 1.6 1.4 1.5 1.4 4.7 4.5 4.9 4 4.6 4.5 4.7 3.3 4.6 3.9 3.5 4.2 4 4.7 3.6 4.4 4.5 4.1 4.5 3.9 4.8 4 4.9 4.7 4.3",
                "memo": "Test"
            },
            {
                "category": "petal width",
                "trainText": "0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 0.2 0.2 0.1 0.1 0.2 0.4 0.4 0.3 0.3 0.3 0.2 0.4 0.2 0.5 0.2 0.2 0.4 0.2 0.2 0.2 0.2 0.4 0.1 0.2 0.1 0.2 0.2 0.1 0.2 0.2 0.3 0.3 0.2 0.6 0.4 0.3 0.2 0.2 0.2 0.2 1.4 1.5 1.5 1.3 1.5 1.3 1.6 1 1.3 1.4 1 1.5 1 1.4 1.3 1.4 1.5 1 1.5 1.1 1.8 1.3 1.5 1.2 1.3",
                "memo": "Test"
            },
            {
                "category": "class",
                "trainText": "Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-setosa Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor Iris-versicolor",
                "memo": "Test"
            }
     ]
}

Response JSON Example:

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

“result”: true: successful, false: failed

##0104. Delete Learning Theme
delete a Learning Theme.
https://acrolearner.p.rapidapi.com/v0_1/CltService/ml/trains/{trainKey}
http method: delete

Request Header parameters:

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

Request Path parameters:

{trainKey}: XXXXXXXXXX

Response JSON Example:

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

##0105. Set Learning Theme Status
Set the status of a or multiple Learning Themes.
https://acrolearner.p.rapidapi.com/AcroLearner/v0_1/CltService/ml/trains/{trainKeys}/status/{statusId}
http method: put

Request Header parameters:

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

Request Path parameters:

{trainKeys}: XXXXXXXXXX
{statusId}: 1

{trainKeys}: [trainKey],[trainKey]…
{statusId}: 0:new; 1:validate; 2:logical deletion

Response JSON Example:

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