@@ -389,25 +389,30 @@ def _set_seed(self, seed):
389389 def strategy (self ):
390390 """
391391 :return: strategy: "GRID" | "RANDOM" | "BAYESIAN"
392- :rtype str
392+ :rtype: str
393393 """
394394 return self ._raw_settings ["strategy" ]
395395
396396 @strategy .setter
397397 def strategy (self , strategy ):
398398 """
399- :param str strategy: "GRID" | "RANDOM" | "BAYESIAN"
399+ :param strategy: "GRID" | "RANDOM" | "BAYESIAN"
400+ :type strategy: str
400401 """
401402 assert strategy in {"GRID" , "RANDOM" , "BAYESIAN" }
402403 self ._raw_settings ["strategy" ] = strategy
403404
404405 def set_grid_search (self , shuffle = True , seed = 0 ):
405406 """
406407 Sets the search strategy to "GRID" to perform a grid-search on the hyperparameters.
407- :param bool shuffle: if True, the search will iterate over a shuffled grid as opposed to the lexicographical
408+ :param shuffle: if True, iterate over a shuffled grid as opposed to the lexicographical
408409 iteration over the cartesian product of the hyperparameters.
409- :param int seed:
410- :return current HyperparameterSearchSettings
410+ :type shuffle: bool
411+ :param seed:
412+ :type seed: int
413+ :return: current (mutated) settings
414+ :rtype: HyperparameterSearchSettings
415+
411416 """
412417 self ._raw_settings ["strategy" ] = "GRID"
413418 if shuffle is not None :
@@ -422,8 +427,10 @@ def set_grid_search(self, shuffle=True, seed=0):
422427 def set_random_search (self , seed = 0 ):
423428 """
424429 Sets the search strategy to "RANDOM" to perform a random search on the hyperparameters.
425- :param int seed:
426- :return current HyperparameterSearchSettings
430+ :param seed:
431+ :type seed: int
432+ :return: current (mutated) settings
433+ :rtype: HyperparameterSearchSettings
427434 """
428435 self ._raw_settings ["strategy" ] = "RANDOM"
429436 self ._set_seed (seed )
@@ -432,8 +439,10 @@ def set_random_search(self, seed=0):
432439 def set_bayesian_search (self , seed = 0 ):
433440 """
434441 Sets the search strategy to "BAYESIAN" to perform a Bayesian search on the hyperparameters.
435- :param int seed:
436- :return current HyperparameterSearchSettings
442+ :param seed:
443+ :type seed: int
444+ :return: current (mutated) settings
445+ :rtype: HyperparameterSearchSettings
437446 """
438447 self ._raw_settings ["strategy" ] = "BAYESIAN"
439448 self ._set_seed (seed )
@@ -442,15 +451,16 @@ def set_bayesian_search(self, seed=0):
442451 @property
443452 def validation_mode (self ):
444453 """
445- :return mode: "KFOLD" | "SHUFFLE" | "TIME_SERIES_KFOLD" | "TIME_SERIES_SINGLE_SPLIT" | "CUSTOM"
446- :rtype str
454+ :return: mode: "KFOLD" | "SHUFFLE" | "TIME_SERIES_KFOLD" | "TIME_SERIES_SINGLE_SPLIT" | "CUSTOM"
455+ :rtype: str
447456 """
448457 return self ._raw_settings ["mode" ]
449458
450459 @validation_mode .setter
451460 def validation_mode (self , mode ):
452461 """
453- :param str mode: "KFOLD" | "SHUFFLE" | "TIME_SERIES_KFOLD" | "TIME_SERIES_SINGLE_SPLIT" | "CUSTOM"
462+ :param mode: "KFOLD" | "SHUFFLE" | "TIME_SERIES_KFOLD" | "TIME_SERIES_SINGLE_SPLIT" | "CUSTOM"
463+ :type mode: str
454464 """
455465 assert mode in {"KFOLD" , "SHUFFLE" , "TIME_SERIES_KFOLD" , "TIME_SERIES_SINGLE_SPLIT" , "CUSTOM" }
456466 self ._raw_settings ["mode" ] = mode
@@ -459,9 +469,12 @@ def set_kfold_validation(self, n_folds=5, stratified=True):
459469 """
460470 Sets the validation mode to k-fold cross-validation (either "KFOLD" or "TIME_SERIES_KFOLD" if time-based ordering
461471 is enabled).
462- :param int n_folds: the number of folds used for the hyperparameter search
463- :param bool stratified: if True, will keep the same proportion of each target classes in all folds
464- :return current HyperparameterSearchSettings
472+ :param n_folds: the number of folds used for the hyperparameter search
473+ :type n_folds: int
474+ :param stratified: if True, keep the same proportion of each target classes in all folds
475+ :type stratified: bool
476+ :return: current (mutated) settings
477+ :rtype: HyperparameterSearchSettings
465478 """
466479 if self ._raw_settings ["mode" ] == "TIME_SERIES_SINGLE_SPLIT" :
467480 self ._raw_settings ["mode" ] = "TIME_SERIES_KFOLD"
@@ -485,9 +498,12 @@ def set_single_split_validation(self, split_ratio=0.8, stratified=True):
485498 """
486499 Sets the validation mode to single split (either "SHUFFLE" or "TIME_SERIES_SINGLE_SPLIT" if time-based ordering
487500 is enabled).
488- :param float split_ratio: ratio of the data used for the train during hyperparameter search
489- :param bool stratified: if True, will keep the same proportion of each target classes in both splits
490- :return current HyperparameterSearchSettings
501+ :param split_ratio: ratio of the data used for the train during hyperparameter search
502+ :type split_ratio: float
503+ :param stratified: if True, keep the same proportion of each target classes in both splits
504+ :type stratified: bool
505+ :return: current (mutated) settings
506+ :rtype: HyperparameterSearchSettings
491507 """
492508 if self ._raw_settings ["mode" ] == "TIME_SERIES_KFOLD" :
493509 self ._raw_settings ["mode" ] = "TIME_SERIES_SINGLE_SPLIT"
@@ -510,8 +526,10 @@ def set_single_split_validation(self, split_ratio=0.8, stratified=True):
510526 def set_custom_validation (self , code = None ):
511527 """
512528 Sets the validation mode to "CUSTOM".
513- :param str code: definition of the validation
514- :return current HyperparameterSearchSettings
529+ :param code: definition of the validation
530+ :type code: str
531+ :return: current (mutated) settings
532+ :rtype: HyperparameterSearchSettings
515533 """
516534 self ._raw_settings ["mode" ] = "CUSTOM"
517535 if code is not None :
@@ -525,10 +543,13 @@ def set_custom_validation(self, code=None):
525543 def set_search_distribution (self , distributed = False , n_containers = 4 ):
526544 """
527545 Sets the distribution parameters for the hyperparameter search execution.
528- :param bool distributed: if True, search will be distributed across n_containers containers in the Kubernetes
546+ :param distributed: if True, distribute search across n_containers containers in the Kubernetes
529547 cluster selected in containerized execution configuration of the runtime environment
530- :param int n_containers:
531- :return current HyperparameterSearchSettings
548+ :type distributed: bool
549+ :param n_containers:
550+ :type n_containers: int
551+ :return: current (mutated) settings
552+ :rtype: HyperparameterSearchSettings
532553 """
533554 assert isinstance (distributed , bool )
534555 if n_containers is not None :
@@ -637,7 +658,8 @@ def definition_mode(self):
637658 @definition_mode .setter
638659 def definition_mode (self , mode ):
639660 """
640- :param str mode: "EXPLICIT" | "RANGE"
661+ :param mode: "EXPLICIT" | "RANGE"
662+ :type mode: str
641663 """
642664 assert mode in ["EXPLICIT" , "RANGE" ], "Hyperparameter definition mode must be either \" EXPLICIT\" or \" RANGE\" "
643665 if self ._algo_settings .strategy == "GRID" :
@@ -651,8 +673,10 @@ def set_explicit_values(self, values):
651673 Sets both:
652674 - the explicit values to search over for the current numerical hyperparameter
653675 - the definition mode of the current numerical hyperparameter to "EXPLICIT"
654- :param list values: the explicit list of numerical values that will be searched for this hyperparameter
655- :return current NumericalHyperparameterSettings
676+ :param values: the explicit list of numerical values considered for this hyperparameter in the search
677+ :type values: list of float | int
678+ :return: current (mutated) settings
679+ :rtype: NumericalHyperparameterSettings
656680 """
657681 self .values = values
658682 self .definition_mode = "EXPLICIT"
@@ -661,15 +685,16 @@ def set_explicit_values(self, values):
661685 @property
662686 def values (self ):
663687 """
664- :return: the explicit list of numerical values that will be searched for this hyperparameter
688+ :return: the explicit list of numerical values considered for this hyperparameter in the search
665689 :rtype: list
666690 """
667691 return self ._algo_settings [self .name ]["values" ]
668692
669693 @values .setter
670694 def values (self , values ):
671695 """
672- :param list values: the explicit list of numerical values that will be searched for this hyperparameter
696+ :param values: the explicit list of numerical values considered for this hyperparameter in the search
697+ :type values: list of float | int
673698 """
674699 error_message = "Invalid values input type for hyperparameter " \
675700 "\" {}\" : " .format (self .name ) + \
@@ -721,10 +746,14 @@ def set_range(self, min=None, max=None, nb_values=None):
721746 Sets both:
722747 - the Range parameters to search over for the current numerical hyperparameter
723748 - the definition mode of the current numerical hyperparameter to "RANGE"
724- :param min: the lower bound of the Range that will be searched for this hyperparameter
725- :param max: the upper bound of the Range that will be searched for this hyperparameter
749+ :param min: the lower bound of the Range for this hyperparameter
750+ :type min: float | int
751+ :param max: the upper bound of the Range for this hyperparameter
752+ :type max: float | int
726753 :param nb_values: for grid-search ("GRID" strategy) only, the number of values between min and max to consider
727- :return current NumericalHyperparameterSettings
754+ :type nb_values: int
755+ :return: current (mutated) settings
756+ :rtype: NumericalHyperparameterSettings
728757 """
729758 self ._set_range (min = min , max = max , nb_values = nb_values )
730759 self .definition_mode = "RANGE"
@@ -747,44 +776,50 @@ def __repr__(self):
747776 @property
748777 def min (self ):
749778 """
779+ :return: the lower bound of the Range for this hyperparameter
750780 :rtype: float | int
751781 """
752782 return self ._range_dict ["min" ]
753783
754784 @min .setter
755- def min (self , val ):
785+ def min (self , value ):
756786 """
757- :param float | int val: the lower bound of the Range that will be searched for this hyperparameter
787+ :param value: the lower bound of the Range this hyperparameter
788+ :type value: float | int
758789 """
759- self ._numerical_hyperparameter_settings ._set_range (min = val )
790+ self ._numerical_hyperparameter_settings ._set_range (min = value )
760791
761792 @property
762793 def max (self ):
763794 """
795+ :return: the upper bound of the Range this hyperparameter
764796 :rtype: float | int
765797 """
766798 return self ._range_dict ["max" ]
767799
768800 @max .setter
769- def max (self , val ):
801+ def max (self , value ):
770802 """
771- :param float | int val: the upper bound of the Range that will be searched for this hyperparameter
803+ :param value: the upper bound of the Range for this hyperparameter
804+ :type value: float | int
772805 """
773- self ._numerical_hyperparameter_settings ._set_range (max = val )
806+ self ._numerical_hyperparameter_settings ._set_range (max = value )
774807
775808 @property
776809 def nb_values (self ):
777810 """
811+ :return: for grid-search ("GRID" strategy) only, the number of values between min and max to consider
778812 :rtype: int
779813 """
780814 return self ._range_dict ["nbValues" ]
781815
782816 @nb_values .setter
783- def nb_values (self , val ):
817+ def nb_values (self , value ):
784818 """
785- :param int val: for grid-search ("GRID" strategy) only, the number of values between min and max to consider
819+ :param value: for grid-search ("GRID" strategy) only, the number of values between min and max to consider
820+ :type value: int
786821 """
787- self ._numerical_hyperparameter_settings ._set_range (nb_values = val )
822+ self ._numerical_hyperparameter_settings ._set_range (nb_values = value )
788823
789824
790825class CategoricalHyperparameterSettings (HyperparameterSettings ):
@@ -800,9 +835,10 @@ def _pretty_repr(self):
800835 def set_values (self , values ):
801836 """
802837 Enables the search over listed values (categories).
803- :param values: enable the search over the provided categories and disable the search over non-provided categories
838+ :param values: values to enable, all other values will be disabled
804839 :type values: list of str
805- :return: current CategoricalHyperparameterSettings
840+ :return: current (mutated) settings
841+ :rtype: CategoricalHyperparameterSettings
806842 """
807843 all_possible_values = self .get_all_possible_values ()
808844 for category in values :
@@ -851,7 +887,8 @@ def set_value(self, value):
851887 """
852888 :param value:
853889 :type value: bool | int | float
854- :return: current SingleValueHyperparameterSettings
890+ :return: current (mutated) settings
891+ :rtype: SingleValueHyperparameterSettings
855892 """
856893 if self .accepted_types is not None :
857894 assert any (isinstance (value , accepted_type ) for accepted_type in self .accepted_types ), "Invalid type for hyperparameter {}. Type must be one of: {}" .format (self .name , self .accepted_types )
@@ -894,7 +931,8 @@ def set_value(self, value):
894931 """
895932 :param value:
896933 :type value: str
897- :return: current SingleValueHyperparameterSettings
934+ :return: current (mutated) settings
935+ :rtype: SingleValueHyperparameterSettings
898936 """
899937 if self .accepted_values is not None :
900938 assert value in self .accepted_values , "Invalid value for hyperparameter {}. Must be in {}" .format (self .name , json .dumps (self .accepted_values ))
@@ -969,7 +1007,8 @@ def enabled(self):
9691007 @enabled .setter
9701008 def enabled (self , enabled ):
9711009 """
972- :param bool enabled:
1010+ :param enabled:
1011+ :type enabled: bool
9731012 """
9741013 assert isinstance (enabled , bool ), "enabled property must be a boolean"
9751014 self ["enabled" ] = enabled
@@ -1303,10 +1342,10 @@ def get_algorithm_settings(self, algorithm_name):
13031342
13041343 Please refer to the documentation for details on available algorithms.
13051344
1306- :param str algorithm_name: Name (in capitals) of the algorithm.
1307- :return: A PredictionAlgorithmSettings (extended dict) for a single built-in prediction algorithm,
1308- or a plain dict for the settings of custom inline-code (CUSTOM_*) or plugin (PLUGIN_*) algorithms.
1309- :rtype: PredictionAlgorithmSettings | dict
1345+ :param algorithm_name: Name (in capitals) of the algorithm.
1346+ :type algorithm_name: str
1347+ :return: A PredictionAlgorithmSettings (extended dict) for a single built-in prediction algorithm
1348+ :rtype: PredictionAlgorithmSettings
13101349 """
13111350 if algorithm_name in ["CUSTOM_MLLIB" , "CUSTOM_PYTHON" , "PLUGIN_PYTHON" ]:
13121351 return self .mltask_settings ["modeling" ][algorithm_name .lower ()]
@@ -1455,7 +1494,8 @@ def get_algorithm_settings(self, algorithm_name):
14551494
14561495 Please refer to the documentation for details on available algorithms.
14571496
1458- :param str algorithm_name: Name (in capitals) of the algorithm.
1497+ :param: algorithm_name: Name (in capitals) of the algorithm.
1498+ :type: algorithm_name: str
14591499 :return: A dict of the settings for an algorithm
14601500 :rtype: dict
14611501 """
0 commit comments