spark-connect 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,444 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SparkConnect
4
+ module ML
5
+ # Spark's PredictorParams: the column params shared by every predictor.
6
+ class Predictor < Estimator
7
+ param :features_col, :string, default: "features", doc: "features column name"
8
+ param :label_col, :string, default: "label", doc: "label column name"
9
+ param :prediction_col, :string, default: "prediction", doc: "prediction column name"
10
+ end
11
+
12
+ # Spark's PredictionModel: the prediction columns, `predict` and `numFeatures`. Shared by the
13
+ # classification and regression families (classification loads first).
14
+ class PredictionModel < Model
15
+ param :features_col, :string, default: "features", doc: "features column name"
16
+ param :label_col, :string, default: "label", doc: "label column name"
17
+ param :prediction_col, :string, default: "prediction", doc: "prediction column name"
18
+
19
+ attribute :num_features, :int, spark_name: "numFeatures"
20
+ method_call :predict, arg_count: 1, returns: :double
21
+ end
22
+
23
+ # Params of Spark's DecisionTreeParams, included by every tree estimator.
24
+ module DecisionTreeParams
25
+ def self.included(base)
26
+ base.param :max_depth, :int, default: 5, doc: "maximum depth of the tree (>= 0)"
27
+ base.param :max_bins, :int, default: 32, doc: "maximum number of bins used for discretizing continuous features"
28
+ base.param :min_instances_per_node, :int, default: 1, doc: "minimum number of instances each child must have after a split"
29
+ base.param :min_info_gain, :double, default: 0.0, doc: "minimum information gain for a split to be considered"
30
+ base.param :min_weight_fraction_per_node, :double, default: 0.0, doc: "minimum fraction of the weighted sample each child must have"
31
+ base.param :max_memory_in_mb, :int, default: 256, spark_name: "maxMemoryInMB", doc: "maximum memory in MB for stats aggregation"
32
+ base.param :cache_node_ids, :boolean, default: false, doc: "whether to cache node ids for each instance"
33
+ base.param :checkpoint_interval, :int, default: 10, doc: "checkpoint interval (>= 1), or -1 to disable checkpointing"
34
+ base.param :seed, :long, default: SEED_DEFAULT, doc: "random seed; unset uses a class-derived default on the server"
35
+ base.param :weight_col, :string, doc: "weight column name; unset means every instance has weight 1.0"
36
+ base.param :leaf_col, :string, default: "", doc: "leaf indices column name; empty disables the column"
37
+ end
38
+ end
39
+
40
+ # Params of Spark's TreeEnsembleParams (random forest and GBT), included after {DecisionTreeParams}.
41
+ module TreeEnsembleParams
42
+ def self.included(base)
43
+ base.param :subsampling_rate, :double, default: 1.0, doc: "fraction of the training data used for learning each tree, in (0, 1]"
44
+ base.param :feature_subset_strategy, :string, default: "auto",
45
+ doc: "number of features to consider for splits at each tree node"
46
+ end
47
+ end
48
+
49
+ # Allowlisted members of Spark's DecisionTreeModel trait (a single tree).
50
+ module DecisionTreeModelMembers
51
+ def self.included(base)
52
+ base.attribute :feature_importances, :vector, spark_name: "featureImportances"
53
+ base.attribute :num_nodes, :int, spark_name: "numNodes"
54
+ base.attribute :depth, :int
55
+ base.attribute :to_debug_string, :string, spark_name: "toDebugString"
56
+ base.method_call :predict_leaf, arg_count: 1, returns: :double, spark_name: "predictLeaf"
57
+ end
58
+ end
59
+
60
+ # Allowlisted members of Spark's TreeEnsembleModel trait (a forest or boosted ensemble).
61
+ module TreeEnsembleModelMembers
62
+ def self.included(base)
63
+ base.attribute :feature_importances, :vector, spark_name: "featureImportances"
64
+ base.attribute :tree_weights, :double_array, spark_name: "treeWeights"
65
+ base.attribute :get_num_trees, :int, spark_name: "getNumTrees"
66
+ base.attribute :total_num_nodes, :int, spark_name: "totalNumNodes"
67
+ base.attribute :to_debug_string, :string, spark_name: "toDebugString"
68
+ base.method_call :predict_leaf, arg_count: 1, returns: :vector, spark_name: "predictLeaf"
69
+ end
70
+ end
71
+
72
+ # Allowlisted members of Spark's TrainingSummary trait.
73
+ module TrainingSummaryMembers
74
+ def self.included(base)
75
+ base.attribute :objective_history, :double_array, spark_name: "objectiveHistory"
76
+ base.attribute :total_iterations, :int, spark_name: "totalIterations"
77
+ end
78
+ end
79
+
80
+ # Classification operators (`org.apache.spark.ml.classification`).
81
+ module Classification
82
+ # Binary and multinomial logistic regression.
83
+ class LogisticRegression < Estimator
84
+ operator "org.apache.spark.ml.classification.LogisticRegression"
85
+ model -> { LogisticRegressionModel }
86
+
87
+ param :reg_param, :double, default: 0.0, doc: "regularization parameter (>= 0)"
88
+ param :elastic_net_param, :double, default: 0.0, spark_name: "elasticNetParam",
89
+ doc: "the ElasticNet mixing parameter, in [0, 1]"
90
+ param :max_iter, :int, default: 100, doc: "max number of iterations (>= 0)"
91
+ param :tol, :double, default: 1e-6, doc: "convergence tolerance for iterative algorithms (>= 0)"
92
+ param :fit_intercept, :boolean, default: true, doc: "whether to fit an intercept term"
93
+ param :threshold, :double, default: 0.5, doc: "threshold in binary classification, in [0, 1]"
94
+ param :standardization, :boolean, default: true, doc: "whether to standardize the training features"
95
+ param :aggregation_depth, :int, default: 2, doc: "suggested depth for treeAggregate (>= 2)"
96
+ param :family, :string, default: "auto", doc: "the label distribution family: auto, binomial or multinomial"
97
+ param :features_col, :string, default: "features", doc: "features column name"
98
+ param :label_col, :string, default: "label", doc: "label column name"
99
+ param :prediction_col, :string, default: "prediction", doc: "prediction column name"
100
+ param :probability_col, :string, default: "probability", doc: "predicted class conditional probabilities column"
101
+ param :raw_prediction_col, :string, default: "rawPrediction", doc: "raw prediction (confidence) column name"
102
+ param :weight_col, :string, doc: "weight column name; unset means every instance has weight 1.0"
103
+ param :max_block_size_in_mb, :double, default: 0.0, spark_name: "maxBlockSizeInMB",
104
+ doc: "maximum memory in MB for stacking input data into blocks"
105
+ end
106
+
107
+ # Summary of a logistic regression fit or evaluation.
108
+ class LogisticRegressionSummary < Summary
109
+ attribute :probability_col, :string, spark_name: "probabilityCol"
110
+ attribute :features_col, :string, spark_name: "featuresCol"
111
+ attribute :predictions, :dataframe
112
+ attribute :prediction_col, :string, spark_name: "predictionCol"
113
+ attribute :label_col, :string, spark_name: "labelCol"
114
+ attribute :weight_col, :string, spark_name: "weightCol"
115
+ attribute :labels, :double_array
116
+ attribute :accuracy, :double
117
+ attribute :weighted_precision, :double, spark_name: "weightedPrecision"
118
+ attribute :weighted_recall, :double, spark_name: "weightedRecall"
119
+ attribute :weighted_f_measure, :double, spark_name: "weightedFMeasure"
120
+ attribute :weighted_true_positive_rate, :double, spark_name: "weightedTruePositiveRate"
121
+ attribute :weighted_false_positive_rate, :double, spark_name: "weightedFalsePositiveRate"
122
+ attribute :precision_by_label, :double_array, spark_name: "precisionByLabel"
123
+ attribute :recall_by_label, :double_array, spark_name: "recallByLabel"
124
+ attribute :f_measure_by_label, :double_array, spark_name: "fMeasureByLabel"
125
+ attribute :true_positive_rate_by_label, :double_array, spark_name: "truePositiveRateByLabel"
126
+ attribute :false_positive_rate_by_label, :double_array, spark_name: "falsePositiveRateByLabel"
127
+ end
128
+
129
+ # A fitted {LogisticRegression}.
130
+ class LogisticRegressionModel < Model
131
+ operator "org.apache.spark.ml.classification.LogisticRegressionModel"
132
+ summary_class -> { LogisticRegressionTrainingSummary }
133
+
134
+ param :reg_param, :double, default: 0.0, doc: "regularization parameter (>= 0)"
135
+ param :threshold, :double, default: 0.5, doc: "threshold in binary classification, in [0, 1]"
136
+ param :features_col, :string, default: "features", doc: "features column name"
137
+ param :label_col, :string, default: "label", doc: "label column name"
138
+ param :prediction_col, :string, default: "prediction", doc: "prediction column name"
139
+ param :probability_col, :string, default: "probability", doc: "predicted class conditional probabilities column"
140
+ param :raw_prediction_col, :string, default: "rawPrediction", doc: "raw prediction (confidence) column name"
141
+
142
+ attribute :coefficients, :vector
143
+ attribute :intercept, :double
144
+ attribute :intercept_vector, :vector, spark_name: "interceptVector"
145
+ attribute :coefficient_matrix, :matrix, spark_name: "coefficientMatrix"
146
+ attribute :num_features, :int, spark_name: "numFeatures"
147
+ attribute :num_classes, :int, spark_name: "numClasses"
148
+ method_call :predict_raw, arg_count: 1, returns: :vector, spark_name: "predictRaw"
149
+ method_call :predict_probability, arg_count: 1, returns: :vector, spark_name: "predictProbability"
150
+ method_call :predict, arg_count: 1, returns: :double
151
+ method_call :evaluate, arg_count: 1, returns: LogisticRegressionSummary
152
+ end
153
+
154
+ # Binary logistic regression training summary (adds the ROC/PR curves).
155
+ class BinaryLogisticRegressionTrainingSummary < LogisticRegressionSummary
156
+ attribute :score_col, :string, spark_name: "scoreCol"
157
+ attribute :roc, :dataframe
158
+ attribute :area_under_roc, :double, spark_name: "areaUnderROC"
159
+ attribute :pr, :dataframe
160
+ attribute :f_measure_by_threshold, :dataframe, spark_name: "fMeasureByThreshold"
161
+ attribute :precision_by_threshold, :dataframe, spark_name: "precisionByThreshold"
162
+ attribute :recall_by_threshold, :dataframe, spark_name: "recallByThreshold"
163
+ attribute :objective_history, :double_array, spark_name: "objectiveHistory"
164
+ attribute :total_iterations, :int, spark_name: "totalIterations"
165
+ end
166
+
167
+ # The training summary class of a logistic regression model.
168
+ LogisticRegressionTrainingSummary = BinaryLogisticRegressionTrainingSummary
169
+
170
+ # Spark's Classifier: adds the raw prediction column to the predictor params.
171
+ class Classifier < Predictor
172
+ param :raw_prediction_col, :string, default: "rawPrediction", doc: "raw prediction (confidence) column name"
173
+ end
174
+
175
+ # Spark's ProbabilisticClassifier: adds the probability column and per-class thresholds.
176
+ class ProbabilisticClassifier < Classifier
177
+ param :probability_col, :string, default: "probability", doc: "predicted class conditional probabilities column"
178
+ param :thresholds, :double_array, doc: "per-class thresholds that adjust the predicted class probabilities"
179
+ end
180
+
181
+ # Spark's ClassificationModel: `predictRaw` and `numClasses`.
182
+ class ClassificationModel < PredictionModel
183
+ param :raw_prediction_col, :string, default: "rawPrediction", doc: "raw prediction (confidence) column name"
184
+
185
+ attribute :num_classes, :int, spark_name: "numClasses"
186
+ method_call :predict_raw, arg_count: 1, returns: :vector, spark_name: "predictRaw"
187
+ end
188
+
189
+ # Spark's ProbabilisticClassificationModel: `predictProbability`.
190
+ class ProbabilisticClassificationModel < ClassificationModel
191
+ param :probability_col, :string, default: "probability", doc: "predicted class conditional probabilities column"
192
+ param :thresholds, :double_array, doc: "per-class thresholds that adjust the predicted class probabilities"
193
+
194
+ method_call :predict_probability, arg_count: 1, returns: :vector, spark_name: "predictProbability"
195
+ end
196
+
197
+ # Spark's ClassificationSummary: metrics of a classifier on a dataset.
198
+ class ClassificationSummary < Summary
199
+ attribute :predictions, :dataframe
200
+ attribute :prediction_col, :string, spark_name: "predictionCol"
201
+ attribute :label_col, :string, spark_name: "labelCol"
202
+ attribute :weight_col, :string, spark_name: "weightCol"
203
+ attribute :labels, :double_array
204
+ attribute :accuracy, :double
205
+ attribute :weighted_precision, :double, spark_name: "weightedPrecision"
206
+ attribute :weighted_recall, :double, spark_name: "weightedRecall"
207
+ attribute :weighted_f_measure, :double, spark_name: "weightedFMeasure"
208
+ attribute :weighted_true_positive_rate, :double, spark_name: "weightedTruePositiveRate"
209
+ attribute :weighted_false_positive_rate, :double, spark_name: "weightedFalsePositiveRate"
210
+ attribute :precision_by_label, :double_array, spark_name: "precisionByLabel"
211
+ attribute :recall_by_label, :double_array, spark_name: "recallByLabel"
212
+ attribute :f_measure_by_label, :double_array, spark_name: "fMeasureByLabel"
213
+ attribute :true_positive_rate_by_label, :double_array, spark_name: "truePositiveRateByLabel"
214
+ attribute :false_positive_rate_by_label, :double_array, spark_name: "falsePositiveRateByLabel"
215
+ end
216
+
217
+ # Spark's BinaryClassificationSummary: adds the ROC and PR curves.
218
+ class BinaryClassificationSummary < ClassificationSummary
219
+ attribute :score_col, :string, spark_name: "scoreCol"
220
+ attribute :roc, :dataframe
221
+ attribute :area_under_roc, :double, spark_name: "areaUnderROC"
222
+ attribute :pr, :dataframe
223
+ attribute :f_measure_by_threshold, :dataframe, spark_name: "fMeasureByThreshold"
224
+ attribute :precision_by_threshold, :dataframe, spark_name: "precisionByThreshold"
225
+ attribute :recall_by_threshold, :dataframe, spark_name: "recallByThreshold"
226
+ end
227
+
228
+ # Summary of a LinearSVC evaluation.
229
+ class LinearSVCSummary < BinaryClassificationSummary
230
+ end
231
+
232
+ # Summary of a LinearSVC training run.
233
+ class LinearSVCTrainingSummary < LinearSVCSummary
234
+ include TrainingSummaryMembers
235
+ end
236
+
237
+ # Summary of a factorization machines classifier evaluation.
238
+ class FMClassificationSummary < BinaryClassificationSummary
239
+ end
240
+
241
+ # Summary of a factorization machines classifier training run.
242
+ class FMClassificationTrainingSummary < FMClassificationSummary
243
+ include TrainingSummaryMembers
244
+ end
245
+
246
+ # Summary of a multilayer perceptron evaluation.
247
+ class MultilayerPerceptronClassificationSummary < ClassificationSummary
248
+ end
249
+
250
+ # Summary of a multilayer perceptron training run.
251
+ class MultilayerPerceptronClassificationTrainingSummary < MultilayerPerceptronClassificationSummary
252
+ include TrainingSummaryMembers
253
+ end
254
+
255
+ # Summary of a random forest classifier evaluation.
256
+ class RandomForestClassificationSummary < ClassificationSummary
257
+ end
258
+
259
+ # Summary of a random forest classifier training run.
260
+ class RandomForestClassificationTrainingSummary < RandomForestClassificationSummary
261
+ include TrainingSummaryMembers
262
+ end
263
+
264
+ # Naive Bayes classifier (multinomial, bernoulli, gaussian or complement).
265
+ class NaiveBayes < ProbabilisticClassifier
266
+ operator "org.apache.spark.ml.classification.NaiveBayes"
267
+ model -> { NaiveBayesModel }
268
+
269
+ param :smoothing, :double, default: 1.0, doc: "the smoothing parameter (>= 0)"
270
+ param :model_type, :string, default: "multinomial", doc: "the model type: multinomial, bernoulli, gaussian or complement"
271
+ param :weight_col, :string, doc: "weight column name; unset means every instance has weight 1.0"
272
+ end
273
+
274
+ # A fitted {NaiveBayes}.
275
+ class NaiveBayesModel < ProbabilisticClassificationModel
276
+ operator "org.apache.spark.ml.classification.NaiveBayesModel"
277
+
278
+ param :model_type, :string, default: "multinomial", doc: "the model type: multinomial, bernoulli, gaussian or complement"
279
+
280
+ attribute :pi, :vector
281
+ attribute :theta, :matrix
282
+ attribute :sigma, :matrix
283
+ end
284
+
285
+ # Linear support vector machine classifier.
286
+ class LinearSVC < Classifier
287
+ operator "org.apache.spark.ml.classification.LinearSVC"
288
+ model -> { LinearSVCModel }
289
+
290
+ param :reg_param, :double, default: 0.0, doc: "regularization parameter (>= 0)"
291
+ param :max_iter, :int, default: 100, doc: "max number of iterations (>= 0)"
292
+ param :tol, :double, default: 1e-6, doc: "convergence tolerance for iterative algorithms (>= 0)"
293
+ param :fit_intercept, :boolean, default: true, doc: "whether to fit an intercept term"
294
+ param :standardization, :boolean, default: true, doc: "whether to standardize the training features"
295
+ param :threshold, :double, default: 0.0, doc: "threshold applied to the raw prediction in binary classification"
296
+ param :weight_col, :string, doc: "weight column name; unset means every instance has weight 1.0"
297
+ param :aggregation_depth, :int, default: 2, doc: "suggested depth for treeAggregate (>= 2)"
298
+ param :max_block_size_in_mb, :double, default: 0.0, spark_name: "maxBlockSizeInMB",
299
+ doc: "maximum memory in MB for stacking input data into blocks"
300
+ end
301
+
302
+ # A fitted {LinearSVC}.
303
+ class LinearSVCModel < ClassificationModel
304
+ operator "org.apache.spark.ml.classification.LinearSVCModel"
305
+ summary_class -> { LinearSVCTrainingSummary }
306
+
307
+ param :threshold, :double, default: 0.0, doc: "threshold applied to the raw prediction in binary classification"
308
+
309
+ attribute :intercept, :double
310
+ attribute :coefficients, :vector
311
+ method_call :evaluate, arg_count: 1, returns: LinearSVCSummary
312
+ end
313
+
314
+ # Factorization machines classifier.
315
+ class FMClassifier < ProbabilisticClassifier
316
+ operator "org.apache.spark.ml.classification.FMClassifier"
317
+ model -> { FMClassificationModel }
318
+
319
+ param :factor_size, :int, default: 8, doc: "dimensionality of the factors (> 0)"
320
+ param :fit_intercept, :boolean, default: true, doc: "whether to fit an intercept term"
321
+ param :fit_linear, :boolean, default: true, doc: "whether to fit the linear term (1-way interactions)"
322
+ param :reg_param, :double, default: 0.0, doc: "regularization parameter (>= 0)"
323
+ param :mini_batch_fraction, :double, default: 1.0, doc: "fraction of the input data used for each mini-batch, in (0, 1]"
324
+ param :init_std, :double, default: 0.01, doc: "standard deviation of the initial coefficients"
325
+ param :max_iter, :int, default: 100, doc: "max number of iterations (>= 0)"
326
+ param :step_size, :double, default: 1.0, doc: "step size for each iteration (> 0)"
327
+ param :tol, :double, default: 1e-6, doc: "convergence tolerance for iterative algorithms (>= 0)"
328
+ param :solver, :string, default: "adamW", doc: "the optimization solver: adamW or gd"
329
+ param :seed, :long, default: SEED_DEFAULT, doc: "random seed; unset uses a class-derived default on the server"
330
+ param :weight_col, :string, doc: "weight column name; unset means every instance has weight 1.0"
331
+ end
332
+
333
+ # A fitted {FMClassifier}.
334
+ class FMClassificationModel < ProbabilisticClassificationModel
335
+ operator "org.apache.spark.ml.classification.FMClassificationModel"
336
+ summary_class -> { FMClassificationTrainingSummary }
337
+
338
+ attribute :intercept, :double
339
+ attribute :linear, :vector
340
+ attribute :factors, :matrix
341
+ method_call :evaluate, arg_count: 1, returns: FMClassificationSummary
342
+ end
343
+
344
+ # Multilayer perceptron classifier (feed-forward network with a softmax output layer).
345
+ class MultilayerPerceptronClassifier < ProbabilisticClassifier
346
+ operator "org.apache.spark.ml.classification.MultilayerPerceptronClassifier"
347
+ model -> { MultilayerPerceptronClassificationModel }
348
+
349
+ param :max_iter, :int, default: 100, doc: "max number of iterations (>= 0)"
350
+ param :tol, :double, default: 1e-6, doc: "convergence tolerance for iterative algorithms (>= 0)"
351
+ param :seed, :long, default: SEED_DEFAULT, doc: "random seed; unset uses a class-derived default on the server"
352
+ param :layers, :int_array, doc: "sizes of the layers from input to output, including input and output (> 1 entries)"
353
+ param :block_size, :int, default: 128, doc: "block size for stacking input data in matrices"
354
+ param :step_size, :double, default: 0.03, doc: "step size for each iteration (> 0)"
355
+ param :solver, :string, default: "l-bfgs", doc: "the optimization solver: l-bfgs or gd"
356
+ param :initial_weights, :vector, doc: "the initial weights of the model"
357
+ end
358
+
359
+ # A fitted {MultilayerPerceptronClassifier}.
360
+ class MultilayerPerceptronClassificationModel < ProbabilisticClassificationModel
361
+ operator "org.apache.spark.ml.classification.MultilayerPerceptronClassificationModel"
362
+ summary_class -> { MultilayerPerceptronClassificationTrainingSummary }
363
+
364
+ attribute :weights, :vector
365
+ method_call :evaluate, arg_count: 1, returns: MultilayerPerceptronClassificationSummary
366
+ end
367
+
368
+ # Decision tree classifier.
369
+ class DecisionTreeClassifier < ProbabilisticClassifier
370
+ include DecisionTreeParams
371
+
372
+ operator "org.apache.spark.ml.classification.DecisionTreeClassifier"
373
+ model -> { DecisionTreeClassificationModel }
374
+
375
+ param :impurity, :string, default: "gini", doc: "criterion used for information gain calculation: gini or entropy"
376
+ param :prune_tree, :boolean, default: true, doc: "whether to collapse unnecessary subtrees after training"
377
+ end
378
+
379
+ # A fitted {DecisionTreeClassifier}.
380
+ class DecisionTreeClassificationModel < ProbabilisticClassificationModel
381
+ include DecisionTreeModelMembers
382
+
383
+ operator "org.apache.spark.ml.classification.DecisionTreeClassificationModel"
384
+
385
+ param :leaf_col, :string, default: "", doc: "leaf indices column name; empty disables the column"
386
+ end
387
+
388
+ # Random forest classifier.
389
+ class RandomForestClassifier < ProbabilisticClassifier
390
+ include TreeEnsembleParams
391
+ include DecisionTreeParams
392
+
393
+ operator "org.apache.spark.ml.classification.RandomForestClassifier"
394
+ model -> { RandomForestClassificationModel }
395
+
396
+ param :impurity, :string, default: "gini", doc: "criterion used for information gain calculation: gini or entropy"
397
+ param :prune_tree, :boolean, default: true, doc: "whether to collapse unnecessary subtrees after training"
398
+ param :num_trees, :int, default: 20, doc: "number of trees to train (>= 1)"
399
+ param :bootstrap, :boolean, default: true, doc: "whether bootstrap samples are used when building trees"
400
+ end
401
+
402
+ # A fitted {RandomForestClassifier}.
403
+ class RandomForestClassificationModel < ProbabilisticClassificationModel
404
+ include TreeEnsembleModelMembers
405
+
406
+ operator "org.apache.spark.ml.classification.RandomForestClassificationModel"
407
+ summary_class -> { RandomForestClassificationTrainingSummary }
408
+
409
+ param :leaf_col, :string, default: "", doc: "leaf indices column name; empty disables the column"
410
+
411
+ method_call :evaluate, arg_count: 1, returns: RandomForestClassificationSummary
412
+ end
413
+
414
+ # Gradient-boosted trees classifier (binary, logistic loss).
415
+ class GBTClassifier < ProbabilisticClassifier
416
+ include TreeEnsembleParams
417
+ include DecisionTreeParams
418
+
419
+ operator "org.apache.spark.ml.classification.GBTClassifier"
420
+ model -> { GBTClassificationModel }
421
+
422
+ param :feature_subset_strategy, :string, default: "all",
423
+ doc: "number of features to consider for splits at each tree node"
424
+ param :impurity, :string, default: "variance", doc: "criterion used for information gain calculation (variance)"
425
+ param :loss_type, :string, default: "logistic", doc: "loss function to be optimized: logistic"
426
+ param :max_iter, :int, default: 20, doc: "max number of iterations (>= 0), i.e. the number of trees"
427
+ param :step_size, :double, default: 0.1, doc: "step size (learning rate) for each iteration (> 0)"
428
+ param :validation_tol, :double, default: 0.01, doc: "threshold for stopping early when fit with validation is used"
429
+ param :validation_indicator_col, :string, doc: "name of the column that marks each row as training (false) or validation (true)"
430
+ end
431
+
432
+ # A fitted {GBTClassifier}.
433
+ class GBTClassificationModel < ProbabilisticClassificationModel
434
+ include TreeEnsembleModelMembers
435
+
436
+ operator "org.apache.spark.ml.classification.GBTClassificationModel"
437
+
438
+ param :leaf_col, :string, default: "", doc: "leaf indices column name; empty disables the column"
439
+
440
+ method_call :evaluate_each_iteration, arg_count: 1, returns: :double_array
441
+ end
442
+ end
443
+ end
444
+ end