アットウィキロゴ

250mann

function queryHostedModel() {
 
  var projectNumber = '414649711441';
  var hostedModelName = 'sample.sentiment';
 
  var predictionString = 'Want to go to the park this weekend?';
  var prediction = Prediction.Hostedmodels.predict(
      {
        input: {
          csvInstance: [predictionString]
        }
      },
      projectNumber,
      hostedModelName);
  // Logs Sentiment: positive.
  Logger.log('Sentiment: ' + prediction.outputLabel);
 
  predictionString = 'You are not very nice!';
  prediction = Prediction.Hostedmodels.predict(
      {
        input: {
          csvInstance: [predictionString]
        }
      },
      projectNumber,
      hostedModelName);
  // Logs Sentiment: negative.
  Logger.log('Sentiment: ' + prediction.outputLabel);
}
最終更新:2017年04月14日 01:32