Question

I have implemented a model that maps the incoming data into one of 1000 categories (label) available. For each entry, the Google Prediction returns all categories in 1000. Is there any way to make the Google Prediction return, for example, only the 10 most important outcomes?

Thanks

Was it helpful?

Solution

You simply can't get the top 10 on 1000.

If you really need to limited the number of result on the server side you can have your own server in the middle who "cleanup" the result for you. Depending the size of your project, I recommend you Google App Engine. It will use Google Network who is very quick and have low latency.

From Google Prediction API webservice you can only limited to the most relevant category. Using Google API explorer generate this kind of POST request:

POST https://www.googleapis.com/prediction/v1.6/projects/{YOUR_PROJECT_NUMBER}/hostedmodels/job_training/predict?fields=id%2Ckind%2CoutputLabel%2CoutputValue%2CselfLink&key={YOUR_API_KEY}

Content-Type: application/json Authorization: Bearer ya29.AHES6ZQykLLg0ctjS1YYnxMEUn2kCi7OL4UZj4_-e92cuPfywxJatw X-JavaScript-User-Agent: Google APIs Explorer

{"input":
{"csvInstance": [ "YOUR PREDICTION" ]}
}

The URL request parameter "field" don't include "outputMulti" (all the other result)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top