Skip to content

Prediction API => "Model name is empty." #333

Closed

Description

@davidemiceli

Sorry a question, I have:

var google = require('googleapis');
var prediction = google.prediction('v1.6');

var train =
'...';

var authClient = new google.auth.JWT(
    '5578575756-balblabla@developer.gserviceaccount.com',
  // use the PEM file we generated from the downloaded key
    "g_privatekey.pem",
    // Contents of private_key.pem if you want to load the pem file yourself
    // (do not use the path parameter above if using this param)
    // Scopes can be specified either as an array or as a single, space-delimited string
    null,
    ['https://www.googleapis.com/auth/prediction']
    // User to impersonate (leave empty if no impersonation needed)
    );

authClient.authorize(function(err, tokens) {
  if (err) {
    console.log(err);
    return;
  } else {
    console.log(tokens);
    prediction.trainedmodels.insert({
        auth: authClient,
        project: 'projectAppTest',
        id: '152fdh621r2ref1262',
        resource: train}, function(err, result) {
      console.log('Result: ' + (err ? err.message : result));
    });
  }
});

But I have as result log message: "Model name is empty", why? It's missing some parameters?

Thanks for a response...

Activity

  1. davidemiceli commented on Dec 9, 2014

    @davidemiceli
    Author

    I have as result for training "insert": {"kind":"prediction#training","id":"tuytyfdt6758","selfLink":"https://www.googleapis.com/prediction/v1.6/projects/predictapptest-876/trainedmodels/tuytyfdt6758"}

    Result analyze:
    {"kind":"prediction#analyze","id":"tuytyfdt6758","selfLink":"https://www.googleapis.com/prediction/v1.6/projects/predictapptest-876/trainedmodels/tuytyfdt6758/analyze"}
    Result predict: Model is empty. Please update it first.

    My predict Model is:

    // Predict
    prediction.trainedmodels.predict({
        auth: authClient,
        project: 'predictapptest-876',
        id: 'tuytyfdt6758',
        resource: {
            input: {
                csvInstance: ["japanese ceramic sharpening guide holder for whetstone waterstone made in japan"]
                }
            }
        }, function(err, result) {
      console.log('Result predict: ' + (err ? err.message : JSON.stringify(result)));
    });
    

    Why "Model is empty. Please update it first." if insert goes ok?

  2. JustinBeckwith commented on Mar 4, 2016

    @JustinBeckwith
    Contributor

    Greetings! Apologies for taking so long to get back to you. Since this was filed, we released a proper API for using the prediction API:

    https://github.com/GoogleCloudPlatform/gcloud-node#google-prediction-api

    Could you give that a try instead? If this is still an issue, please feel free to re-open.

    Thanks!

  3. jmdobry commented on Mar 4, 2016

    @jmdobry
    Contributor

    It may have been that your model hadn't finished training yet. If the model is done training, then analyze should return more information about the model, like its confusion matrix. Instead of analyze you could simply call get with the model id to get its status. When it's done, the response to a get call would look something like this:

    {
     "kind": "prediction#training",
     "id": "118asd2e24-1299-4440-a335-0asdf4d1asdf54",
     "selfLink": "https://www.googleapis.com/prediction/v1.6/projects/label-cat/trainedmodels/118asd2e24-1299-4440-a335-0asdf4d1asdf54",
     "created": "2015-11-12T19:53:30.253Z",
     "trainingComplete": "2015-11-12T19:56:41.297Z",
     "modelInfo": {
      "numberInstances": "2359",
      "modelType": "classification",
      "numberLabels": "2",
      "classificationAccuracy": "0.91"
     },
     "trainingStatus": "DONE"
    }

    At which point you should be able to use predict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

🚨This issue needs some love.triage meI really want to be triaged.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions