Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 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="bigquery_v2.html">BigQuery API</a> . <a href="bigquery_v2.models.html">models</a></h1> |
| 76 | <h2>Instance Methods</h2> |
| 77 | <p class="toc_element"> |
| 78 | <code><a href="#delete">delete(projectId, datasetId, modelId)</a></code></p> |
| 79 | <p class="firstline">Deletes the model specified by modelId from the dataset.</p> |
| 80 | <p class="toc_element"> |
| 81 | <code><a href="#get">get(projectId, datasetId, modelId)</a></code></p> |
| 82 | <p class="firstline">Gets the specified model resource by model ID.</p> |
| 83 | <p class="toc_element"> |
| 84 | <code><a href="#list">list(projectId, datasetId, pageToken=None, maxResults=None)</a></code></p> |
| 85 | <p class="firstline">Lists all models in the specified dataset. Requires the READER dataset</p> |
| 86 | <p class="toc_element"> |
| 87 | <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> |
| 88 | <p class="firstline">Retrieves the next page of results.</p> |
| 89 | <p class="toc_element"> |
| 90 | <code><a href="#patch">patch(projectId, datasetId, modelId, body)</a></code></p> |
| 91 | <p class="firstline">Patch specific fields in the specified model.</p> |
| 92 | <h3>Method Details</h3> |
| 93 | <div class="method"> |
| 94 | <code class="details" id="delete">delete(projectId, datasetId, modelId)</code> |
| 95 | <pre>Deletes the model specified by modelId from the dataset. |
| 96 | |
| 97 | Args: |
| 98 | projectId: string, Project ID of the model to delete. (required) |
| 99 | datasetId: string, Dataset ID of the model to delete. (required) |
| 100 | modelId: string, Model ID of the model to delete. (required) |
| 101 | </pre> |
| 102 | </div> |
| 103 | |
| 104 | <div class="method"> |
| 105 | <code class="details" id="get">get(projectId, datasetId, modelId)</code> |
| 106 | <pre>Gets the specified model resource by model ID. |
| 107 | |
| 108 | Args: |
| 109 | projectId: string, Project ID of the requested model. (required) |
| 110 | datasetId: string, Dataset ID of the requested model. (required) |
| 111 | modelId: string, Model ID of the requested model. (required) |
| 112 | |
| 113 | Returns: |
| 114 | An object of the form: |
| 115 | |
| 116 | { |
| 117 | "labelColumns": [ # Output only. Label columns that were used to train this model. |
| 118 | # The output of the model will have a "predicted_" prefix to these columns. |
| 119 | { # A field or a column. |
| 120 | "type": { # The type of a variable, e.g., a function argument. # Optional. The type of this parameter. Absent if not explicitly |
| 121 | # specified (e.g., CREATE FUNCTION statement can omit the return type; |
| 122 | # in this case the output parameter does not have this "type" field). |
| 123 | # Examples: |
| 124 | # INT64: {type_kind="INT64"} |
| 125 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 126 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 127 | # {type_kind="STRUCT", |
| 128 | # struct_type={fields=[ |
| 129 | # {name="x", type={type_kind="STRING"}}, |
| 130 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 131 | # ]}} |
| 132 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 133 | "fields": [ |
| 134 | # Object with schema name: StandardSqlField |
| 135 | ], |
| 136 | }, |
| 137 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
| 138 | "typeKind": "A String", # Required. The top level type of this field. |
| 139 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 140 | }, |
| 141 | "name": "A String", # Optional. The name of this field. Can be absent for struct fields. |
| 142 | }, |
| 143 | ], |
| 144 | "description": "A String", # [Optional] A user-friendly description of this model. |
| 145 | "trainingRuns": [ # Output only. Information for all training runs in increasing order of |
| 146 | # start_time. |
| 147 | { # Information about a single training query run for the model. |
| 148 | "evaluationMetrics": { # Evaluation metrics of a model. These are either computed on all training # The evaluation metrics over training/eval data that were computed at the |
| 149 | # end of training. |
| 150 | # data or just the eval data based on whether eval data was used during |
| 151 | # training. These are not present for imported models. |
| 152 | "clusteringMetrics": { # Evaluation metrics for clustering models. # [Beta] Populated for clustering models. |
| 153 | "meanSquaredDistance": 3.14, # Mean of squared distances between each sample to its cluster centroid. |
| 154 | "daviesBouldinIndex": 3.14, # Davies-Bouldin index. |
| 155 | }, |
| 156 | "regressionMetrics": { # Evaluation metrics for regression models. # Populated for regression models. |
| 157 | "meanSquaredLogError": 3.14, # Mean squared log error. |
| 158 | "meanAbsoluteError": 3.14, # Mean absolute error. |
| 159 | "meanSquaredError": 3.14, # Mean squared error. |
| 160 | "medianAbsoluteError": 3.14, # Median absolute error. |
| 161 | "rSquared": 3.14, # R^2 score. |
| 162 | }, |
| 163 | "binaryClassificationMetrics": { # Evaluation metrics for binary classification/classifier models. # Populated for binary classification/classifier models. |
| 164 | "negativeLabel": "A String", # Label representing the negative class. |
| 165 | "aggregateClassificationMetrics": { # Aggregate metrics for classification/classifier models. For multi-class # Aggregate classification metrics. |
| 166 | # models, the metrics are either macro-averaged or micro-averaged. When |
| 167 | # macro-averaged, the metrics are calculated for each label and then an |
| 168 | # unweighted average is taken of those values. When micro-averaged, the |
| 169 | # metric is calculated globally by counting the total number of correctly |
| 170 | # predicted rows. |
| 171 | "recall": 3.14, # Recall is the fraction of actual positive labels that were given a |
| 172 | # positive prediction. For multiclass this is a macro-averaged metric. |
| 173 | "precision": 3.14, # Precision is the fraction of actual positive predictions that had |
| 174 | # positive actual labels. For multiclass this is a macro-averaged |
| 175 | # metric treating each class as a binary classifier. |
| 176 | "logLoss": 3.14, # Logarithmic Loss. For multiclass this is a macro-averaged metric. |
| 177 | "threshold": 3.14, # Threshold at which the metrics are computed. For binary |
| 178 | # classification models this is the positive class threshold. |
| 179 | # For multi-class classfication models this is the confidence |
| 180 | # threshold. |
| 181 | "accuracy": 3.14, # Accuracy is the fraction of predictions given the correct label. For |
| 182 | # multiclass this is a micro-averaged metric. |
| 183 | "f1Score": 3.14, # The F1 score is an average of recall and precision. For multiclass |
| 184 | # this is a macro-averaged metric. |
| 185 | "rocAuc": 3.14, # Area Under a ROC Curve. For multiclass this is a macro-averaged |
| 186 | # metric. |
| 187 | }, |
| 188 | "positiveLabel": "A String", # Label representing the positive class. |
| 189 | "binaryConfusionMatrixList": [ # Binary confusion matrix at multiple thresholds. |
| 190 | { # Confusion matrix for binary classification models. |
| 191 | "truePositives": "A String", # Number of true samples predicted as true. |
| 192 | "recall": 3.14, # Aggregate recall. |
| 193 | "precision": 3.14, # Aggregate precision. |
| 194 | "falseNegatives": "A String", # Number of false samples predicted as false. |
| 195 | "trueNegatives": "A String", # Number of true samples predicted as false. |
| 196 | "falsePositives": "A String", # Number of false samples predicted as true. |
| 197 | "positiveClassThreshold": 3.14, # Threshold value used when computing each of the following metric. |
| 198 | }, |
| 199 | ], |
| 200 | }, |
| 201 | "multiClassClassificationMetrics": { # Evaluation metrics for multi-class classification/classifier models. # Populated for multi-class classification/classifier models. |
| 202 | "aggregateClassificationMetrics": { # Aggregate metrics for classification/classifier models. For multi-class # Aggregate classification metrics. |
| 203 | # models, the metrics are either macro-averaged or micro-averaged. When |
| 204 | # macro-averaged, the metrics are calculated for each label and then an |
| 205 | # unweighted average is taken of those values. When micro-averaged, the |
| 206 | # metric is calculated globally by counting the total number of correctly |
| 207 | # predicted rows. |
| 208 | "recall": 3.14, # Recall is the fraction of actual positive labels that were given a |
| 209 | # positive prediction. For multiclass this is a macro-averaged metric. |
| 210 | "precision": 3.14, # Precision is the fraction of actual positive predictions that had |
| 211 | # positive actual labels. For multiclass this is a macro-averaged |
| 212 | # metric treating each class as a binary classifier. |
| 213 | "logLoss": 3.14, # Logarithmic Loss. For multiclass this is a macro-averaged metric. |
| 214 | "threshold": 3.14, # Threshold at which the metrics are computed. For binary |
| 215 | # classification models this is the positive class threshold. |
| 216 | # For multi-class classfication models this is the confidence |
| 217 | # threshold. |
| 218 | "accuracy": 3.14, # Accuracy is the fraction of predictions given the correct label. For |
| 219 | # multiclass this is a micro-averaged metric. |
| 220 | "f1Score": 3.14, # The F1 score is an average of recall and precision. For multiclass |
| 221 | # this is a macro-averaged metric. |
| 222 | "rocAuc": 3.14, # Area Under a ROC Curve. For multiclass this is a macro-averaged |
| 223 | # metric. |
| 224 | }, |
| 225 | "confusionMatrixList": [ # Confusion matrix at different thresholds. |
| 226 | { # Confusion matrix for multi-class classification models. |
| 227 | "confidenceThreshold": 3.14, # Confidence threshold used when computing the entries of the |
| 228 | # confusion matrix. |
| 229 | "rows": [ # One row per actual label. |
| 230 | { # A single row in the confusion matrix. |
| 231 | "entries": [ # Info describing predicted label distribution. |
| 232 | { # A single entry in the confusion matrix. |
| 233 | "predictedLabel": "A String", # The predicted label. For confidence_threshold > 0, we will |
| 234 | # also add an entry indicating the number of items under the |
| 235 | # confidence threshold. |
| 236 | "itemCount": "A String", # Number of items being predicted as this label. |
| 237 | }, |
| 238 | ], |
| 239 | "actualLabel": "A String", # The original label of this row. |
| 240 | }, |
| 241 | ], |
| 242 | }, |
| 243 | ], |
| 244 | }, |
| 245 | }, |
| 246 | "results": [ # Output of each iteration run, results.size() <= max_iterations. |
| 247 | { # Information about a single iteration of the training run. |
| 248 | "index": 42, # Index of the iteration, 0 based. |
| 249 | "evalLoss": 3.14, # Loss computed on the eval data at the end of iteration. |
| 250 | "durationMs": "A String", # Time taken to run the iteration in milliseconds. |
| 251 | "learnRate": 3.14, # Learn rate used for this iteration. |
| 252 | "trainingLoss": 3.14, # Loss computed on the training data at the end of iteration. |
| 253 | "clusterInfos": [ # [Beta] Information about top clusters for clustering models. |
| 254 | { # Information about a single cluster for clustering model. |
| 255 | "centroidId": "A String", # Centroid id. |
| 256 | "clusterSize": "A String", # Cluster size, the total number of points assigned to the cluster. |
| 257 | "clusterRadius": 3.14, # Cluster radius, the average distance from centroid |
| 258 | # to each point assigned to the cluster. |
| 259 | }, |
| 260 | ], |
| 261 | }, |
| 262 | ], |
| 263 | "startTime": "A String", # The start time of this training run. |
| 264 | "trainingOptions": { # Options that were used for this training run, includes |
| 265 | # user specified and default options that were used. |
| 266 | "optimizationStrategy": "A String", # Optimization strategy for training linear regression models. |
| 267 | "inputLabelColumns": [ # Name of input label columns in training data. |
| 268 | "A String", |
| 269 | ], |
| 270 | "maxIterations": "A String", # The maximum number of iterations in training. Used only for iterative |
| 271 | # training algorithms. |
| 272 | "earlyStop": True or False, # Whether to stop early when the loss doesn't improve significantly |
| 273 | # any more (compared to min_relative_progress). Used only for iterative |
| 274 | # training algorithms. |
| 275 | "initialLearnRate": 3.14, # Specifies the initial learning rate for the line search learn rate |
| 276 | # strategy. |
| 277 | "dataSplitColumn": "A String", # The column to split data with. This column won't be used as a |
| 278 | # feature. |
| 279 | # 1. When data_split_method is CUSTOM, the corresponding column should |
| 280 | # be boolean. The rows with true value tag are eval data, and the false |
| 281 | # are training data. |
| 282 | # 2. When data_split_method is SEQ, the first DATA_SPLIT_EVAL_FRACTION |
| 283 | # rows (from smallest to largest) in the corresponding column are used |
| 284 | # as training data, and the rest are eval data. It respects the order |
| 285 | # in Orderable data types: |
| 286 | # https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#data-type-properties |
| 287 | "numClusters": "A String", # [Beta] Number of clusters for clustering models. |
| 288 | "l1Regularization": 3.14, # L1 regularization coefficient. |
| 289 | "dataSplitMethod": "A String", # The data split type for training and evaluation, e.g. RANDOM. |
| 290 | "distanceType": "A String", # [Beta] Distance type for clustering models. |
| 291 | "warmStart": True or False, # Whether to train a model from the last checkpoint. |
| 292 | "labelClassWeights": { # Weights associated with each label class, for rebalancing the |
| 293 | # training data. Only applicable for classification models. |
| 294 | "a_key": 3.14, |
| 295 | }, |
| 296 | "lossType": "A String", # Type of loss function used during training run. |
| 297 | "dataSplitEvalFraction": 3.14, # The fraction of evaluation data over the whole input data. The rest |
| 298 | # of data will be used as training data. The format should be double. |
| 299 | # Accurate to two decimal places. |
| 300 | # Default value is 0.2. |
| 301 | "l2Regularization": 3.14, # L2 regularization coefficient. |
| 302 | "modelUri": "A String", # [Beta] Google Cloud Storage URI from which the model was imported. Only |
| 303 | # applicable for imported models. |
| 304 | "learnRateStrategy": "A String", # The strategy to determine learn rate for the current iteration. |
| 305 | "minRelativeProgress": 3.14, # When early_stop is true, stops training when accuracy improvement is |
| 306 | # less than 'min_relative_progress'. Used only for iterative training |
| 307 | # algorithms. |
| 308 | "learnRate": 3.14, # Learning rate in training. Used only for iterative training algorithms. |
| 309 | }, |
| 310 | }, |
| 311 | ], |
| 312 | "featureColumns": [ # Output only. Input feature columns that were used to train this model. |
| 313 | { # A field or a column. |
| 314 | "type": { # The type of a variable, e.g., a function argument. # Optional. The type of this parameter. Absent if not explicitly |
| 315 | # specified (e.g., CREATE FUNCTION statement can omit the return type; |
| 316 | # in this case the output parameter does not have this "type" field). |
| 317 | # Examples: |
| 318 | # INT64: {type_kind="INT64"} |
| 319 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 320 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 321 | # {type_kind="STRUCT", |
| 322 | # struct_type={fields=[ |
| 323 | # {name="x", type={type_kind="STRING"}}, |
| 324 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 325 | # ]}} |
| 326 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 327 | "fields": [ |
| 328 | # Object with schema name: StandardSqlField |
| 329 | ], |
| 330 | }, |
| 331 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
| 332 | "typeKind": "A String", # Required. The top level type of this field. |
| 333 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 334 | }, |
| 335 | "name": "A String", # Optional. The name of this field. Can be absent for struct fields. |
| 336 | }, |
| 337 | ], |
| 338 | "labels": { # [Optional] The labels associated with this model. You can use these to |
| 339 | # organize and group your models. Label keys and values can be no longer |
| 340 | # than 63 characters, can only contain lowercase letters, numeric |
| 341 | # characters, underscores and dashes. International characters are allowed. |
| 342 | # Label values are optional. Label keys must start with a letter and each |
| 343 | # label in the list must have a different key. |
| 344 | "a_key": "A String", |
| 345 | }, |
| 346 | "creationTime": "A String", # Output only. The time when this model was created, in millisecs since the |
| 347 | # epoch. |
| 348 | "modelType": "A String", # Output only. Type of the model resource. |
| 349 | "modelReference": { # Id path of a model. # Required. Unique identifier for this model. |
| 350 | "projectId": "A String", # [Required] The ID of the project containing this model. |
| 351 | "datasetId": "A String", # [Required] The ID of the dataset containing this model. |
| 352 | "modelId": "A String", # [Required] The ID of the model. The ID must contain only |
| 353 | # letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum |
| 354 | # length is 1,024 characters. |
| 355 | }, |
| 356 | "etag": "A String", # Output only. A hash of this resource. |
| 357 | "location": "A String", # Output only. The geographic location where the model resides. This value |
| 358 | # is inherited from the dataset. |
| 359 | "friendlyName": "A String", # [Optional] A descriptive name for this model. |
| 360 | "expirationTime": "A String", # [Optional] The time when this model expires, in milliseconds since the |
| 361 | # epoch. If not present, the model will persist indefinitely. Expired models |
| 362 | # will be deleted and their storage reclaimed. The defaultTableExpirationMs |
| 363 | # property of the encapsulating dataset can be used to set a default |
| 364 | # expirationTime on newly created models. |
| 365 | "lastModifiedTime": "A String", # Output only. The time when this model was last modified, in millisecs |
| 366 | # since the epoch. |
| 367 | }</pre> |
| 368 | </div> |
| 369 | |
| 370 | <div class="method"> |
| 371 | <code class="details" id="list">list(projectId, datasetId, pageToken=None, maxResults=None)</code> |
| 372 | <pre>Lists all models in the specified dataset. Requires the READER dataset |
| 373 | role. |
| 374 | |
| 375 | Args: |
| 376 | projectId: string, Project ID of the models to list. (required) |
| 377 | datasetId: string, Dataset ID of the models to list. (required) |
| 378 | pageToken: string, Page token, returned by a previous call to request the next page of |
| 379 | results |
| 380 | maxResults: integer, The maximum number of results per page. |
| 381 | |
| 382 | Returns: |
| 383 | An object of the form: |
| 384 | |
| 385 | { |
| 386 | "models": [ # Models in the requested dataset. Only the following fields are populated: |
| 387 | # model_reference, model_type, creation_time, last_modified_time and |
| 388 | # labels. |
| 389 | { |
| 390 | "labelColumns": [ # Output only. Label columns that were used to train this model. |
| 391 | # The output of the model will have a "predicted_" prefix to these columns. |
| 392 | { # A field or a column. |
| 393 | "type": { # The type of a variable, e.g., a function argument. # Optional. The type of this parameter. Absent if not explicitly |
| 394 | # specified (e.g., CREATE FUNCTION statement can omit the return type; |
| 395 | # in this case the output parameter does not have this "type" field). |
| 396 | # Examples: |
| 397 | # INT64: {type_kind="INT64"} |
| 398 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 399 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 400 | # {type_kind="STRUCT", |
| 401 | # struct_type={fields=[ |
| 402 | # {name="x", type={type_kind="STRING"}}, |
| 403 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 404 | # ]}} |
| 405 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 406 | "fields": [ |
| 407 | # Object with schema name: StandardSqlField |
| 408 | ], |
| 409 | }, |
| 410 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
| 411 | "typeKind": "A String", # Required. The top level type of this field. |
| 412 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 413 | }, |
| 414 | "name": "A String", # Optional. The name of this field. Can be absent for struct fields. |
| 415 | }, |
| 416 | ], |
| 417 | "description": "A String", # [Optional] A user-friendly description of this model. |
| 418 | "trainingRuns": [ # Output only. Information for all training runs in increasing order of |
| 419 | # start_time. |
| 420 | { # Information about a single training query run for the model. |
| 421 | "evaluationMetrics": { # Evaluation metrics of a model. These are either computed on all training # The evaluation metrics over training/eval data that were computed at the |
| 422 | # end of training. |
| 423 | # data or just the eval data based on whether eval data was used during |
| 424 | # training. These are not present for imported models. |
| 425 | "clusteringMetrics": { # Evaluation metrics for clustering models. # [Beta] Populated for clustering models. |
| 426 | "meanSquaredDistance": 3.14, # Mean of squared distances between each sample to its cluster centroid. |
| 427 | "daviesBouldinIndex": 3.14, # Davies-Bouldin index. |
| 428 | }, |
| 429 | "regressionMetrics": { # Evaluation metrics for regression models. # Populated for regression models. |
| 430 | "meanSquaredLogError": 3.14, # Mean squared log error. |
| 431 | "meanAbsoluteError": 3.14, # Mean absolute error. |
| 432 | "meanSquaredError": 3.14, # Mean squared error. |
| 433 | "medianAbsoluteError": 3.14, # Median absolute error. |
| 434 | "rSquared": 3.14, # R^2 score. |
| 435 | }, |
| 436 | "binaryClassificationMetrics": { # Evaluation metrics for binary classification/classifier models. # Populated for binary classification/classifier models. |
| 437 | "negativeLabel": "A String", # Label representing the negative class. |
| 438 | "aggregateClassificationMetrics": { # Aggregate metrics for classification/classifier models. For multi-class # Aggregate classification metrics. |
| 439 | # models, the metrics are either macro-averaged or micro-averaged. When |
| 440 | # macro-averaged, the metrics are calculated for each label and then an |
| 441 | # unweighted average is taken of those values. When micro-averaged, the |
| 442 | # metric is calculated globally by counting the total number of correctly |
| 443 | # predicted rows. |
| 444 | "recall": 3.14, # Recall is the fraction of actual positive labels that were given a |
| 445 | # positive prediction. For multiclass this is a macro-averaged metric. |
| 446 | "precision": 3.14, # Precision is the fraction of actual positive predictions that had |
| 447 | # positive actual labels. For multiclass this is a macro-averaged |
| 448 | # metric treating each class as a binary classifier. |
| 449 | "logLoss": 3.14, # Logarithmic Loss. For multiclass this is a macro-averaged metric. |
| 450 | "threshold": 3.14, # Threshold at which the metrics are computed. For binary |
| 451 | # classification models this is the positive class threshold. |
| 452 | # For multi-class classfication models this is the confidence |
| 453 | # threshold. |
| 454 | "accuracy": 3.14, # Accuracy is the fraction of predictions given the correct label. For |
| 455 | # multiclass this is a micro-averaged metric. |
| 456 | "f1Score": 3.14, # The F1 score is an average of recall and precision. For multiclass |
| 457 | # this is a macro-averaged metric. |
| 458 | "rocAuc": 3.14, # Area Under a ROC Curve. For multiclass this is a macro-averaged |
| 459 | # metric. |
| 460 | }, |
| 461 | "positiveLabel": "A String", # Label representing the positive class. |
| 462 | "binaryConfusionMatrixList": [ # Binary confusion matrix at multiple thresholds. |
| 463 | { # Confusion matrix for binary classification models. |
| 464 | "truePositives": "A String", # Number of true samples predicted as true. |
| 465 | "recall": 3.14, # Aggregate recall. |
| 466 | "precision": 3.14, # Aggregate precision. |
| 467 | "falseNegatives": "A String", # Number of false samples predicted as false. |
| 468 | "trueNegatives": "A String", # Number of true samples predicted as false. |
| 469 | "falsePositives": "A String", # Number of false samples predicted as true. |
| 470 | "positiveClassThreshold": 3.14, # Threshold value used when computing each of the following metric. |
| 471 | }, |
| 472 | ], |
| 473 | }, |
| 474 | "multiClassClassificationMetrics": { # Evaluation metrics for multi-class classification/classifier models. # Populated for multi-class classification/classifier models. |
| 475 | "aggregateClassificationMetrics": { # Aggregate metrics for classification/classifier models. For multi-class # Aggregate classification metrics. |
| 476 | # models, the metrics are either macro-averaged or micro-averaged. When |
| 477 | # macro-averaged, the metrics are calculated for each label and then an |
| 478 | # unweighted average is taken of those values. When micro-averaged, the |
| 479 | # metric is calculated globally by counting the total number of correctly |
| 480 | # predicted rows. |
| 481 | "recall": 3.14, # Recall is the fraction of actual positive labels that were given a |
| 482 | # positive prediction. For multiclass this is a macro-averaged metric. |
| 483 | "precision": 3.14, # Precision is the fraction of actual positive predictions that had |
| 484 | # positive actual labels. For multiclass this is a macro-averaged |
| 485 | # metric treating each class as a binary classifier. |
| 486 | "logLoss": 3.14, # Logarithmic Loss. For multiclass this is a macro-averaged metric. |
| 487 | "threshold": 3.14, # Threshold at which the metrics are computed. For binary |
| 488 | # classification models this is the positive class threshold. |
| 489 | # For multi-class classfication models this is the confidence |
| 490 | # threshold. |
| 491 | "accuracy": 3.14, # Accuracy is the fraction of predictions given the correct label. For |
| 492 | # multiclass this is a micro-averaged metric. |
| 493 | "f1Score": 3.14, # The F1 score is an average of recall and precision. For multiclass |
| 494 | # this is a macro-averaged metric. |
| 495 | "rocAuc": 3.14, # Area Under a ROC Curve. For multiclass this is a macro-averaged |
| 496 | # metric. |
| 497 | }, |
| 498 | "confusionMatrixList": [ # Confusion matrix at different thresholds. |
| 499 | { # Confusion matrix for multi-class classification models. |
| 500 | "confidenceThreshold": 3.14, # Confidence threshold used when computing the entries of the |
| 501 | # confusion matrix. |
| 502 | "rows": [ # One row per actual label. |
| 503 | { # A single row in the confusion matrix. |
| 504 | "entries": [ # Info describing predicted label distribution. |
| 505 | { # A single entry in the confusion matrix. |
| 506 | "predictedLabel": "A String", # The predicted label. For confidence_threshold > 0, we will |
| 507 | # also add an entry indicating the number of items under the |
| 508 | # confidence threshold. |
| 509 | "itemCount": "A String", # Number of items being predicted as this label. |
| 510 | }, |
| 511 | ], |
| 512 | "actualLabel": "A String", # The original label of this row. |
| 513 | }, |
| 514 | ], |
| 515 | }, |
| 516 | ], |
| 517 | }, |
| 518 | }, |
| 519 | "results": [ # Output of each iteration run, results.size() <= max_iterations. |
| 520 | { # Information about a single iteration of the training run. |
| 521 | "index": 42, # Index of the iteration, 0 based. |
| 522 | "evalLoss": 3.14, # Loss computed on the eval data at the end of iteration. |
| 523 | "durationMs": "A String", # Time taken to run the iteration in milliseconds. |
| 524 | "learnRate": 3.14, # Learn rate used for this iteration. |
| 525 | "trainingLoss": 3.14, # Loss computed on the training data at the end of iteration. |
| 526 | "clusterInfos": [ # [Beta] Information about top clusters for clustering models. |
| 527 | { # Information about a single cluster for clustering model. |
| 528 | "centroidId": "A String", # Centroid id. |
| 529 | "clusterSize": "A String", # Cluster size, the total number of points assigned to the cluster. |
| 530 | "clusterRadius": 3.14, # Cluster radius, the average distance from centroid |
| 531 | # to each point assigned to the cluster. |
| 532 | }, |
| 533 | ], |
| 534 | }, |
| 535 | ], |
| 536 | "startTime": "A String", # The start time of this training run. |
| 537 | "trainingOptions": { # Options that were used for this training run, includes |
| 538 | # user specified and default options that were used. |
| 539 | "optimizationStrategy": "A String", # Optimization strategy for training linear regression models. |
| 540 | "inputLabelColumns": [ # Name of input label columns in training data. |
| 541 | "A String", |
| 542 | ], |
| 543 | "maxIterations": "A String", # The maximum number of iterations in training. Used only for iterative |
| 544 | # training algorithms. |
| 545 | "earlyStop": True or False, # Whether to stop early when the loss doesn't improve significantly |
| 546 | # any more (compared to min_relative_progress). Used only for iterative |
| 547 | # training algorithms. |
| 548 | "initialLearnRate": 3.14, # Specifies the initial learning rate for the line search learn rate |
| 549 | # strategy. |
| 550 | "dataSplitColumn": "A String", # The column to split data with. This column won't be used as a |
| 551 | # feature. |
| 552 | # 1. When data_split_method is CUSTOM, the corresponding column should |
| 553 | # be boolean. The rows with true value tag are eval data, and the false |
| 554 | # are training data. |
| 555 | # 2. When data_split_method is SEQ, the first DATA_SPLIT_EVAL_FRACTION |
| 556 | # rows (from smallest to largest) in the corresponding column are used |
| 557 | # as training data, and the rest are eval data. It respects the order |
| 558 | # in Orderable data types: |
| 559 | # https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#data-type-properties |
| 560 | "numClusters": "A String", # [Beta] Number of clusters for clustering models. |
| 561 | "l1Regularization": 3.14, # L1 regularization coefficient. |
| 562 | "dataSplitMethod": "A String", # The data split type for training and evaluation, e.g. RANDOM. |
| 563 | "distanceType": "A String", # [Beta] Distance type for clustering models. |
| 564 | "warmStart": True or False, # Whether to train a model from the last checkpoint. |
| 565 | "labelClassWeights": { # Weights associated with each label class, for rebalancing the |
| 566 | # training data. Only applicable for classification models. |
| 567 | "a_key": 3.14, |
| 568 | }, |
| 569 | "lossType": "A String", # Type of loss function used during training run. |
| 570 | "dataSplitEvalFraction": 3.14, # The fraction of evaluation data over the whole input data. The rest |
| 571 | # of data will be used as training data. The format should be double. |
| 572 | # Accurate to two decimal places. |
| 573 | # Default value is 0.2. |
| 574 | "l2Regularization": 3.14, # L2 regularization coefficient. |
| 575 | "modelUri": "A String", # [Beta] Google Cloud Storage URI from which the model was imported. Only |
| 576 | # applicable for imported models. |
| 577 | "learnRateStrategy": "A String", # The strategy to determine learn rate for the current iteration. |
| 578 | "minRelativeProgress": 3.14, # When early_stop is true, stops training when accuracy improvement is |
| 579 | # less than 'min_relative_progress'. Used only for iterative training |
| 580 | # algorithms. |
| 581 | "learnRate": 3.14, # Learning rate in training. Used only for iterative training algorithms. |
| 582 | }, |
| 583 | }, |
| 584 | ], |
| 585 | "featureColumns": [ # Output only. Input feature columns that were used to train this model. |
| 586 | { # A field or a column. |
| 587 | "type": { # The type of a variable, e.g., a function argument. # Optional. The type of this parameter. Absent if not explicitly |
| 588 | # specified (e.g., CREATE FUNCTION statement can omit the return type; |
| 589 | # in this case the output parameter does not have this "type" field). |
| 590 | # Examples: |
| 591 | # INT64: {type_kind="INT64"} |
| 592 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 593 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 594 | # {type_kind="STRUCT", |
| 595 | # struct_type={fields=[ |
| 596 | # {name="x", type={type_kind="STRING"}}, |
| 597 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 598 | # ]}} |
| 599 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 600 | "fields": [ |
| 601 | # Object with schema name: StandardSqlField |
| 602 | ], |
| 603 | }, |
| 604 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
| 605 | "typeKind": "A String", # Required. The top level type of this field. |
| 606 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 607 | }, |
| 608 | "name": "A String", # Optional. The name of this field. Can be absent for struct fields. |
| 609 | }, |
| 610 | ], |
| 611 | "labels": { # [Optional] The labels associated with this model. You can use these to |
| 612 | # organize and group your models. Label keys and values can be no longer |
| 613 | # than 63 characters, can only contain lowercase letters, numeric |
| 614 | # characters, underscores and dashes. International characters are allowed. |
| 615 | # Label values are optional. Label keys must start with a letter and each |
| 616 | # label in the list must have a different key. |
| 617 | "a_key": "A String", |
| 618 | }, |
| 619 | "creationTime": "A String", # Output only. The time when this model was created, in millisecs since the |
| 620 | # epoch. |
| 621 | "modelType": "A String", # Output only. Type of the model resource. |
| 622 | "modelReference": { # Id path of a model. # Required. Unique identifier for this model. |
| 623 | "projectId": "A String", # [Required] The ID of the project containing this model. |
| 624 | "datasetId": "A String", # [Required] The ID of the dataset containing this model. |
| 625 | "modelId": "A String", # [Required] The ID of the model. The ID must contain only |
| 626 | # letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum |
| 627 | # length is 1,024 characters. |
| 628 | }, |
| 629 | "etag": "A String", # Output only. A hash of this resource. |
| 630 | "location": "A String", # Output only. The geographic location where the model resides. This value |
| 631 | # is inherited from the dataset. |
| 632 | "friendlyName": "A String", # [Optional] A descriptive name for this model. |
| 633 | "expirationTime": "A String", # [Optional] The time when this model expires, in milliseconds since the |
| 634 | # epoch. If not present, the model will persist indefinitely. Expired models |
| 635 | # will be deleted and their storage reclaimed. The defaultTableExpirationMs |
| 636 | # property of the encapsulating dataset can be used to set a default |
| 637 | # expirationTime on newly created models. |
| 638 | "lastModifiedTime": "A String", # Output only. The time when this model was last modified, in millisecs |
| 639 | # since the epoch. |
| 640 | }, |
| 641 | ], |
| 642 | "nextPageToken": "A String", # A token to request the next page of results. |
| 643 | }</pre> |
| 644 | </div> |
| 645 | |
| 646 | <div class="method"> |
| 647 | <code class="details" id="list_next">list_next(previous_request, previous_response)</code> |
| 648 | <pre>Retrieves the next page of results. |
| 649 | |
| 650 | Args: |
| 651 | previous_request: The request for the previous page. (required) |
| 652 | previous_response: The response from the request for the previous page. (required) |
| 653 | |
| 654 | Returns: |
| 655 | A request object that you can call 'execute()' on to request the next |
| 656 | page. Returns None if there are no more items in the collection. |
| 657 | </pre> |
| 658 | </div> |
| 659 | |
| 660 | <div class="method"> |
| 661 | <code class="details" id="patch">patch(projectId, datasetId, modelId, body)</code> |
| 662 | <pre>Patch specific fields in the specified model. |
| 663 | |
| 664 | Args: |
| 665 | projectId: string, Project ID of the model to patch. (required) |
| 666 | datasetId: string, Dataset ID of the model to patch. (required) |
| 667 | modelId: string, Model ID of the model to patch. (required) |
| 668 | body: object, The request body. (required) |
| 669 | The object takes the form of: |
| 670 | |
| 671 | { |
| 672 | "labelColumns": [ # Output only. Label columns that were used to train this model. |
| 673 | # The output of the model will have a "predicted_" prefix to these columns. |
| 674 | { # A field or a column. |
| 675 | "type": { # The type of a variable, e.g., a function argument. # Optional. The type of this parameter. Absent if not explicitly |
| 676 | # specified (e.g., CREATE FUNCTION statement can omit the return type; |
| 677 | # in this case the output parameter does not have this "type" field). |
| 678 | # Examples: |
| 679 | # INT64: {type_kind="INT64"} |
| 680 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 681 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 682 | # {type_kind="STRUCT", |
| 683 | # struct_type={fields=[ |
| 684 | # {name="x", type={type_kind="STRING"}}, |
| 685 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 686 | # ]}} |
| 687 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 688 | "fields": [ |
| 689 | # Object with schema name: StandardSqlField |
| 690 | ], |
| 691 | }, |
| 692 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
| 693 | "typeKind": "A String", # Required. The top level type of this field. |
| 694 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 695 | }, |
| 696 | "name": "A String", # Optional. The name of this field. Can be absent for struct fields. |
| 697 | }, |
| 698 | ], |
| 699 | "description": "A String", # [Optional] A user-friendly description of this model. |
| 700 | "trainingRuns": [ # Output only. Information for all training runs in increasing order of |
| 701 | # start_time. |
| 702 | { # Information about a single training query run for the model. |
| 703 | "evaluationMetrics": { # Evaluation metrics of a model. These are either computed on all training # The evaluation metrics over training/eval data that were computed at the |
| 704 | # end of training. |
| 705 | # data or just the eval data based on whether eval data was used during |
| 706 | # training. These are not present for imported models. |
| 707 | "clusteringMetrics": { # Evaluation metrics for clustering models. # [Beta] Populated for clustering models. |
| 708 | "meanSquaredDistance": 3.14, # Mean of squared distances between each sample to its cluster centroid. |
| 709 | "daviesBouldinIndex": 3.14, # Davies-Bouldin index. |
| 710 | }, |
| 711 | "regressionMetrics": { # Evaluation metrics for regression models. # Populated for regression models. |
| 712 | "meanSquaredLogError": 3.14, # Mean squared log error. |
| 713 | "meanAbsoluteError": 3.14, # Mean absolute error. |
| 714 | "meanSquaredError": 3.14, # Mean squared error. |
| 715 | "medianAbsoluteError": 3.14, # Median absolute error. |
| 716 | "rSquared": 3.14, # R^2 score. |
| 717 | }, |
| 718 | "binaryClassificationMetrics": { # Evaluation metrics for binary classification/classifier models. # Populated for binary classification/classifier models. |
| 719 | "negativeLabel": "A String", # Label representing the negative class. |
| 720 | "aggregateClassificationMetrics": { # Aggregate metrics for classification/classifier models. For multi-class # Aggregate classification metrics. |
| 721 | # models, the metrics are either macro-averaged or micro-averaged. When |
| 722 | # macro-averaged, the metrics are calculated for each label and then an |
| 723 | # unweighted average is taken of those values. When micro-averaged, the |
| 724 | # metric is calculated globally by counting the total number of correctly |
| 725 | # predicted rows. |
| 726 | "recall": 3.14, # Recall is the fraction of actual positive labels that were given a |
| 727 | # positive prediction. For multiclass this is a macro-averaged metric. |
| 728 | "precision": 3.14, # Precision is the fraction of actual positive predictions that had |
| 729 | # positive actual labels. For multiclass this is a macro-averaged |
| 730 | # metric treating each class as a binary classifier. |
| 731 | "logLoss": 3.14, # Logarithmic Loss. For multiclass this is a macro-averaged metric. |
| 732 | "threshold": 3.14, # Threshold at which the metrics are computed. For binary |
| 733 | # classification models this is the positive class threshold. |
| 734 | # For multi-class classfication models this is the confidence |
| 735 | # threshold. |
| 736 | "accuracy": 3.14, # Accuracy is the fraction of predictions given the correct label. For |
| 737 | # multiclass this is a micro-averaged metric. |
| 738 | "f1Score": 3.14, # The F1 score is an average of recall and precision. For multiclass |
| 739 | # this is a macro-averaged metric. |
| 740 | "rocAuc": 3.14, # Area Under a ROC Curve. For multiclass this is a macro-averaged |
| 741 | # metric. |
| 742 | }, |
| 743 | "positiveLabel": "A String", # Label representing the positive class. |
| 744 | "binaryConfusionMatrixList": [ # Binary confusion matrix at multiple thresholds. |
| 745 | { # Confusion matrix for binary classification models. |
| 746 | "truePositives": "A String", # Number of true samples predicted as true. |
| 747 | "recall": 3.14, # Aggregate recall. |
| 748 | "precision": 3.14, # Aggregate precision. |
| 749 | "falseNegatives": "A String", # Number of false samples predicted as false. |
| 750 | "trueNegatives": "A String", # Number of true samples predicted as false. |
| 751 | "falsePositives": "A String", # Number of false samples predicted as true. |
| 752 | "positiveClassThreshold": 3.14, # Threshold value used when computing each of the following metric. |
| 753 | }, |
| 754 | ], |
| 755 | }, |
| 756 | "multiClassClassificationMetrics": { # Evaluation metrics for multi-class classification/classifier models. # Populated for multi-class classification/classifier models. |
| 757 | "aggregateClassificationMetrics": { # Aggregate metrics for classification/classifier models. For multi-class # Aggregate classification metrics. |
| 758 | # models, the metrics are either macro-averaged or micro-averaged. When |
| 759 | # macro-averaged, the metrics are calculated for each label and then an |
| 760 | # unweighted average is taken of those values. When micro-averaged, the |
| 761 | # metric is calculated globally by counting the total number of correctly |
| 762 | # predicted rows. |
| 763 | "recall": 3.14, # Recall is the fraction of actual positive labels that were given a |
| 764 | # positive prediction. For multiclass this is a macro-averaged metric. |
| 765 | "precision": 3.14, # Precision is the fraction of actual positive predictions that had |
| 766 | # positive actual labels. For multiclass this is a macro-averaged |
| 767 | # metric treating each class as a binary classifier. |
| 768 | "logLoss": 3.14, # Logarithmic Loss. For multiclass this is a macro-averaged metric. |
| 769 | "threshold": 3.14, # Threshold at which the metrics are computed. For binary |
| 770 | # classification models this is the positive class threshold. |
| 771 | # For multi-class classfication models this is the confidence |
| 772 | # threshold. |
| 773 | "accuracy": 3.14, # Accuracy is the fraction of predictions given the correct label. For |
| 774 | # multiclass this is a micro-averaged metric. |
| 775 | "f1Score": 3.14, # The F1 score is an average of recall and precision. For multiclass |
| 776 | # this is a macro-averaged metric. |
| 777 | "rocAuc": 3.14, # Area Under a ROC Curve. For multiclass this is a macro-averaged |
| 778 | # metric. |
| 779 | }, |
| 780 | "confusionMatrixList": [ # Confusion matrix at different thresholds. |
| 781 | { # Confusion matrix for multi-class classification models. |
| 782 | "confidenceThreshold": 3.14, # Confidence threshold used when computing the entries of the |
| 783 | # confusion matrix. |
| 784 | "rows": [ # One row per actual label. |
| 785 | { # A single row in the confusion matrix. |
| 786 | "entries": [ # Info describing predicted label distribution. |
| 787 | { # A single entry in the confusion matrix. |
| 788 | "predictedLabel": "A String", # The predicted label. For confidence_threshold > 0, we will |
| 789 | # also add an entry indicating the number of items under the |
| 790 | # confidence threshold. |
| 791 | "itemCount": "A String", # Number of items being predicted as this label. |
| 792 | }, |
| 793 | ], |
| 794 | "actualLabel": "A String", # The original label of this row. |
| 795 | }, |
| 796 | ], |
| 797 | }, |
| 798 | ], |
| 799 | }, |
| 800 | }, |
| 801 | "results": [ # Output of each iteration run, results.size() <= max_iterations. |
| 802 | { # Information about a single iteration of the training run. |
| 803 | "index": 42, # Index of the iteration, 0 based. |
| 804 | "evalLoss": 3.14, # Loss computed on the eval data at the end of iteration. |
| 805 | "durationMs": "A String", # Time taken to run the iteration in milliseconds. |
| 806 | "learnRate": 3.14, # Learn rate used for this iteration. |
| 807 | "trainingLoss": 3.14, # Loss computed on the training data at the end of iteration. |
| 808 | "clusterInfos": [ # [Beta] Information about top clusters for clustering models. |
| 809 | { # Information about a single cluster for clustering model. |
| 810 | "centroidId": "A String", # Centroid id. |
| 811 | "clusterSize": "A String", # Cluster size, the total number of points assigned to the cluster. |
| 812 | "clusterRadius": 3.14, # Cluster radius, the average distance from centroid |
| 813 | # to each point assigned to the cluster. |
| 814 | }, |
| 815 | ], |
| 816 | }, |
| 817 | ], |
| 818 | "startTime": "A String", # The start time of this training run. |
| 819 | "trainingOptions": { # Options that were used for this training run, includes |
| 820 | # user specified and default options that were used. |
| 821 | "optimizationStrategy": "A String", # Optimization strategy for training linear regression models. |
| 822 | "inputLabelColumns": [ # Name of input label columns in training data. |
| 823 | "A String", |
| 824 | ], |
| 825 | "maxIterations": "A String", # The maximum number of iterations in training. Used only for iterative |
| 826 | # training algorithms. |
| 827 | "earlyStop": True or False, # Whether to stop early when the loss doesn't improve significantly |
| 828 | # any more (compared to min_relative_progress). Used only for iterative |
| 829 | # training algorithms. |
| 830 | "initialLearnRate": 3.14, # Specifies the initial learning rate for the line search learn rate |
| 831 | # strategy. |
| 832 | "dataSplitColumn": "A String", # The column to split data with. This column won't be used as a |
| 833 | # feature. |
| 834 | # 1. When data_split_method is CUSTOM, the corresponding column should |
| 835 | # be boolean. The rows with true value tag are eval data, and the false |
| 836 | # are training data. |
| 837 | # 2. When data_split_method is SEQ, the first DATA_SPLIT_EVAL_FRACTION |
| 838 | # rows (from smallest to largest) in the corresponding column are used |
| 839 | # as training data, and the rest are eval data. It respects the order |
| 840 | # in Orderable data types: |
| 841 | # https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#data-type-properties |
| 842 | "numClusters": "A String", # [Beta] Number of clusters for clustering models. |
| 843 | "l1Regularization": 3.14, # L1 regularization coefficient. |
| 844 | "dataSplitMethod": "A String", # The data split type for training and evaluation, e.g. RANDOM. |
| 845 | "distanceType": "A String", # [Beta] Distance type for clustering models. |
| 846 | "warmStart": True or False, # Whether to train a model from the last checkpoint. |
| 847 | "labelClassWeights": { # Weights associated with each label class, for rebalancing the |
| 848 | # training data. Only applicable for classification models. |
| 849 | "a_key": 3.14, |
| 850 | }, |
| 851 | "lossType": "A String", # Type of loss function used during training run. |
| 852 | "dataSplitEvalFraction": 3.14, # The fraction of evaluation data over the whole input data. The rest |
| 853 | # of data will be used as training data. The format should be double. |
| 854 | # Accurate to two decimal places. |
| 855 | # Default value is 0.2. |
| 856 | "l2Regularization": 3.14, # L2 regularization coefficient. |
| 857 | "modelUri": "A String", # [Beta] Google Cloud Storage URI from which the model was imported. Only |
| 858 | # applicable for imported models. |
| 859 | "learnRateStrategy": "A String", # The strategy to determine learn rate for the current iteration. |
| 860 | "minRelativeProgress": 3.14, # When early_stop is true, stops training when accuracy improvement is |
| 861 | # less than 'min_relative_progress'. Used only for iterative training |
| 862 | # algorithms. |
| 863 | "learnRate": 3.14, # Learning rate in training. Used only for iterative training algorithms. |
| 864 | }, |
| 865 | }, |
| 866 | ], |
| 867 | "featureColumns": [ # Output only. Input feature columns that were used to train this model. |
| 868 | { # A field or a column. |
| 869 | "type": { # The type of a variable, e.g., a function argument. # Optional. The type of this parameter. Absent if not explicitly |
| 870 | # specified (e.g., CREATE FUNCTION statement can omit the return type; |
| 871 | # in this case the output parameter does not have this "type" field). |
| 872 | # Examples: |
| 873 | # INT64: {type_kind="INT64"} |
| 874 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 875 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 876 | # {type_kind="STRUCT", |
| 877 | # struct_type={fields=[ |
| 878 | # {name="x", type={type_kind="STRING"}}, |
| 879 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 880 | # ]}} |
| 881 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 882 | "fields": [ |
| 883 | # Object with schema name: StandardSqlField |
| 884 | ], |
| 885 | }, |
| 886 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
| 887 | "typeKind": "A String", # Required. The top level type of this field. |
| 888 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 889 | }, |
| 890 | "name": "A String", # Optional. The name of this field. Can be absent for struct fields. |
| 891 | }, |
| 892 | ], |
| 893 | "labels": { # [Optional] The labels associated with this model. You can use these to |
| 894 | # organize and group your models. Label keys and values can be no longer |
| 895 | # than 63 characters, can only contain lowercase letters, numeric |
| 896 | # characters, underscores and dashes. International characters are allowed. |
| 897 | # Label values are optional. Label keys must start with a letter and each |
| 898 | # label in the list must have a different key. |
| 899 | "a_key": "A String", |
| 900 | }, |
| 901 | "creationTime": "A String", # Output only. The time when this model was created, in millisecs since the |
| 902 | # epoch. |
| 903 | "modelType": "A String", # Output only. Type of the model resource. |
| 904 | "modelReference": { # Id path of a model. # Required. Unique identifier for this model. |
| 905 | "projectId": "A String", # [Required] The ID of the project containing this model. |
| 906 | "datasetId": "A String", # [Required] The ID of the dataset containing this model. |
| 907 | "modelId": "A String", # [Required] The ID of the model. The ID must contain only |
| 908 | # letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum |
| 909 | # length is 1,024 characters. |
| 910 | }, |
| 911 | "etag": "A String", # Output only. A hash of this resource. |
| 912 | "location": "A String", # Output only. The geographic location where the model resides. This value |
| 913 | # is inherited from the dataset. |
| 914 | "friendlyName": "A String", # [Optional] A descriptive name for this model. |
| 915 | "expirationTime": "A String", # [Optional] The time when this model expires, in milliseconds since the |
| 916 | # epoch. If not present, the model will persist indefinitely. Expired models |
| 917 | # will be deleted and their storage reclaimed. The defaultTableExpirationMs |
| 918 | # property of the encapsulating dataset can be used to set a default |
| 919 | # expirationTime on newly created models. |
| 920 | "lastModifiedTime": "A String", # Output only. The time when this model was last modified, in millisecs |
| 921 | # since the epoch. |
| 922 | } |
| 923 | |
| 924 | |
| 925 | Returns: |
| 926 | An object of the form: |
| 927 | |
| 928 | { |
| 929 | "labelColumns": [ # Output only. Label columns that were used to train this model. |
| 930 | # The output of the model will have a "predicted_" prefix to these columns. |
| 931 | { # A field or a column. |
| 932 | "type": { # The type of a variable, e.g., a function argument. # Optional. The type of this parameter. Absent if not explicitly |
| 933 | # specified (e.g., CREATE FUNCTION statement can omit the return type; |
| 934 | # in this case the output parameter does not have this "type" field). |
| 935 | # Examples: |
| 936 | # INT64: {type_kind="INT64"} |
| 937 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 938 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 939 | # {type_kind="STRUCT", |
| 940 | # struct_type={fields=[ |
| 941 | # {name="x", type={type_kind="STRING"}}, |
| 942 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 943 | # ]}} |
| 944 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 945 | "fields": [ |
| 946 | # Object with schema name: StandardSqlField |
| 947 | ], |
| 948 | }, |
| 949 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
| 950 | "typeKind": "A String", # Required. The top level type of this field. |
| 951 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 952 | }, |
| 953 | "name": "A String", # Optional. The name of this field. Can be absent for struct fields. |
| 954 | }, |
| 955 | ], |
| 956 | "description": "A String", # [Optional] A user-friendly description of this model. |
| 957 | "trainingRuns": [ # Output only. Information for all training runs in increasing order of |
| 958 | # start_time. |
| 959 | { # Information about a single training query run for the model. |
| 960 | "evaluationMetrics": { # Evaluation metrics of a model. These are either computed on all training # The evaluation metrics over training/eval data that were computed at the |
| 961 | # end of training. |
| 962 | # data or just the eval data based on whether eval data was used during |
| 963 | # training. These are not present for imported models. |
| 964 | "clusteringMetrics": { # Evaluation metrics for clustering models. # [Beta] Populated for clustering models. |
| 965 | "meanSquaredDistance": 3.14, # Mean of squared distances between each sample to its cluster centroid. |
| 966 | "daviesBouldinIndex": 3.14, # Davies-Bouldin index. |
| 967 | }, |
| 968 | "regressionMetrics": { # Evaluation metrics for regression models. # Populated for regression models. |
| 969 | "meanSquaredLogError": 3.14, # Mean squared log error. |
| 970 | "meanAbsoluteError": 3.14, # Mean absolute error. |
| 971 | "meanSquaredError": 3.14, # Mean squared error. |
| 972 | "medianAbsoluteError": 3.14, # Median absolute error. |
| 973 | "rSquared": 3.14, # R^2 score. |
| 974 | }, |
| 975 | "binaryClassificationMetrics": { # Evaluation metrics for binary classification/classifier models. # Populated for binary classification/classifier models. |
| 976 | "negativeLabel": "A String", # Label representing the negative class. |
| 977 | "aggregateClassificationMetrics": { # Aggregate metrics for classification/classifier models. For multi-class # Aggregate classification metrics. |
| 978 | # models, the metrics are either macro-averaged or micro-averaged. When |
| 979 | # macro-averaged, the metrics are calculated for each label and then an |
| 980 | # unweighted average is taken of those values. When micro-averaged, the |
| 981 | # metric is calculated globally by counting the total number of correctly |
| 982 | # predicted rows. |
| 983 | "recall": 3.14, # Recall is the fraction of actual positive labels that were given a |
| 984 | # positive prediction. For multiclass this is a macro-averaged metric. |
| 985 | "precision": 3.14, # Precision is the fraction of actual positive predictions that had |
| 986 | # positive actual labels. For multiclass this is a macro-averaged |
| 987 | # metric treating each class as a binary classifier. |
| 988 | "logLoss": 3.14, # Logarithmic Loss. For multiclass this is a macro-averaged metric. |
| 989 | "threshold": 3.14, # Threshold at which the metrics are computed. For binary |
| 990 | # classification models this is the positive class threshold. |
| 991 | # For multi-class classfication models this is the confidence |
| 992 | # threshold. |
| 993 | "accuracy": 3.14, # Accuracy is the fraction of predictions given the correct label. For |
| 994 | # multiclass this is a micro-averaged metric. |
| 995 | "f1Score": 3.14, # The F1 score is an average of recall and precision. For multiclass |
| 996 | # this is a macro-averaged metric. |
| 997 | "rocAuc": 3.14, # Area Under a ROC Curve. For multiclass this is a macro-averaged |
| 998 | # metric. |
| 999 | }, |
| 1000 | "positiveLabel": "A String", # Label representing the positive class. |
| 1001 | "binaryConfusionMatrixList": [ # Binary confusion matrix at multiple thresholds. |
| 1002 | { # Confusion matrix for binary classification models. |
| 1003 | "truePositives": "A String", # Number of true samples predicted as true. |
| 1004 | "recall": 3.14, # Aggregate recall. |
| 1005 | "precision": 3.14, # Aggregate precision. |
| 1006 | "falseNegatives": "A String", # Number of false samples predicted as false. |
| 1007 | "trueNegatives": "A String", # Number of true samples predicted as false. |
| 1008 | "falsePositives": "A String", # Number of false samples predicted as true. |
| 1009 | "positiveClassThreshold": 3.14, # Threshold value used when computing each of the following metric. |
| 1010 | }, |
| 1011 | ], |
| 1012 | }, |
| 1013 | "multiClassClassificationMetrics": { # Evaluation metrics for multi-class classification/classifier models. # Populated for multi-class classification/classifier models. |
| 1014 | "aggregateClassificationMetrics": { # Aggregate metrics for classification/classifier models. For multi-class # Aggregate classification metrics. |
| 1015 | # models, the metrics are either macro-averaged or micro-averaged. When |
| 1016 | # macro-averaged, the metrics are calculated for each label and then an |
| 1017 | # unweighted average is taken of those values. When micro-averaged, the |
| 1018 | # metric is calculated globally by counting the total number of correctly |
| 1019 | # predicted rows. |
| 1020 | "recall": 3.14, # Recall is the fraction of actual positive labels that were given a |
| 1021 | # positive prediction. For multiclass this is a macro-averaged metric. |
| 1022 | "precision": 3.14, # Precision is the fraction of actual positive predictions that had |
| 1023 | # positive actual labels. For multiclass this is a macro-averaged |
| 1024 | # metric treating each class as a binary classifier. |
| 1025 | "logLoss": 3.14, # Logarithmic Loss. For multiclass this is a macro-averaged metric. |
| 1026 | "threshold": 3.14, # Threshold at which the metrics are computed. For binary |
| 1027 | # classification models this is the positive class threshold. |
| 1028 | # For multi-class classfication models this is the confidence |
| 1029 | # threshold. |
| 1030 | "accuracy": 3.14, # Accuracy is the fraction of predictions given the correct label. For |
| 1031 | # multiclass this is a micro-averaged metric. |
| 1032 | "f1Score": 3.14, # The F1 score is an average of recall and precision. For multiclass |
| 1033 | # this is a macro-averaged metric. |
| 1034 | "rocAuc": 3.14, # Area Under a ROC Curve. For multiclass this is a macro-averaged |
| 1035 | # metric. |
| 1036 | }, |
| 1037 | "confusionMatrixList": [ # Confusion matrix at different thresholds. |
| 1038 | { # Confusion matrix for multi-class classification models. |
| 1039 | "confidenceThreshold": 3.14, # Confidence threshold used when computing the entries of the |
| 1040 | # confusion matrix. |
| 1041 | "rows": [ # One row per actual label. |
| 1042 | { # A single row in the confusion matrix. |
| 1043 | "entries": [ # Info describing predicted label distribution. |
| 1044 | { # A single entry in the confusion matrix. |
| 1045 | "predictedLabel": "A String", # The predicted label. For confidence_threshold > 0, we will |
| 1046 | # also add an entry indicating the number of items under the |
| 1047 | # confidence threshold. |
| 1048 | "itemCount": "A String", # Number of items being predicted as this label. |
| 1049 | }, |
| 1050 | ], |
| 1051 | "actualLabel": "A String", # The original label of this row. |
| 1052 | }, |
| 1053 | ], |
| 1054 | }, |
| 1055 | ], |
| 1056 | }, |
| 1057 | }, |
| 1058 | "results": [ # Output of each iteration run, results.size() <= max_iterations. |
| 1059 | { # Information about a single iteration of the training run. |
| 1060 | "index": 42, # Index of the iteration, 0 based. |
| 1061 | "evalLoss": 3.14, # Loss computed on the eval data at the end of iteration. |
| 1062 | "durationMs": "A String", # Time taken to run the iteration in milliseconds. |
| 1063 | "learnRate": 3.14, # Learn rate used for this iteration. |
| 1064 | "trainingLoss": 3.14, # Loss computed on the training data at the end of iteration. |
| 1065 | "clusterInfos": [ # [Beta] Information about top clusters for clustering models. |
| 1066 | { # Information about a single cluster for clustering model. |
| 1067 | "centroidId": "A String", # Centroid id. |
| 1068 | "clusterSize": "A String", # Cluster size, the total number of points assigned to the cluster. |
| 1069 | "clusterRadius": 3.14, # Cluster radius, the average distance from centroid |
| 1070 | # to each point assigned to the cluster. |
| 1071 | }, |
| 1072 | ], |
| 1073 | }, |
| 1074 | ], |
| 1075 | "startTime": "A String", # The start time of this training run. |
| 1076 | "trainingOptions": { # Options that were used for this training run, includes |
| 1077 | # user specified and default options that were used. |
| 1078 | "optimizationStrategy": "A String", # Optimization strategy for training linear regression models. |
| 1079 | "inputLabelColumns": [ # Name of input label columns in training data. |
| 1080 | "A String", |
| 1081 | ], |
| 1082 | "maxIterations": "A String", # The maximum number of iterations in training. Used only for iterative |
| 1083 | # training algorithms. |
| 1084 | "earlyStop": True or False, # Whether to stop early when the loss doesn't improve significantly |
| 1085 | # any more (compared to min_relative_progress). Used only for iterative |
| 1086 | # training algorithms. |
| 1087 | "initialLearnRate": 3.14, # Specifies the initial learning rate for the line search learn rate |
| 1088 | # strategy. |
| 1089 | "dataSplitColumn": "A String", # The column to split data with. This column won't be used as a |
| 1090 | # feature. |
| 1091 | # 1. When data_split_method is CUSTOM, the corresponding column should |
| 1092 | # be boolean. The rows with true value tag are eval data, and the false |
| 1093 | # are training data. |
| 1094 | # 2. When data_split_method is SEQ, the first DATA_SPLIT_EVAL_FRACTION |
| 1095 | # rows (from smallest to largest) in the corresponding column are used |
| 1096 | # as training data, and the rest are eval data. It respects the order |
| 1097 | # in Orderable data types: |
| 1098 | # https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#data-type-properties |
| 1099 | "numClusters": "A String", # [Beta] Number of clusters for clustering models. |
| 1100 | "l1Regularization": 3.14, # L1 regularization coefficient. |
| 1101 | "dataSplitMethod": "A String", # The data split type for training and evaluation, e.g. RANDOM. |
| 1102 | "distanceType": "A String", # [Beta] Distance type for clustering models. |
| 1103 | "warmStart": True or False, # Whether to train a model from the last checkpoint. |
| 1104 | "labelClassWeights": { # Weights associated with each label class, for rebalancing the |
| 1105 | # training data. Only applicable for classification models. |
| 1106 | "a_key": 3.14, |
| 1107 | }, |
| 1108 | "lossType": "A String", # Type of loss function used during training run. |
| 1109 | "dataSplitEvalFraction": 3.14, # The fraction of evaluation data over the whole input data. The rest |
| 1110 | # of data will be used as training data. The format should be double. |
| 1111 | # Accurate to two decimal places. |
| 1112 | # Default value is 0.2. |
| 1113 | "l2Regularization": 3.14, # L2 regularization coefficient. |
| 1114 | "modelUri": "A String", # [Beta] Google Cloud Storage URI from which the model was imported. Only |
| 1115 | # applicable for imported models. |
| 1116 | "learnRateStrategy": "A String", # The strategy to determine learn rate for the current iteration. |
| 1117 | "minRelativeProgress": 3.14, # When early_stop is true, stops training when accuracy improvement is |
| 1118 | # less than 'min_relative_progress'. Used only for iterative training |
| 1119 | # algorithms. |
| 1120 | "learnRate": 3.14, # Learning rate in training. Used only for iterative training algorithms. |
| 1121 | }, |
| 1122 | }, |
| 1123 | ], |
| 1124 | "featureColumns": [ # Output only. Input feature columns that were used to train this model. |
| 1125 | { # A field or a column. |
| 1126 | "type": { # The type of a variable, e.g., a function argument. # Optional. The type of this parameter. Absent if not explicitly |
| 1127 | # specified (e.g., CREATE FUNCTION statement can omit the return type; |
| 1128 | # in this case the output parameter does not have this "type" field). |
| 1129 | # Examples: |
| 1130 | # INT64: {type_kind="INT64"} |
| 1131 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 1132 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 1133 | # {type_kind="STRUCT", |
| 1134 | # struct_type={fields=[ |
| 1135 | # {name="x", type={type_kind="STRING"}}, |
| 1136 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 1137 | # ]}} |
| 1138 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 1139 | "fields": [ |
| 1140 | # Object with schema name: StandardSqlField |
| 1141 | ], |
| 1142 | }, |
| 1143 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
| 1144 | "typeKind": "A String", # Required. The top level type of this field. |
| 1145 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 1146 | }, |
| 1147 | "name": "A String", # Optional. The name of this field. Can be absent for struct fields. |
| 1148 | }, |
| 1149 | ], |
| 1150 | "labels": { # [Optional] The labels associated with this model. You can use these to |
| 1151 | # organize and group your models. Label keys and values can be no longer |
| 1152 | # than 63 characters, can only contain lowercase letters, numeric |
| 1153 | # characters, underscores and dashes. International characters are allowed. |
| 1154 | # Label values are optional. Label keys must start with a letter and each |
| 1155 | # label in the list must have a different key. |
| 1156 | "a_key": "A String", |
| 1157 | }, |
| 1158 | "creationTime": "A String", # Output only. The time when this model was created, in millisecs since the |
| 1159 | # epoch. |
| 1160 | "modelType": "A String", # Output only. Type of the model resource. |
| 1161 | "modelReference": { # Id path of a model. # Required. Unique identifier for this model. |
| 1162 | "projectId": "A String", # [Required] The ID of the project containing this model. |
| 1163 | "datasetId": "A String", # [Required] The ID of the dataset containing this model. |
| 1164 | "modelId": "A String", # [Required] The ID of the model. The ID must contain only |
| 1165 | # letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum |
| 1166 | # length is 1,024 characters. |
| 1167 | }, |
| 1168 | "etag": "A String", # Output only. A hash of this resource. |
| 1169 | "location": "A String", # Output only. The geographic location where the model resides. This value |
| 1170 | # is inherited from the dataset. |
| 1171 | "friendlyName": "A String", # [Optional] A descriptive name for this model. |
| 1172 | "expirationTime": "A String", # [Optional] The time when this model expires, in milliseconds since the |
| 1173 | # epoch. If not present, the model will persist indefinitely. Expired models |
| 1174 | # will be deleted and their storage reclaimed. The defaultTableExpirationMs |
| 1175 | # property of the encapsulating dataset can be used to set a default |
| 1176 | # expirationTime on newly created models. |
| 1177 | "lastModifiedTime": "A String", # Output only. The time when this model was last modified, in millisecs |
| 1178 | # since the epoch. |
| 1179 | }</pre> |
| 1180 | </div> |
| 1181 | |
| 1182 | </body></html> |