Skip to content

Commit ef3ab6c

Browse files
committed
Fix docstrings to improve rendering
1 parent 00be618 commit ef3ab6c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

dataikuapi/dss/ml.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ def set_split_explicit(self, train_selection, test_selection, dataset_name=None,
133133
def set_time_ordering(self, feature_name, ascending=True):
134134
"""
135135
Uses a variable to sort the data for train/test split and hyperparameter optimization by time
136+
136137
:param str feature_name: Name of the variable to use
137138
:param bool ascending: True iff the test set is expected to have larger time values than the train set
138139
"""
@@ -221,13 +222,15 @@ def foreach_feature(self, fn, only_of_type = None):
221222
def reject_feature(self, feature_name):
222223
"""
223224
Marks a feature as rejected and not used for training
225+
224226
:param str feature_name: Name of the feature to reject
225227
"""
226228
self.get_feature_preprocessing(feature_name)["role"] = "REJECT"
227229

228230
def use_feature(self, feature_name):
229231
"""
230232
Marks a feature as input for training
233+
231234
:param str feature_name: Name of the feature to reject
232235
"""
233236
self.get_feature_preprocessing(feature_name)["role"] = "INPUT"
@@ -398,6 +401,7 @@ def strategy(self, strategy):
398401
def set_grid_search(self, shuffle=True, seed=0):
399402
"""
400403
Sets the search strategy to "GRID" to perform a grid-search on the hyperparameters.
404+
401405
:param shuffle: if True, iterate over a shuffled grid as opposed to the lexicographical
402406
iteration over the cartesian product of the hyperparameters.
403407
:type shuffle: bool
@@ -416,6 +420,7 @@ def set_grid_search(self, shuffle=True, seed=0):
416420
def set_random_search(self, seed=0):
417421
"""
418422
Sets the search strategy to "RANDOM" to perform a random search on the hyperparameters.
423+
419424
:param seed: defaults to 0
420425
:type seed: int
421426
"""
@@ -425,6 +430,7 @@ def set_random_search(self, seed=0):
425430
def set_bayesian_search(self, seed=0):
426431
"""
427432
Sets the search strategy to "BAYESIAN" to perform a Bayesian search on the hyperparameters.
433+
428434
:param seed: defaults to 0
429435
:type seed: int
430436
"""
@@ -452,6 +458,7 @@ def set_kfold_validation(self, n_folds=5, stratified=True):
452458
"""
453459
Sets the validation mode to k-fold cross-validation (either "KFOLD" or "TIME_SERIES_KFOLD" if time-based ordering
454460
is enabled).
461+
455462
:param n_folds: the number of folds used for the hyperparameter search, defaults to 5
456463
:type n_folds: int
457464
:param stratified: if True, keep the same proportion of each target classes in all folds, defaults to True
@@ -478,6 +485,7 @@ def set_single_split_validation(self, split_ratio=0.8, stratified=True):
478485
"""
479486
Sets the validation mode to single split (either "SHUFFLE" or "TIME_SERIES_SINGLE_SPLIT" if time-based ordering
480487
is enabled).
488+
481489
:param split_ratio: ratio of the data used for the train during hyperparameter search, defaults to 0.8
482490
:type split_ratio: float
483491
:param stratified: if True, keep the same proportion of each target classes in both splits, defaults to True
@@ -503,6 +511,7 @@ def set_single_split_validation(self, split_ratio=0.8, stratified=True):
503511
def set_custom_validation(self, code=None):
504512
"""
505513
Sets the validation mode to "CUSTOM".
514+
506515
:param code: definition of the validation
507516
:type code: str
508517
"""
@@ -517,6 +526,7 @@ def set_custom_validation(self, code=None):
517526
def set_search_distribution(self, distributed=False, n_containers=4):
518527
"""
519528
Sets the distribution parameters for the hyperparameter search execution.
529+
520530
:param distributed: if True, distribute search in the Kubernetes cluster selected
521531
in the runtime environment's containerized execution configuration, defaults to False
522532
:type distributed: bool
@@ -618,6 +628,7 @@ def definition_mode(self):
618628
"EXPLICIT" means that the hyperparameter search is performed over a given set of values (default for grid search)
619629
"RANGE" means that the hyperparameter search is performed over a range of values (default for random and Bayesian
620630
searches)
631+
621632
:return: str mode: "EXPLICIT" | "RANGE"
622633
"""
623634
if self._algo_settings.strategy == "GRID":
@@ -644,6 +655,7 @@ def set_explicit_values(self, values):
644655
Sets both:
645656
- the explicit values to search over for the current numerical hyperparameter
646657
- the definition mode of the current numerical hyperparameter to "EXPLICIT"
658+
647659
:param values: the explicit list of numerical values considered for this hyperparameter in the search
648660
:type values: list of float | int
649661
"""
@@ -714,6 +726,7 @@ def set_range(self, min=None, max=None, nb_values=None):
714726
Sets both:
715727
- the Range parameters to search over for the current numerical hyperparameter
716728
- the definition mode of the current numerical hyperparameter to "RANGE"
729+
717730
:param min: the lower bound of the Range for this hyperparameter
718731
:type min: float | int
719732
:param max: the upper bound of the Range for this hyperparameter
@@ -800,6 +813,7 @@ def _pretty_repr(self):
800813
def set_values(self, values):
801814
"""
802815
Enables the search over listed values (categories).
816+
803817
:param values: values to enable, all other values will be disabled
804818
:type values: list of str
805819
"""
@@ -2429,6 +2443,7 @@ def get_modeling_settings(self):
24292443
def get_actual_modeling_params(self):
24302444
"""
24312445
Gets the actual / resolved parameters that were used to train this model.
2446+
24322447
:return: A dictionary, which contains at least a "resolved" key
24332448
:rtype: dict
24342449
"""
@@ -2754,6 +2769,7 @@ def remove_all_splits(self):
27542769
def guess(self, prediction_type=None, reguess_level=None):
27552770
"""
27562771
Guess the feature handling and the algorithms.
2772+
27572773
:param string prediction_type: In case of a prediction problem the prediction type can be specify. Valid values are BINARY_CLASSIFICATION, REGRESSION, MULTICLASS.
27582774
:param bool reguess_level: One of the following values: TARGET_CHANGE, TARGET_REGUESS and FULL_REGUESS. Only valid for prediction ML Tasks, cannot be specified if prediction_type is also set.
27592775
"""

0 commit comments

Comments
 (0)