def test_with_hyperopt(self): from lale.lib.lale import Hyperopt from lale.lib.sklearn import VotingClassifier clf = VotingClassifier( estimators=[("knn", KNeighborsClassifier()), ("lr", LogisticRegression())] ) _ = clf.auto_configure(self.X_train, self.y_train, Hyperopt, max_evals=1)
def test_with_hyperopt(self): planned = VotingClassifier( estimators=[("lr", LogisticRegression), ("dt", DecisionTreeClassifier)] ) trained = planned.auto_configure( self.train_X, self.train_y, optimizer=Hyperopt, cv=3, max_evals=3 ) _ = trained.predict(self.test_X)
def test_with_gridsearch(self): from sklearn.metrics import accuracy_score, make_scorer from lale.lib.lale import GridSearchCV from lale.lib.sklearn import VotingClassifier clf = VotingClassifier( estimators=[("knn", KNeighborsClassifier()), ("rc", RidgeClassifier())], voting="hard", ) _ = clf.auto_configure( self.X_train, self.y_train, GridSearchCV, lale_num_samples=1, lale_num_grids=1, cv=2, scoring=make_scorer(accuracy_score), )