Browse Source

removing typing

ogert 3 years ago
parent
commit
8944ccda7e

+ 11 - 7
cdplib/hyperopt/HyperoptPipelineSelector.py

@@ -37,8 +37,8 @@ if (sys.version_info.major == 3) & (sys.version_info.minor >= 8):
     Literal, Dict, List, Union
 else:
     # from typing_extensions import *
-    from typing_extensions import Callable, Optional,\
-    Literal
+    # from typing_extensions import Callable, Optional,\
+    # Literal
 
 from cdplib.log import Log
 
@@ -65,14 +65,17 @@ class HyperoptPipelineSelector(PipelineSelector):
                  cost_func,
                  greater_is_better: bool,
                  trials_path: str,
-                 backup_trials_freq: Optional[int] = None,
+                #  backup_trials_freq: Optional[int] = None,
+                 backup_trials_freq = None,
                  cross_validation_needs_scorer: bool = True,
                  cross_val_averaging_func: Callable = np.mean,
                 #  additional_metrics: Optional[Dict[str, Callable]] = None,
                 additional_metrics = None,
-                 strategy_name: Optional[str] = None,
-                 stdout_log_level: Literal["INFO", "WARNING", "ERROR"]
-                 = "INFO"):
+                #  strategy_name: Optional[str] = None,
+                 strategy_name = None,
+                #  stdout_log_level: Literal["INFO", "WARNING", "ERROR"]
+                #  = "INFO")
+                 stdout_log_level = "INFO"):
         """
         param Callable cost_func: function to minimize or maximize
             over the elements of a given (pipeline/hyperparameter) space
@@ -131,7 +134,8 @@ class HyperoptPipelineSelector(PipelineSelector):
 
     def run_trials(self,
                    niter: int,
-                   algo: Literal[tpe.suggest, rand.suggest] = tpe.suggest)\
+                #    algo: Literal[tpe.suggest, rand.suggest] = tpe.suggest)\
+                   algo = tpe.suggest)\
             -> None:
         '''
         Method performing the search of the best pipeline in the given space.

+ 5 - 4
cdplib/pipeline_selector/PipelineSelector.py

@@ -33,8 +33,8 @@ if (sys.version_info.major == 3) & (sys.version_info.minor >= 8):
 else:
     # from typing_extensions import *
     print("I have python version {}.{} and will import typing_extensions".format(sys.version_info.major, sys.version_info.minor))
-    from typing_extensions import Callable, TypedDict,\
-    Literal
+    from typing_extensions import Callable, TypedDict
+    
 
 import functools
 from sklearn.pipeline import Pipeline
@@ -85,8 +85,9 @@ class PipelineSelector(ABC):
                 #  additional_averaging_funcs: Dict[str, Callable] = None,
                  additional_averaging_funcs = None,
                  strategy_name: str = None,
-                 stdout_log_level: Literal["INFO", "WARNING", "ERROR"]
-                 = "INFO"):
+                #  stdout_log_level: Literal["INFO", "WARNING", "ERROR"]
+                #  = "INFO")
+                stdout_log_level = "INFO"):
         """
         :param Callable cost_func: function to minimize or maximize
             over the elements of a given (pipeline/hyperparameter) space