def __init__(self, wrapped, hashers: List[BaseHasher] = None, cache_folder_when_no_handle=None): MetaStep.__init__(self, wrapped, hashers=hashers) ForceHandleOnlyMixin.__init__(self, cache_folder_when_no_handle) _DidProcessInputOutputHandlerMixin.__init__(self)
def __init__(self, hyperparameter_optimizer: BaseHyperparameterOptimizer, higher_score_is_better=True, cache_folder_when_no_handle=None): MetaStep.__init__(self, None) ForceHandleOnlyMixin.__init__(self, cache_folder_when_no_handle) self.higher_score_is_better = higher_score_is_better self.hyperparameter_optimizer = hyperparameter_optimizer
def __init__(self, wrapped, from_data_inputs=False, cache_folder_when_no_handle=None): BaseStep.__init__(self) MetaStepMixin.__init__(self, wrapped) ForceHandleOnlyMixin.__init__(self, cache_folder_when_no_handle) self.from_data_inputs = from_data_inputs
def __init__(self, handle_fit_callback, handle_transform_callback, handle_fit_transform_callback): BaseStep.__init__(self) ForceHandleOnlyMixin.__init__(self) self.handle_fit_callback = handle_fit_callback self.handle_fit_transform_callback = handle_fit_transform_callback self.handle_transform_callback = handle_transform_callback
def __init__(self, wrapped, epochs, fit_only=False, repeat_in_test_mode=False, cache_folder_when_no_handle=None): BaseStep.__init__(self) MetaStepMixin.__init__(self, wrapped) ForceHandleOnlyMixin.__init__(self, cache_folder=cache_folder_when_no_handle) self.repeat_in_test_mode = repeat_in_test_mode self.fit_only = fit_only self.epochs = epochs
def __init__(self, wrapped: BaseStep, is_train_only=True, cache_folder_when_no_handle=None): MetaStep.__init__(self, wrapped=wrapped) ForceHandleOnlyMixin.__init__(self, cache_folder=cache_folder_when_no_handle) self.is_train_only = is_train_only
def __init__(self, wrapped=None, scoring_function=r2_score, joiner=NumpyConcatenateOuterBatch(), cache_folder_when_no_handle=None, split_data_container_during_fit=True, predict_after_fit=True): BaseValidation.__init__(self, wrapped=wrapped, scoring_function=scoring_function) ForceHandleOnlyMixin.__init__(self, cache_folder=cache_folder_when_no_handle) EvaluableStepMixin.__init__(self) self.split_data_container_during_fit = split_data_container_during_fit self.predict_after_fit = predict_after_fit self.joiner = joiner
def __init__(self, scoring_function=r2_score, joiner=NumpyConcatenateOuterBatch(), cache_folder_when_no_handle=None): BaseValidation.__init__(self, scoring_function) ForceHandleOnlyMixin.__init__(self, cache_folder=cache_folder_when_no_handle) EvaluableStepMixin.__init__(self) self.joiner = joiner
def __init__( self, pipeline: BaseStep, validation_splitter: 'BaseValidationSplitter', refit_trial: bool, scoring_callback: ScoringCallback, hyperparams_optimizer: BaseHyperparameterSelectionStrategy = None, hyperparams_repository: HyperparamsRepository = None, n_trials: int = 10, epochs: int = 1, callbacks: List[BaseCallback] = None, refit_scoring_function: Callable = None, print_func: Callable = None, cache_folder_when_no_handle=None): BaseStep.__init__(self) ForceHandleOnlyMixin.__init__(self, cache_folder=cache_folder_when_no_handle) self.validation_split_function: BaseValidationSplitter = validation_splitter if print_func is None: print_func = print if hyperparams_optimizer is None: hyperparams_optimizer = RandomSearchHyperparameterSelectionStrategy( ) self.hyperparameter_optimizer: BaseHyperparameterSelectionStrategy = hyperparams_optimizer if hyperparams_repository is None: hyperparams_repository = HyperparamsJSONRepository( hyperparams_optimizer, cache_folder_when_no_handle) else: hyperparams_repository.set_strategy(hyperparams_optimizer) self.hyperparams_repository: HyperparamsJSONRepository = hyperparams_repository self.pipeline: BaseStep = pipeline self.print_func: Callable = print_func self.n_trial: int = n_trials self.hyperparams_repository: HyperparamsRepository = hyperparams_repository self.refit_scoring_function: Callable = refit_scoring_function if callbacks is None: callbacks = [] callbacks: List[BaseCallback] = [scoring_callback] + callbacks self.refit_trial: bool = refit_trial self.trainer = Trainer(callbacks=callbacks, epochs=epochs, print_func=self.print_func)
def __init__(self, wrapped: BaseTransformer, copy_op=copy.deepcopy, cache_folder_when_no_handle=None): MetaStep.__init__(self, wrapped=wrapped) ForceHandleOnlyMixin.__init__(self, cache_folder_when_no_handle) self.savers.append(TruncableJoblibStepSaver()) self.set_step(wrapped) self.steps_as_tuple: List[NamedTupleList] = [] self.copy_op = copy_op
def __init__(self, wrapped: BaseStep, copy_op=copy.deepcopy, cache_folder_when_no_handle=None): BaseStep.__init__(self) MetaStepMixin.__init__(self, wrapped) ForceHandleOnlyMixin.__init__(self, cache_folder_when_no_handle) self.set_step(wrapped) self.steps: List[BaseStep] = [] self.copy_op = copy_op
def __init__(self, wrapped: BaseStep, enabled: bool = True, nullified_return_value=None, cache_folder_when_no_handle=None): BaseStep.__init__(self, hyperparams=HyperparameterSamples( {OPTIONAL_ENABLED_HYPERPARAM: enabled})) MetaStepMixin.__init__(self, wrapped) ForceHandleOnlyMixin.__init__(self, cache_folder_when_no_handle) if nullified_return_value is None: nullified_return_value = [] self.nullified_return_value = nullified_return_value
def __init__(self, steps_as_tuple: NamedTupleList, joiner: NonFittableMixin = NumpyConcatenateInnerFeatures(), n_jobs: int = None, backend: str = "threading", cache_folder_when_no_handle: str = None): """ Create a feature union. :param steps_as_tuple: the NamedTupleList of steps to process in parallel and to join. :param joiner: What will be used to join the features. For example, ``NumpyConcatenateInnerFeatures()``. :param n_jobs: The number of jobs for the parallelized ``joblib.Parallel`` loop in fit and in transform. :param backend: The type of parallelization to do with ``joblib.Parallel``. Possible values: "loky", "multiprocessing", "threading", "dask" if you use dask, and more. """ steps_as_tuple.append(('joiner', joiner)) TruncableSteps.__init__(self, steps_as_tuple) self.n_jobs = n_jobs self.backend = backend ForceHandleOnlyMixin.__init__(self, cache_folder=cache_folder_when_no_handle)
def __init__(self, wrapped: BaseTransformer, enabled: bool = True, nullified_return_value=None, cache_folder_when_no_handle=None, use_hyperparameter_space=True, nullify_hyperparams=True): hyperparameter_space = HyperparameterSpace({ OPTIONAL_ENABLED_HYPERPARAM: Boolean() }) if use_hyperparameter_space else {} MetaStep.__init__( self, hyperparams=HyperparameterSamples({ OPTIONAL_ENABLED_HYPERPARAM: enabled }), hyperparams_space=hyperparameter_space, wrapped=wrapped ) ForceHandleOnlyMixin.__init__(self, cache_folder_when_no_handle) if nullified_return_value is None: nullified_return_value = [] self.nullified_return_value = nullified_return_value self.nullify_hyperparams = nullify_hyperparams
def __init__(self, wrapped: BaseStep, auto_ml_algorithm: AutoMLAlgorithm, hyperparams_repository: HyperparamsRepository = None, n_iters: int = 100, refit=True, cache_folder_when_no_handle=None): if not isinstance(wrapped, EvaluableStepMixin): raise ValueError( 'AutoML algorithm needs evaluable steps that implement the function get_score. Please use a validation technique, or implement EvaluableStepMixin.' ) MetaStep.__init__(self, auto_ml_algorithm.set_step(wrapped)) ForceHandleOnlyMixin.__init__(self, cache_folder_when_no_handle) if hyperparams_repository is None: hyperparams_repository = InMemoryHyperparamsRepository() self.hyperparams_repository = hyperparams_repository self.n_iters = n_iters self.refit = refit
def __init__(self, wrapped: BaseStep = None, test_size: float = 0.2, scoring_function=r2_score, run_validation_split_in_test_mode=True, metrics_already_enabled=True, cache_folder_when_no_handle=None): """ :param wrapped: wrapped step :param test_size: ratio for test size between 0 and 1 :param scoring_function: scoring function with two arguments (y_true, y_pred) """ BaseStep.__init__(self) MetaStepMixin.__init__(self, wrapped) ForceHandleOnlyMixin.__init__(self, cache_folder_when_no_handle) EvaluableStepMixin.__init__(self) self.run_validation_split_in_test_mode = run_validation_split_in_test_mode self.test_size = test_size self.scoring_function = scoring_function self.metrics_enabled = metrics_already_enabled
def __init__(self, wrapped, cache_folder_when_no_handle=None): MetaStep.__init__(self, wrapped) ForceHandleOnlyMixin.__init__(self, cache_folder_when_no_handle)
def __init__(self, sub_data_container_names=None): BaseTransformer.__init__(self) ForceHandleOnlyMixin.__init__(self) self.data_sources = sub_data_container_names