詳細検索

Mayuko Mashin Learning ♡ #05

Avatar
by まゆこ
3 min read
Tags

Mayuko Mashin Learning ♡ #05
Translated from 日本語 • View original

Hello! It's Mayuko! It's suddenly cold lately ( ́・・') I'm sad that summer is over... ( ́・・')

IMG_4652

The other day, I received a T-shirt from Google! ! Thank you! ! Personally, I like (^^)/ this gray color

Now, let's get to the main topic. Do you want to enter the prediction data side by side with a comma separation in the previous "prediction.trainedmodels.predict"? Do you want to enter vertically side by side? I have a question, so I will verify it.

Input (side-by-side)
{
"input":
{
"csvInstance":
[
"M,175,165,france"
]
}
}

Results
"outputValue": "73.833076"
Input (vertical)
{
"input":
{
"csvInstance":
[
"M"
"175"
"165"
"france"
]
}
}

Results
"outputValue": "175.622411"

If you look at the prediction results, it is correct to line them vertically, but if you look at Google Docs, they are lined up horizontally with commas separated... How do you verify it??? ('_')

IMG_4651⑵

GO☆ "I think you can understand it by looking at the description when you find a sample program and call the Prediction API." Mayuko "What is a program? That."

GO☆ "Until now, we used to send data from a console called APIs Explorer, but we can also call the Prediction API directly from the program and send the data."

Mayuko "What's the difference?" GO☆ "What I'm doing is the same, but when I program it, I can do more complex things and understand the API specifications." Mayuko "Hmm..."

GO☆ found a sample program like this. (I did not transcribe it as it is, but the content has been slightly changed.)

    public String predict_cat (String arbitrary ID, List<Object> analysis data)
            throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException,
            CertificateException, IOException {

Prediction prediction = createPredictionService();

InputInput inputInput = new InputInput();
            inputInput.setCsvInstance(analytics data);
            Input input = new Input();
            input.setInput(inputInput);

Output out = prediction.trainedmodels().predict(project, arbitrary ID, input).execute();

return out.getOutputLabel();
    }

Where it is written in Japanese, the value needs to be changed. "Project" and "Any ID" were also included in APIs Explorer. This is the data input by "Analysis Data". This "analysis data" is an array variable (List), and it seems that multiple data can be stored here. According to the height prediction I tried last time, it seems that M, 175, 165, and france are put into this array variable.

I tried to do it. The result was 175.622411. After all, it is more correct to put it vertically.

Come to think of it, the Google document I was looking at was Ver. 1.4. If you look at the latest Ver 1.6, the description has changed a little. Has the specification changed?

Ver1.4
{
  "input":{
    "csvInstance":[ col1_value, col2_value, ... ]
  }
}

Ver1.6
{
  "input": {
    "csvInstance": [
      (value)
    ]
  }
}

But...... If you want to put data vertically one by one, APIs Explorer is quite a task.

When I said that, GO☆ made me an original tool.

With this, you can enter data all at once.

screen_tool001

If you press the [predict] button, it will predict it, and if you press the [input] button, it will input data.

IMG_4653

Oh~!! This is convenient! ! GO☆ (^^)/ wears sunglasses and is cool

Related Articles