コード例 #1
0
 def __init__(
     self,
     base_estimator=None,
     n_estimators=10,
     max_samples=1.0,
     max_features=1.0,
     bootstrap=True,
     bootstrap_features=False,
     oob_score=False,
     warm_start=False,
     n_jobs=None,
     random_state=None,
     verbose=0,
 ):
     self._hyperparams = {
         "base_estimator": make_sklearn_compat(base_estimator),
         "n_estimators": n_estimators,
         "max_samples": max_samples,
         "max_features": max_features,
         "bootstrap": bootstrap,
         "bootstrap_features": bootstrap_features,
         "oob_score": oob_score,
         "warm_start": warm_start,
         "n_jobs": n_jobs,
         "random_state": random_state,
         "verbose": verbose,
     }
     self._wrapped_model = SKLModel(**self._hyperparams)
コード例 #2
0
 def __init__(self,
              base_estimator=None,
              n_estimators=10,
              max_samples=1.0,
              max_features=1.0,
              bootstrap=True,
              bootstrap_features=False,
              oob_score=False,
              warm_start=False,
              n_jobs=None,
              random_state=None,
              verbose=0):
     self._hyperparams = {
         'base_estimator': make_sklearn_compat(base_estimator),
         'n_estimators': n_estimators,
         'max_samples': max_samples,
         'max_features': max_features,
         'bootstrap': bootstrap,
         'bootstrap_features': bootstrap_features,
         'oob_score': oob_score,
         'warm_start': warm_start,
         'n_jobs': n_jobs,
         'random_state': random_state,
         'verbose': verbose
     }
     self._wrapped_model = SKLModel(**self._hyperparams)
コード例 #3
0
 def __init__(
     self,
     base_estimator=None,
     n_estimators=50,
     learning_rate=1.0,
     algorithm="SAMME.R",
     random_state=None,
 ):
     estimator_impl = base_estimator
     if isinstance(estimator_impl, lale.operators.Operator):
         if isinstance(estimator_impl, lale.operators.IndividualOp):
             estimator_impl = estimator_impl._impl_instance()
             wrapped_model = getattr(estimator_impl, "_wrapped_model", None)
             if wrapped_model is not None:
                 estimator_impl = wrapped_model
         else:
             raise ValueError(
                 "If base_estimator is a Lale operator, it needs to be an individual operator. "
             )
     self._hyperparams = {
         "base_estimator": estimator_impl,
         "n_estimators": n_estimators,
         "learning_rate": learning_rate,
         "algorithm": algorithm,
         "random_state": random_state,
     }
     self._wrapped_model = SKLModel(**self._hyperparams)
     self._hyperparams["base_estimator"] = base_estimator
コード例 #4
0
 def __init__(
     self,
     base_estimator=None,
     n_estimators=50,
     learning_rate=1.0,
     loss="linear",
     random_state=None,
 ):
     if isinstance(base_estimator, lale.operators.Operator):
         if isinstance(base_estimator, lale.operators.IndividualOp):
             base_estimator = base_estimator._impl_instance()
             wrapped_model = getattr(base_estimator, "_wrapped_model", None)
             if wrapped_model is not None:
                 base_estimator = wrapped_model
         else:
             raise ValueError(
                 "If base_estimator is a Lale operator, it needs to be an individual operator. "
             )
     self._hyperparams = {
         "base_estimator": base_estimator,
         "n_estimators": n_estimators,
         "learning_rate": learning_rate,
         "loss": loss,
         "random_state": random_state,
     }
     self._wrapped_model = SKLModel(**self._hyperparams)
コード例 #5
0
ファイル: bagging_regressor.py プロジェクト: hirzel/lale
    def fit(self, X, y, sample_weight=None):
        if isinstance(X, pd.DataFrame):
            feature_transformer = FunctionTransformer(
                func=lambda X_prime: pd.DataFrame(X_prime, columns=X.columns),
                inverse_func=None,
                check_inverse=False,
            )
            self._hyperparams["base_estimator"] = (
                feature_transformer >> self._hyperparams["base_estimator"])
            self._wrapped_model = SKLModel(**self._hyperparams)
        self._wrapped_model.fit(X, y, sample_weight)

        return self
コード例 #6
0
 def __init__(self, base_estimator=None, n_estimators=50, learning_rate=1.0, algorithm='SAMME.R', random_state=None):
     if isinstance(base_estimator, lale.operators.Operator):
         if isinstance(base_estimator, lale.operators.IndividualOp):
             base_estimator = base_estimator._impl_instance()._wrapped_model
         else:
             raise ValueError("If base_estimator is a Lale operator, it needs to be an individual operator. ")
     self._hyperparams = {
         'base_estimator': base_estimator,
         'n_estimators': n_estimators,
         'learning_rate': learning_rate,
         'algorithm': algorithm,
         'random_state': random_state}
     self._wrapped_model = SKLModel(**self._hyperparams)
コード例 #7
0
 def __init__(self,
              estimators=None,
              voting='hard',
              weights=None,
              n_jobs=None,
              flatten_transform=True):
     self._hyperparams = {
         'estimators': estimators,
         'voting': voting,
         'weights': weights,
         'n_jobs': n_jobs,
         'flatten_transform': flatten_transform
     }
     self._wrapped_model = SKLModel(**self._hyperparams)
コード例 #8
0
ファイル: ada_boost_classifier.py プロジェクト: shinnar/lale
 def fit(self, X, y=None):
     if isinstance(X, pd.DataFrame):
         feature_transformer = FunctionTransformer(
             func=lambda X_prime: pd.DataFrame(X_prime, columns=X.columns),
             inverse_func=None,
             check_inverse=False,
         )
         self._hyperparams["base_estimator"] = _FitSpecProxy(
             feature_transformer >> self._hyperparams["base_estimator"])
         self._wrapped_model = SKLModel(**self._hyperparams)
     if y is not None:
         self._wrapped_model.fit(X, y)
     else:
         self._wrapped_model.fit(X)
     return self
コード例 #9
0
ファイル: ada_boost_classifier.py プロジェクト: shinnar/lale
    def __init__(
        self,
        base_estimator=None,
        *,
        n_estimators=50,
        learning_rate=1.0,
        algorithm="SAMME.R",
        random_state=None,
    ):
        if base_estimator is None:
            estimator_impl = None
        else:
            estimator_impl = _FitSpecProxy(base_estimator)

        self._hyperparams = {
            "base_estimator": estimator_impl,
            "n_estimators": n_estimators,
            "learning_rate": learning_rate,
            "algorithm": algorithm,
            "random_state": random_state,
        }
        self._wrapped_model = SKLModel(**self._hyperparams)
        self._hyperparams["base_estimator"] = base_estimator