@@ -20,7 +20,7 @@ package google.cloud.bigquery.v2;
2020import "google/cloud/bigquery/v2/model_reference.proto" ;
2121import "google/cloud/bigquery/v2/standard_sql.proto" ;
2222import "google/protobuf/empty.proto" ;
23- import "google/protobuf/field_mask .proto" ;
23+ import "google/protobuf/timestamp .proto" ;
2424import "google/protobuf/wrappers.proto" ;
2525import "google/api/annotations.proto" ;
2626
@@ -176,6 +176,15 @@ message Model {
176176 repeated ConfusionMatrix confusion_matrix_list = 2 ;
177177 }
178178
179+ // Evaluation metrics for clustering models.
180+ message ClusteringMetrics {
181+ // Davies-Bouldin index.
182+ google.protobuf.DoubleValue davies_bouldin_index = 1 ;
183+
184+ // Mean of squared distances between each sample to its cluster centroid.
185+ google.protobuf.DoubleValue mean_squared_distance = 2 ;
186+ }
187+
179188 // Evaluation metrics of a model. These are either computed on all
180189 // training data or just the eval data based on whether eval data was used
181190 // during training.
@@ -189,6 +198,9 @@ message Model {
189198
190199 // Populated for multi-class classification models.
191200 MultiClassClassificationMetrics multi_class_classification_metrics = 3 ;
201+
202+ // [Beta] Populated for clustering models.
203+ ClusteringMetrics clustering_metrics = 4 ;
192204 }
193205 }
194206
@@ -254,10 +266,29 @@ message Model {
254266 // Weights associated with each label class, for rebalancing the
255267 // training data.
256268 map <string , double > label_class_weights = 17 ;
269+
270+ // [Beta] Distance type for clustering models.
271+ DistanceType distance_type = 20 ;
272+
273+ // [Beta] Number of clusters for clustering models.
274+ int64 num_clusters = 21 ;
257275 }
258276
259277 // Information about a single iteration of the training run.
260278 message IterationResult {
279+ // Information about a single cluster for clustering model.
280+ message ClusterInfo {
281+ // Centroid id.
282+ int64 centroid_id = 1 ;
283+
284+ // Cluster radius, the average distance from centroid
285+ // to each point assigned to the cluster.
286+ google.protobuf.DoubleValue cluster_radius = 2 ;
287+
288+ // Cluster size, the total number of points assigned to the cluster.
289+ google.protobuf.Int64Value cluster_size = 3 ;
290+ }
291+
261292 // Index of the iteration, 0 based.
262293 google.protobuf.Int32Value index = 1 ;
263294
@@ -272,14 +303,17 @@ message Model {
272303
273304 // Learn rate used for this iteration.
274305 double learn_rate = 7 ;
306+
307+ // [Beta] Information about top clusters for clustering models.
308+ repeated ClusterInfo cluster_infos = 8 ;
275309 }
276310
277311 // Options that were used for this training run, includes
278312 // user specified and default options that were used.
279313 TrainingOptions training_options = 1 ;
280314
281- // The start time of this training run, in milliseconds since epoch .
282- int64 start_time = 2 ;
315+ // The start time of this training run.
316+ google.protobuf.Timestamp start_time = 8 ;
283317
284318 // Output of each iteration run, results.size() <= max_iterations.
285319 repeated IterationResult results = 6 ;
@@ -298,6 +332,9 @@ message Model {
298332
299333 // Logistic regression model.
300334 LOGISTIC_REGRESSION = 2 ;
335+
336+ // [Beta] K-means clustering model.
337+ KMEANS = 3 ;
301338 }
302339
303340 // Loss metric to evaluate model training performance.
@@ -311,6 +348,17 @@ message Model {
311348 MEAN_LOG_LOSS = 2 ;
312349 }
313350
351+ // Distance metric used to compute the distance between two points.
352+ enum DistanceType {
353+ DISTANCE_TYPE_UNSPECIFIED = 0 ;
354+
355+ // Eculidean distance.
356+ EUCLIDEAN = 1 ;
357+
358+ // Cosine distance.
359+ COSINE = 2 ;
360+ }
361+
314362 // Indicates the method to split input data into multiple tables.
315363 enum DataSplitMethod {
316364 DATA_SPLIT_METHOD_UNSPECIFIED = 0 ;
@@ -413,13 +461,13 @@ message GetModelRequest {
413461}
414462
415463message PatchModelRequest {
416- // Project ID of the model to patch
464+ // Project ID of the model to patch.
417465 string project_id = 1 ;
418466
419- // Dataset ID of the model to patch
467+ // Dataset ID of the model to patch.
420468 string dataset_id = 2 ;
421469
422- // Model ID of the model to patch
470+ // Model ID of the model to patch.
423471 string model_id = 3 ;
424472
425473 // Patched model.
@@ -429,13 +477,13 @@ message PatchModelRequest {
429477}
430478
431479message DeleteModelRequest {
432- // Project ID of the requested model.
480+ // Project ID of the model to delete .
433481 string project_id = 1 ;
434482
435- // Dataset ID of the requested model.
483+ // Dataset ID of the model to delete .
436484 string dataset_id = 2 ;
437485
438- // Model ID of the requested model.
486+ // Model ID of the model to delete .
439487 string model_id = 3 ;
440488}
441489
0 commit comments