Home | History | Annotate | Download | only in dyn
      1 <html><body>
      2 <style>
      3 
      4 body, 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 
     15 body {
     16   font-size: 13px;
     17   padding: 1em;
     18 }
     19 
     20 h1 {
     21   font-size: 26px;
     22   margin-bottom: 1em;
     23 }
     24 
     25 h2 {
     26   font-size: 24px;
     27   margin-bottom: 1em;
     28 }
     29 
     30 h3 {
     31   font-size: 20px;
     32   margin-bottom: 1em;
     33   margin-top: 1em;
     34 }
     35 
     36 pre, code {
     37   line-height: 1.5;
     38   font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
     39 }
     40 
     41 pre {
     42   margin-top: 0.5em;
     43 }
     44 
     45 h1, h2, h3, p {
     46   font-family: Arial, sans serif;
     47 }
     48 
     49 h1, 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_6.html">Prediction API</a> . <a href="prediction_v1_6.trainedmodels.html">trainedmodels</a></h1>
     76 <h2>Instance Methods</h2>
     77 <p class="toc_element">
     78   <code><a href="#analyze">analyze(project, 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(project, id)</a></code></p>
     82 <p class="firstline">Delete a trained model.</p>
     83 <p class="toc_element">
     84   <code><a href="#get">get(project, 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(project, body)</a></code></p>
     88 <p class="firstline">Train a Prediction API model.</p>
     89 <p class="toc_element">
     90   <code><a href="#list">list(project, 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(project, 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(project, 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(project, id)</code>
    104   <pre>Get analysis of the model and the data the model was trained on.
    105 
    106 Args:
    107   project: string, The project associated with the model. (required)
    108   id: string, The unique name for the predictive model. (required)
    109 
    110 Returns:
    111   An object of the form:
    112 
    113     {
    114     "kind": "prediction#analyze", # What kind of resource this is.
    115     "errors": [ # List of errors with the data.
    116       {
    117         "a_key": "A String", # Error level followed by a detailed error message.
    118       },
    119     ],
    120     "dataDescription": { # Description of the data the model was trained on.
    121       "outputFeature": { # Description of the output value or label.
    122         "text": [ # Description of the output labels in the data set.
    123           {
    124             "count": "A String", # Number of times the output label occurred in the data set.
    125             "value": "A String", # The output label.
    126           },
    127         ],
    128         "numeric": { # Description of the output values in the data set.
    129           "count": "A String", # Number of numeric output values in the data set.
    130           "variance": "A String", # Variance of the output values in the data set.
    131           "mean": "A String", # Mean of the output values in the data set.
    132         },
    133       },
    134       "features": [ # Description of the input features in the data set.
    135         {
    136           "index": "A String", # The feature index.
    137           "text": { # Description of multiple-word text values of this feature.
    138             "count": "A String", # Number of multiple-word text values for this feature.
    139           },
    140           "numeric": { # Description of the numeric values of this feature.
    141             "count": "A String", # Number of numeric values for this feature in the data set.
    142             "variance": "A String", # Variance of the numeric values of this feature in the data set.
    143             "mean": "A String", # Mean of the numeric values of this feature in the data set.
    144           },
    145           "categorical": { # Description of the categorical values of this feature.
    146             "count": "A String", # Number of categorical values for this feature in the data.
    147             "values": [ # List of all the categories for this feature in the data set.
    148               {
    149                 "count": "A String", # Number of times this feature had this value.
    150                 "value": "A String", # The category name.
    151               },
    152             ],
    153           },
    154         },
    155       ],
    156     },
    157     "modelDescription": { # Description of the model.
    158       "confusionMatrixRowTotals": { # A list of the confusion matrix row totals.
    159         "a_key": "A String",
    160       },
    161       "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).
    162         "a_key": { # Confusion matrix information for the true class label.
    163           "a_key": "A String", # Average number of times an instance with correct class label modelDescription.confusionMatrix.(key) was wrongfully classified as this label.
    164         },
    165       },
    166       "modelinfo": { # Basic information about the model.
    167         "kind": "prediction#training", # What kind of resource this is.
    168         "created": "A String", # Insert time of the model (as a RFC 3339 timestamp).
    169         "trainingComplete": "A String", # Training completion time (as a RFC 3339 timestamp).
    170         "storageDataLocation": "A String", # Google storage location of the training data file.
    171         "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION).
    172         "storagePMMLModelLocation": "A String", # Google storage location of the pmml model file.
    173         "trainingStatus": "A String", # The current status of the training job. This can be one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
    174         "modelInfo": { # Model metadata.
    175           "numberLabels": "A String", # Number of class labels in the trained model (Categorical models only).
    176           "meanSquaredError": "A String", # An estimated mean squared error. The can be used to measure the quality of the predicted model (Regression models only).
    177           "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION).
    178           "numberInstances": "A String", # Number of valid data instances used in the trained model.
    179           "classWeightedAccuracy": "A String", # Estimated accuracy of model taking utility weights into account (Categorical models only).
    180           "classificationAccuracy": "A String", # 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).
    181         },
    182         "storagePMMLLocation": "A String", # Google storage location of the preprocessing pmml file.
    183         "id": "A String", # The unique name for the predictive model.
    184         "selfLink": "A String", # A URL to re-request this resource.
    185       },
    186     },
    187     "id": "A String", # The unique name for the predictive model.
    188     "selfLink": "A String", # A URL to re-request this resource.
    189   }</pre>
    190 </div>
    191 
    192 <div class="method">
    193     <code class="details" id="delete">delete(project, id)</code>
    194   <pre>Delete a trained model.
    195 
    196 Args:
    197   project: string, The project associated with the model. (required)
    198   id: string, The unique name for the predictive model. (required)
    199 </pre>
    200 </div>
    201 
    202 <div class="method">
    203     <code class="details" id="get">get(project, id)</code>
    204   <pre>Check training status of your model.
    205 
    206 Args:
    207   project: string, The project associated with the model. (required)
    208   id: string, The unique name for the predictive model. (required)
    209 
    210 Returns:
    211   An object of the form:
    212 
    213     {
    214     "kind": "prediction#training", # What kind of resource this is.
    215     "created": "A String", # Insert time of the model (as a RFC 3339 timestamp).
    216     "trainingComplete": "A String", # Training completion time (as a RFC 3339 timestamp).
    217     "storageDataLocation": "A String", # Google storage location of the training data file.
    218     "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION).
    219     "storagePMMLModelLocation": "A String", # Google storage location of the pmml model file.
    220     "trainingStatus": "A String", # The current status of the training job. This can be one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
    221     "modelInfo": { # Model metadata.
    222       "numberLabels": "A String", # Number of class labels in the trained model (Categorical models only).
    223       "meanSquaredError": "A String", # An estimated mean squared error. The can be used to measure the quality of the predicted model (Regression models only).
    224       "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION).
    225       "numberInstances": "A String", # Number of valid data instances used in the trained model.
    226       "classWeightedAccuracy": "A String", # Estimated accuracy of model taking utility weights into account (Categorical models only).
    227       "classificationAccuracy": "A String", # 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).
    228     },
    229     "storagePMMLLocation": "A String", # Google storage location of the preprocessing pmml file.
    230     "id": "A String", # The unique name for the predictive model.
    231     "selfLink": "A String", # A URL to re-request this resource.
    232   }</pre>
    233 </div>
    234 
    235 <div class="method">
    236     <code class="details" id="insert">insert(project, body)</code>
    237   <pre>Train a Prediction API model.
    238 
    239 Args:
    240   project: string, The project associated with the model. (required)
    241   body: object, The request body. (required)
    242     The object takes the form of:
    243 
    244 {
    245     "storageDataLocation": "A String", # Google storage location of the training data file.
    246     "modelType": "A String", # Type of predictive model (classification or regression).
    247     "storagePMMLModelLocation": "A String", # Google storage location of the pmml model file.
    248     "sourceModel": "A String", # The Id of the model to be copied over.
    249     "storagePMMLLocation": "A String", # Google storage location of the preprocessing pmml file.
    250     "trainingInstances": [ # Instances to train model on.
    251       {
    252         "output": "A String", # The generic output value - could be regression or class label.
    253         "csvInstance": [ # The input features for this instance.
    254           "",
    255         ],
    256       },
    257     ],
    258     "id": "A String", # The unique name for the predictive model.
    259     "utility": [ # A class weighting function, which allows the importance weights for class labels to be specified (Categorical models only).
    260       { # Class label (string).
    261         "a_key": 3.14,
    262       },
    263     ],
    264   }
    265 
    266 
    267 Returns:
    268   An object of the form:
    269 
    270     {
    271     "kind": "prediction#training", # What kind of resource this is.
    272     "created": "A String", # Insert time of the model (as a RFC 3339 timestamp).
    273     "trainingComplete": "A String", # Training completion time (as a RFC 3339 timestamp).
    274     "storageDataLocation": "A String", # Google storage location of the training data file.
    275     "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION).
    276     "storagePMMLModelLocation": "A String", # Google storage location of the pmml model file.
    277     "trainingStatus": "A String", # The current status of the training job. This can be one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
    278     "modelInfo": { # Model metadata.
    279       "numberLabels": "A String", # Number of class labels in the trained model (Categorical models only).
    280       "meanSquaredError": "A String", # An estimated mean squared error. The can be used to measure the quality of the predicted model (Regression models only).
    281       "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION).
    282       "numberInstances": "A String", # Number of valid data instances used in the trained model.
    283       "classWeightedAccuracy": "A String", # Estimated accuracy of model taking utility weights into account (Categorical models only).
    284       "classificationAccuracy": "A String", # 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).
    285     },
    286     "storagePMMLLocation": "A String", # Google storage location of the preprocessing pmml file.
    287     "id": "A String", # The unique name for the predictive model.
    288     "selfLink": "A String", # A URL to re-request this resource.
    289   }</pre>
    290 </div>
    291 
    292 <div class="method">
    293     <code class="details" id="list">list(project, pageToken=None, maxResults=None)</code>
    294   <pre>List available models.
    295 
    296 Args:
    297   project: string, The project associated with the model. (required)
    298   pageToken: string, Pagination token.
    299   maxResults: integer, Maximum number of results to return.
    300 
    301 Returns:
    302   An object of the form:
    303 
    304     {
    305     "nextPageToken": "A String", # Pagination token to fetch the next page, if one exists.
    306     "items": [ # List of models.
    307       {
    308         "kind": "prediction#training", # What kind of resource this is.
    309         "created": "A String", # Insert time of the model (as a RFC 3339 timestamp).
    310         "trainingComplete": "A String", # Training completion time (as a RFC 3339 timestamp).
    311         "storageDataLocation": "A String", # Google storage location of the training data file.
    312         "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION).
    313         "storagePMMLModelLocation": "A String", # Google storage location of the pmml model file.
    314         "trainingStatus": "A String", # The current status of the training job. This can be one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
    315         "modelInfo": { # Model metadata.
    316           "numberLabels": "A String", # Number of class labels in the trained model (Categorical models only).
    317           "meanSquaredError": "A String", # An estimated mean squared error. The can be used to measure the quality of the predicted model (Regression models only).
    318           "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION).
    319           "numberInstances": "A String", # Number of valid data instances used in the trained model.
    320           "classWeightedAccuracy": "A String", # Estimated accuracy of model taking utility weights into account (Categorical models only).
    321           "classificationAccuracy": "A String", # 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).
    322         },
    323         "storagePMMLLocation": "A String", # Google storage location of the preprocessing pmml file.
    324         "id": "A String", # The unique name for the predictive model.
    325         "selfLink": "A String", # A URL to re-request this resource.
    326       },
    327     ],
    328     "kind": "prediction#list", # What kind of resource this is.
    329     "selfLink": "A String", # A URL to re-request this resource.
    330   }</pre>
    331 </div>
    332 
    333 <div class="method">
    334     <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
    335   <pre>Retrieves the next page of results.
    336 
    337 Args:
    338   previous_request: The request for the previous page. (required)
    339   previous_response: The response from the request for the previous page. (required)
    340 
    341 Returns:
    342   A request object that you can call 'execute()' on to request the next
    343   page. Returns None if there are no more items in the collection.
    344     </pre>
    345 </div>
    346 
    347 <div class="method">
    348     <code class="details" id="predict">predict(project, id, body)</code>
    349   <pre>Submit model id and request a prediction.
    350 
    351 Args:
    352   project: string, The project associated with the model. (required)
    353   id: string, The unique name for the predictive model. (required)
    354   body: object, The request body. (required)
    355     The object takes the form of:
    356 
    357 {
    358     "input": { # Input to the model for a prediction.
    359       "csvInstance": [ # A list of input features, these can be strings or doubles.
    360         "",
    361       ],
    362     },
    363   }
    364 
    365 
    366 Returns:
    367   An object of the form:
    368 
    369     {
    370     "kind": "prediction#output", # What kind of resource this is.
    371     "outputLabel": "A String", # The most likely class label (Categorical models only).
    372     "id": "A String", # The unique name for the predictive model.
    373     "outputMulti": [ # A list of class labels with their estimated probabilities (Categorical models only).
    374       {
    375         "score": "A String", # The probability of the class label.
    376         "label": "A String", # The class label.
    377       },
    378     ],
    379     "outputValue": "A String", # The estimated regression value (Regression models only).
    380     "selfLink": "A String", # A URL to re-request this resource.
    381   }</pre>
    382 </div>
    383 
    384 <div class="method">
    385     <code class="details" id="update">update(project, id, body)</code>
    386   <pre>Add new data to a trained model.
    387 
    388 Args:
    389   project: string, The project associated with the model. (required)
    390   id: string, The unique name for the predictive model. (required)
    391   body: object, The request body. (required)
    392     The object takes the form of:
    393 
    394 {
    395     "output": "A String", # The generic output value - could be regression or class label.
    396     "csvInstance": [ # The input features for this instance.
    397       "",
    398     ],
    399   }
    400 
    401 
    402 Returns:
    403   An object of the form:
    404 
    405     {
    406     "kind": "prediction#training", # What kind of resource this is.
    407     "created": "A String", # Insert time of the model (as a RFC 3339 timestamp).
    408     "trainingComplete": "A String", # Training completion time (as a RFC 3339 timestamp).
    409     "storageDataLocation": "A String", # Google storage location of the training data file.
    410     "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION).
    411     "storagePMMLModelLocation": "A String", # Google storage location of the pmml model file.
    412     "trainingStatus": "A String", # The current status of the training job. This can be one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND
    413     "modelInfo": { # Model metadata.
    414       "numberLabels": "A String", # Number of class labels in the trained model (Categorical models only).
    415       "meanSquaredError": "A String", # An estimated mean squared error. The can be used to measure the quality of the predicted model (Regression models only).
    416       "modelType": "A String", # Type of predictive model (CLASSIFICATION or REGRESSION).
    417       "numberInstances": "A String", # Number of valid data instances used in the trained model.
    418       "classWeightedAccuracy": "A String", # Estimated accuracy of model taking utility weights into account (Categorical models only).
    419       "classificationAccuracy": "A String", # 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).
    420     },
    421     "storagePMMLLocation": "A String", # Google storage location of the preprocessing pmml file.
    422     "id": "A String", # The unique name for the predictive model.
    423     "selfLink": "A String", # A URL to re-request this resource.
    424   }</pre>
    425 </div>
    426 
    427 </body></html>