• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5  margin: 0;
6  padding: 0;
7  border: 0;
8  font-weight: inherit;
9  font-style: inherit;
10  font-size: 100%;
11  font-family: inherit;
12  vertical-align: baseline;
13}
14
15body {
16  font-size: 13px;
17  padding: 1em;
18}
19
20h1 {
21  font-size: 26px;
22  margin-bottom: 1em;
23}
24
25h2 {
26  font-size: 24px;
27  margin-bottom: 1em;
28}
29
30h3 {
31  font-size: 20px;
32  margin-bottom: 1em;
33  margin-top: 1em;
34}
35
36pre, code {
37  line-height: 1.5;
38  font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42  margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46  font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50  border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54  margin-top: 0.5em;
55}
56
57.firstline {
58  margin-left: 2 em;
59}
60
61.method  {
62  margin-top: 1em;
63  border: solid 1px #CCC;
64  padding: 1em;
65  background: #EEE;
66}
67
68.details {
69  font-weight: bold;
70  font-size: 14px;
71}
72
73</style>
74
75<h1><a href="prediction_v1_5.html">Prediction API</a> . <a href="prediction_v1_5.trainedmodels.html">trainedmodels</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78  <code><a href="#analyze">analyze(id)</a></code></p>
79<p class="firstline">Get analysis of the model and the data the model was trained on.</p>
80<p class="toc_element">
81  <code><a href="#delete">delete(id)</a></code></p>
82<p class="firstline">Delete a trained model.</p>
83<p class="toc_element">
84  <code><a href="#get">get(id)</a></code></p>
85<p class="firstline">Check training status of your model.</p>
86<p class="toc_element">
87  <code><a href="#insert">insert(body)</a></code></p>
88<p class="firstline">Begin training your model.</p>
89<p class="toc_element">
90  <code><a href="#list">list(pageToken=None, maxResults=None)</a></code></p>
91<p class="firstline">List available models.</p>
92<p class="toc_element">
93  <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
94<p class="firstline">Retrieves the next page of results.</p>
95<p class="toc_element">
96  <code><a href="#predict">predict(id, body)</a></code></p>
97<p class="firstline">Submit model id and request a prediction.</p>
98<p class="toc_element">
99  <code><a href="#update">update(id, body)</a></code></p>
100<p class="firstline">Add new data to a trained model.</p>
101<h3>Method Details</h3>
102<div class="method">
103    <code class="details" id="analyze">analyze(id)</code>
104  <pre>Get analysis of the model and the data the model was trained on.
105
106Args:
107  id: string, The unique name for the predictive model. (required)
108
109Returns:
110  An object of the form:
111
112    {
113    "kind": "prediction#analyze", # What kind of resource this is.
114    "errors": [ # List of errors with the data.
115      {
116        "a_key": "A String", # Error level followed by a detailed error message.
117      },
118    ],
119    "dataDescription": { # Description of the data the model was trained on.
120      "outputFeature": { # Description of the output value or label.
121        "text": [ # Description of the output labels in the data set.
122          {
123            "count": "A String", # Number of times the output label occurred in the data set.
124            "value": "A String", # The output label.
125          },
126        ],
127        "numeric": { # Description of the output values in the data set.
128          "count": "A String", # Number of numeric output values in the data set.
129          "variance": 3.14, # Variance of the output values in the data set.
130          "mean": 3.14, # Mean of the output values in the data set.
131        },
132      },
133      "features": [ # Description of the input features in the data set.
134        {
135          "index": "A String", # The feature index.
136          "text": { # Description of multiple-word text values of this feature.
137            "count": "A String", # Number of multiple-word text values for this feature.
138          },
139          "numeric": { # Description of the numeric values of this feature.
140            "count": "A String", # Number of numeric values for this feature in the data set.
141            "variance": 3.14, # Variance of the numeric values of this feature in the data set.
142            "mean": 3.14, # Mean of the numeric values of this feature in the data set.
143          },
144          "categorical": { # Description of the categorical values of this feature.
145            "count": "A String", # Number of categorical values for this feature in the data.
146            "values": [ # List of all the categories for this feature in the data set.
147              {
148                "count": "A String", # Number of times this feature had this value.
149                "value": "A String", # The category name.
150              },
151            ],
152          },
153        },
154      ],
155    },
156    "modelDescription": { # Description of the model.
157      "confusionMatrixRowTotals": { # A list of the confusion matrix row totals
158        "a_key": 3.14,
159      },
160      "confusionMatrix": { # An output confusion matrix. This shows an estimate for how this model will do in predictions. This is first indexed by the true class label. For each true class label, this provides a pair {predicted_label, count}, where count is the estimated number of times the model will predict the predicted label given the true label. Will not output if more then 100 classes [Categorical models only].
161        "a_key": {
162          "a_key": 3.14,
163        },
164      },
165      "modelinfo": { # Basic information about the model.
166          "kind": "prediction#training", # What kind of resource this is.
167          "created": "A String", # Insert time of the model (as a RFC 3339 timestamp).
168          "trainingComplete": "A String", # Training completion time (as a RFC 3339 timestamp).
169          "storageDataLocation": "A String", # Google storage location of the training data file.
170          "modelType": "A String", # Type of predictive model (classification or regression)
171          "storagePMMLModelLocation": "A String", # Google storage location of the pmml model file.
172          "trainingStatus": "A String", # The current status of the training job. This can be one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
173          "modelInfo": { # Model metadata.
174            "numberLabels": "A String", # Number of class labels in the trained model [Categorical models only].
175            "meanSquaredError": 3.14, # An estimated mean squared error. The can be used to measure the quality of the predicted model [Regression models only].
176            "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION)
177            "numberInstances": "A String", # Number of valid data instances used in the trained model.
178            "classWeightedAccuracy": 3.14, # Estimated accuracy of model taking utility weights into account [Categorical models only].
179            "classificationAccuracy": 3.14, # A number between 0.0 and 1.0, where 1.0 is 100% accurate. This is an estimate, based on the amount and quality of the training data, of the estimated prediction accuracy. You can use this is a guide to decide whether the results are accurate enough for your needs. This estimate will be more reliable if your real input data is similar to your training data [Categorical models only].
180          },
181          "storagePMMLLocation": "A String", # Google storage location of the preprocessing pmml file.
182          "trainingInstances": [ # Instances to train model on.
183            {
184              "output": "A String", # The generic output value - could be regression or class label
185              "csvInstance": [ # The input features for this instance
186                "",
187              ],
188            },
189          ],
190          "id": "A String", # The unique name for the predictive model.
191          "selfLink": "A String", # A URL to re-request this resource.
192          "utility": [ # A class weighting function, which allows the importance weights for class labels to be specified [Categorical models only].
193            { # Class label (string).
194              "a_key": 3.14,
195            },
196          ],
197        },
198    },
199    "id": "A String", # The unique name for the predictive model.
200    "selfLink": "A String", # A URL to re-request this resource.
201  }</pre>
202</div>
203
204<div class="method">
205    <code class="details" id="delete">delete(id)</code>
206  <pre>Delete a trained model.
207
208Args:
209  id: string, The unique name for the predictive model. (required)
210</pre>
211</div>
212
213<div class="method">
214    <code class="details" id="get">get(id)</code>
215  <pre>Check training status of your model.
216
217Args:
218  id: string, The unique name for the predictive model. (required)
219
220Returns:
221  An object of the form:
222
223    {
224      "kind": "prediction#training", # What kind of resource this is.
225      "created": "A String", # Insert time of the model (as a RFC 3339 timestamp).
226      "trainingComplete": "A String", # Training completion time (as a RFC 3339 timestamp).
227      "storageDataLocation": "A String", # Google storage location of the training data file.
228      "modelType": "A String", # Type of predictive model (classification or regression)
229      "storagePMMLModelLocation": "A String", # Google storage location of the pmml model file.
230      "trainingStatus": "A String", # The current status of the training job. This can be one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
231      "modelInfo": { # Model metadata.
232        "numberLabels": "A String", # Number of class labels in the trained model [Categorical models only].
233        "meanSquaredError": 3.14, # An estimated mean squared error. The can be used to measure the quality of the predicted model [Regression models only].
234        "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION)
235        "numberInstances": "A String", # Number of valid data instances used in the trained model.
236        "classWeightedAccuracy": 3.14, # Estimated accuracy of model taking utility weights into account [Categorical models only].
237        "classificationAccuracy": 3.14, # A number between 0.0 and 1.0, where 1.0 is 100% accurate. This is an estimate, based on the amount and quality of the training data, of the estimated prediction accuracy. You can use this is a guide to decide whether the results are accurate enough for your needs. This estimate will be more reliable if your real input data is similar to your training data [Categorical models only].
238      },
239      "storagePMMLLocation": "A String", # Google storage location of the preprocessing pmml file.
240      "trainingInstances": [ # Instances to train model on.
241        {
242          "output": "A String", # The generic output value - could be regression or class label
243          "csvInstance": [ # The input features for this instance
244            "",
245          ],
246        },
247      ],
248      "id": "A String", # The unique name for the predictive model.
249      "selfLink": "A String", # A URL to re-request this resource.
250      "utility": [ # A class weighting function, which allows the importance weights for class labels to be specified [Categorical models only].
251        { # Class label (string).
252          "a_key": 3.14,
253        },
254      ],
255    }</pre>
256</div>
257
258<div class="method">
259    <code class="details" id="insert">insert(body)</code>
260  <pre>Begin training your model.
261
262Args:
263  body: object, The request body. (required)
264    The object takes the form of:
265
266{
267    "kind": "prediction#training", # What kind of resource this is.
268    "created": "A String", # Insert time of the model (as a RFC 3339 timestamp).
269    "trainingComplete": "A String", # Training completion time (as a RFC 3339 timestamp).
270    "storageDataLocation": "A String", # Google storage location of the training data file.
271    "modelType": "A String", # Type of predictive model (classification or regression)
272    "storagePMMLModelLocation": "A String", # Google storage location of the pmml model file.
273    "trainingStatus": "A String", # The current status of the training job. This can be one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
274    "modelInfo": { # Model metadata.
275      "numberLabels": "A String", # Number of class labels in the trained model [Categorical models only].
276      "meanSquaredError": 3.14, # An estimated mean squared error. The can be used to measure the quality of the predicted model [Regression models only].
277      "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION)
278      "numberInstances": "A String", # Number of valid data instances used in the trained model.
279      "classWeightedAccuracy": 3.14, # Estimated accuracy of model taking utility weights into account [Categorical models only].
280      "classificationAccuracy": 3.14, # A number between 0.0 and 1.0, where 1.0 is 100% accurate. This is an estimate, based on the amount and quality of the training data, of the estimated prediction accuracy. You can use this is a guide to decide whether the results are accurate enough for your needs. This estimate will be more reliable if your real input data is similar to your training data [Categorical models only].
281    },
282    "storagePMMLLocation": "A String", # Google storage location of the preprocessing pmml file.
283    "trainingInstances": [ # Instances to train model on.
284      {
285        "output": "A String", # The generic output value - could be regression or class label
286        "csvInstance": [ # The input features for this instance
287          "",
288        ],
289      },
290    ],
291    "id": "A String", # The unique name for the predictive model.
292    "selfLink": "A String", # A URL to re-request this resource.
293    "utility": [ # A class weighting function, which allows the importance weights for class labels to be specified [Categorical models only].
294      { # Class label (string).
295        "a_key": 3.14,
296      },
297    ],
298  }
299
300
301Returns:
302  An object of the form:
303
304    {
305      "kind": "prediction#training", # What kind of resource this is.
306      "created": "A String", # Insert time of the model (as a RFC 3339 timestamp).
307      "trainingComplete": "A String", # Training completion time (as a RFC 3339 timestamp).
308      "storageDataLocation": "A String", # Google storage location of the training data file.
309      "modelType": "A String", # Type of predictive model (classification or regression)
310      "storagePMMLModelLocation": "A String", # Google storage location of the pmml model file.
311      "trainingStatus": "A String", # The current status of the training job. This can be one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
312      "modelInfo": { # Model metadata.
313        "numberLabels": "A String", # Number of class labels in the trained model [Categorical models only].
314        "meanSquaredError": 3.14, # An estimated mean squared error. The can be used to measure the quality of the predicted model [Regression models only].
315        "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION)
316        "numberInstances": "A String", # Number of valid data instances used in the trained model.
317        "classWeightedAccuracy": 3.14, # Estimated accuracy of model taking utility weights into account [Categorical models only].
318        "classificationAccuracy": 3.14, # A number between 0.0 and 1.0, where 1.0 is 100% accurate. This is an estimate, based on the amount and quality of the training data, of the estimated prediction accuracy. You can use this is a guide to decide whether the results are accurate enough for your needs. This estimate will be more reliable if your real input data is similar to your training data [Categorical models only].
319      },
320      "storagePMMLLocation": "A String", # Google storage location of the preprocessing pmml file.
321      "trainingInstances": [ # Instances to train model on.
322        {
323          "output": "A String", # The generic output value - could be regression or class label
324          "csvInstance": [ # The input features for this instance
325            "",
326          ],
327        },
328      ],
329      "id": "A String", # The unique name for the predictive model.
330      "selfLink": "A String", # A URL to re-request this resource.
331      "utility": [ # A class weighting function, which allows the importance weights for class labels to be specified [Categorical models only].
332        { # Class label (string).
333          "a_key": 3.14,
334        },
335      ],
336    }</pre>
337</div>
338
339<div class="method">
340    <code class="details" id="list">list(pageToken=None, maxResults=None)</code>
341  <pre>List available models.
342
343Args:
344  pageToken: string, Pagination token
345  maxResults: integer, Maximum number of results to return
346
347Returns:
348  An object of the form:
349
350    {
351    "nextPageToken": "A String", # Pagination token to fetch the next page, if one exists.
352    "items": [ # List of models.
353      {
354          "kind": "prediction#training", # What kind of resource this is.
355          "created": "A String", # Insert time of the model (as a RFC 3339 timestamp).
356          "trainingComplete": "A String", # Training completion time (as a RFC 3339 timestamp).
357          "storageDataLocation": "A String", # Google storage location of the training data file.
358          "modelType": "A String", # Type of predictive model (classification or regression)
359          "storagePMMLModelLocation": "A String", # Google storage location of the pmml model file.
360          "trainingStatus": "A String", # The current status of the training job. This can be one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
361          "modelInfo": { # Model metadata.
362            "numberLabels": "A String", # Number of class labels in the trained model [Categorical models only].
363            "meanSquaredError": 3.14, # An estimated mean squared error. The can be used to measure the quality of the predicted model [Regression models only].
364            "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION)
365            "numberInstances": "A String", # Number of valid data instances used in the trained model.
366            "classWeightedAccuracy": 3.14, # Estimated accuracy of model taking utility weights into account [Categorical models only].
367            "classificationAccuracy": 3.14, # A number between 0.0 and 1.0, where 1.0 is 100% accurate. This is an estimate, based on the amount and quality of the training data, of the estimated prediction accuracy. You can use this is a guide to decide whether the results are accurate enough for your needs. This estimate will be more reliable if your real input data is similar to your training data [Categorical models only].
368          },
369          "storagePMMLLocation": "A String", # Google storage location of the preprocessing pmml file.
370          "trainingInstances": [ # Instances to train model on.
371            {
372              "output": "A String", # The generic output value - could be regression or class label
373              "csvInstance": [ # The input features for this instance
374                "",
375              ],
376            },
377          ],
378          "id": "A String", # The unique name for the predictive model.
379          "selfLink": "A String", # A URL to re-request this resource.
380          "utility": [ # A class weighting function, which allows the importance weights for class labels to be specified [Categorical models only].
381            { # Class label (string).
382              "a_key": 3.14,
383            },
384          ],
385        },
386    ],
387    "kind": "prediction#list", # What kind of resource this is.
388    "selfLink": "A String", # A URL to re-request this resource.
389  }</pre>
390</div>
391
392<div class="method">
393    <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
394  <pre>Retrieves the next page of results.
395
396Args:
397  previous_request: The request for the previous page. (required)
398  previous_response: The response from the request for the previous page. (required)
399
400Returns:
401  A request object that you can call 'execute()' on to request the next
402  page. Returns None if there are no more items in the collection.
403    </pre>
404</div>
405
406<div class="method">
407    <code class="details" id="predict">predict(id, body)</code>
408  <pre>Submit model id and request a prediction.
409
410Args:
411  id: string, The unique name for the predictive model. (required)
412  body: object, The request body. (required)
413    The object takes the form of:
414
415{
416    "input": { # Input to the model for a prediction
417      "csvInstance": [ # A list of input features, these can be strings or doubles.
418        "",
419      ],
420    },
421  }
422
423
424Returns:
425  An object of the form:
426
427    {
428    "kind": "prediction#output", # What kind of resource this is.
429    "outputLabel": "A String", # The most likely class label [Categorical models only].
430    "id": "A String", # The unique name for the predictive model.
431    "outputMulti": [ # A list of class labels with their estimated probabilities [Categorical models only].
432      {
433        "score": 3.14, # The probability of the class label.
434        "label": "A String", # The class label.
435      },
436    ],
437    "outputValue": 3.14, # The estimated regression value [Regression models only].
438    "selfLink": "A String", # A URL to re-request this resource.
439  }</pre>
440</div>
441
442<div class="method">
443    <code class="details" id="update">update(id, body)</code>
444  <pre>Add new data to a trained model.
445
446Args:
447  id: string, The unique name for the predictive model. (required)
448  body: object, The request body. (required)
449    The object takes the form of:
450
451{
452    "output": "A String", # The generic output value - could be regression value or class label
453    "csvInstance": [ # The input features for this instance
454      "",
455    ],
456    "label": "A String", # The class label of this instance
457  }
458
459
460Returns:
461  An object of the form:
462
463    {
464      "kind": "prediction#training", # What kind of resource this is.
465      "created": "A String", # Insert time of the model (as a RFC 3339 timestamp).
466      "trainingComplete": "A String", # Training completion time (as a RFC 3339 timestamp).
467      "storageDataLocation": "A String", # Google storage location of the training data file.
468      "modelType": "A String", # Type of predictive model (classification or regression)
469      "storagePMMLModelLocation": "A String", # Google storage location of the pmml model file.
470      "trainingStatus": "A String", # The current status of the training job. This can be one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
471      "modelInfo": { # Model metadata.
472        "numberLabels": "A String", # Number of class labels in the trained model [Categorical models only].
473        "meanSquaredError": 3.14, # An estimated mean squared error. The can be used to measure the quality of the predicted model [Regression models only].
474        "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION)
475        "numberInstances": "A String", # Number of valid data instances used in the trained model.
476        "classWeightedAccuracy": 3.14, # Estimated accuracy of model taking utility weights into account [Categorical models only].
477        "classificationAccuracy": 3.14, # A number between 0.0 and 1.0, where 1.0 is 100% accurate. This is an estimate, based on the amount and quality of the training data, of the estimated prediction accuracy. You can use this is a guide to decide whether the results are accurate enough for your needs. This estimate will be more reliable if your real input data is similar to your training data [Categorical models only].
478      },
479      "storagePMMLLocation": "A String", # Google storage location of the preprocessing pmml file.
480      "trainingInstances": [ # Instances to train model on.
481        {
482          "output": "A String", # The generic output value - could be regression or class label
483          "csvInstance": [ # The input features for this instance
484            "",
485          ],
486        },
487      ],
488      "id": "A String", # The unique name for the predictive model.
489      "selfLink": "A String", # A URL to re-request this resource.
490      "utility": [ # A class weighting function, which allows the importance weights for class labels to be specified [Categorical models only].
491        { # Class label (string).
492          "a_key": 3.14,
493        },
494      ],
495    }</pre>
496</div>
497
498</body></html>