-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathenums.py
More file actions
171 lines (144 loc) · 5.66 KB
/
enums.py
File metadata and controls
171 lines (144 loc) · 5.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Wrappers for protocol buffer enum types."""
import enum
class Model(object):
class DataSplitMethod(enum.IntEnum):
"""
Indicates the method to split input data into multiple tables.
Attributes:
DATA_SPLIT_METHOD_UNSPECIFIED (int)
RANDOM (int): Splits data randomly.
CUSTOM (int): Splits data with the user provided tags.
SEQUENTIAL (int): Splits data sequentially.
NO_SPLIT (int): Data split will be skipped.
AUTO_SPLIT (int): Splits data automatically: Uses NO\_SPLIT if the data size is small.
Otherwise uses RANDOM.
"""
DATA_SPLIT_METHOD_UNSPECIFIED = 0
RANDOM = 1
CUSTOM = 2
SEQUENTIAL = 3
NO_SPLIT = 4
AUTO_SPLIT = 5
class DistanceType(enum.IntEnum):
"""
Distance metric used to compute the distance between two points.
Attributes:
DISTANCE_TYPE_UNSPECIFIED (int)
EUCLIDEAN (int): Eculidean distance.
COSINE (int): Cosine distance.
"""
DISTANCE_TYPE_UNSPECIFIED = 0
EUCLIDEAN = 1
COSINE = 2
class LearnRateStrategy(enum.IntEnum):
"""
Indicates the learning rate optimization strategy to use.
Attributes:
LEARN_RATE_STRATEGY_UNSPECIFIED (int)
LINE_SEARCH (int): Use line search to determine learning rate.
CONSTANT (int): Use a constant learning rate.
"""
LEARN_RATE_STRATEGY_UNSPECIFIED = 0
LINE_SEARCH = 1
CONSTANT = 2
class LossType(enum.IntEnum):
"""
Loss metric to evaluate model training performance.
Attributes:
LOSS_TYPE_UNSPECIFIED (int)
MEAN_SQUARED_LOSS (int): Mean squared loss, used for linear regression.
MEAN_LOG_LOSS (int): Mean log loss, used for logistic regression.
"""
LOSS_TYPE_UNSPECIFIED = 0
MEAN_SQUARED_LOSS = 1
MEAN_LOG_LOSS = 2
class ModelType(enum.IntEnum):
"""
Indicates the type of the Model.
Attributes:
MODEL_TYPE_UNSPECIFIED (int)
LINEAR_REGRESSION (int): Linear regression model.
LOGISTIC_REGRESSION (int): Logistic regression based classification model.
KMEANS (int): K-means clustering model.
TENSORFLOW (int): [Beta] An imported TensorFlow model.
"""
MODEL_TYPE_UNSPECIFIED = 0
LINEAR_REGRESSION = 1
LOGISTIC_REGRESSION = 2
KMEANS = 3
TENSORFLOW = 6
class OptimizationStrategy(enum.IntEnum):
"""
Indicates the optimization strategy used for training.
Attributes:
OPTIMIZATION_STRATEGY_UNSPECIFIED (int)
BATCH_GRADIENT_DESCENT (int): Uses an iterative batch gradient descent algorithm.
NORMAL_EQUATION (int): Uses a normal equation to solve linear regression problem.
"""
OPTIMIZATION_STRATEGY_UNSPECIFIED = 0
BATCH_GRADIENT_DESCENT = 1
NORMAL_EQUATION = 2
class KmeansEnums(object):
class KmeansInitializationMethod(enum.IntEnum):
"""
Indicates the method used to initialize the centroids for KMeans
clustering algorithm.
Attributes:
KMEANS_INITIALIZATION_METHOD_UNSPECIFIED (int)
RANDOM (int): Initializes the centroids randomly.
CUSTOM (int): Initializes the centroids using data specified in
kmeans\_initialization\_column.
"""
KMEANS_INITIALIZATION_METHOD_UNSPECIFIED = 0
RANDOM = 1
CUSTOM = 2
class StandardSqlDataType(object):
class TypeKind(enum.IntEnum):
"""
Attributes:
TYPE_KIND_UNSPECIFIED (int): Invalid type.
INT64 (int): Encoded as a string in decimal format.
BOOL (int): Encoded as a boolean "false" or "true".
FLOAT64 (int): Encoded as a number, or string "NaN", "Infinity" or "-Infinity".
STRING (int): Encoded as a string value.
BYTES (int): Encoded as a base64 string per RFC 4648, section 4.
TIMESTAMP (int): Encoded as an RFC 3339 timestamp with mandatory "Z" time zone string:
1985-04-12T23:20:50.52Z
DATE (int): Encoded as RFC 3339 full-date format string: 1985-04-12
TIME (int): Encoded as RFC 3339 partial-time format string: 23:20:50.52
DATETIME (int): Encoded as RFC 3339 full-date "T" partial-time: 1985-04-12T23:20:50.52
GEOGRAPHY (int): Encoded as WKT
NUMERIC (int): Encoded as a decimal string.
ARRAY (int): Encoded as a list with types matching Type.array\_type.
STRUCT (int): Encoded as a list with fields of type Type.struct\_type[i]. List is used
because a JSON object cannot have duplicate field names.
"""
TYPE_KIND_UNSPECIFIED = 0
INT64 = 2
BOOL = 5
FLOAT64 = 7
STRING = 8
BYTES = 9
TIMESTAMP = 19
DATE = 10
TIME = 20
DATETIME = 21
GEOGRAPHY = 22
NUMERIC = 23
ARRAY = 16
STRUCT = 17