def test_fit1(self): import warnings warnings.filterwarnings(action="ignore") from lale.lib.sklearn import MinMaxScaler, MLPClassifier pipeline = Batching( operator=MinMaxScaler() >> MLPClassifier(random_state=42), batch_size=112) trained = pipeline.fit(self.X_train, self.y_train) predictions = trained.predict(self.X_test) lale_accuracy = accuracy_score(self.y_test, predictions) from sklearn.preprocessing import MinMaxScaler from sklearn.neural_network import MLPClassifier prep = MinMaxScaler() trained_prep = prep.partial_fit(self.X_train, self.y_train) X_transformed = trained_prep.transform(self.X_train) clf = MLPClassifier(random_state=42) import numpy as np trained_clf = clf.partial_fit(X_transformed, self.y_train, classes=np.unique(self.y_train)) predictions = trained_clf.predict(trained_prep.transform(self.X_test)) sklearn_accuracy = accuracy_score(self.y_test, predictions) self.assertEqual(lale_accuracy, sklearn_accuracy)
def test_predict_proba(self): trainable = MLPClassifier() iris = sklearn.datasets.load_iris() trained = trainable.fit(iris.data, iris.target) # with self.assertWarns(DeprecationWarning): predicted = trainable.predict_proba(iris.data) predicted = trained.predict_proba(iris.data)
def test_with_hyperopt(self): planned = MLPClassifier(max_iter=20) trained = planned.auto_configure(self.train_X, self.train_y, optimizer=Hyperopt, cv=3, max_evals=3) _ = trained.predict(self.test_X)
def test_fit3(self): from lale.lib.sklearn import MinMaxScaler, MLPClassifier, PCA pipeline = PCA() >> Batching( operator=MinMaxScaler() >> MLPClassifier(random_state=42), batch_size=10) trained = pipeline.fit(self.X_train, self.y_train) predictions = trained.predict(self.X_test)
def test_mlp_classifier_9(self): from lale.lib.sklearn import MLPClassifier reg = MLPClassifier(learning_rate_init=0.002, solver='lbfgs') reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_7(self): from lale.lib.sklearn import MLPClassifier reg = MLPClassifier(shuffle=False, solver='lbfgs') reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_6(self): from lale.lib.sklearn import MLPClassifier reg = MLPClassifier(momentum=0.8, solver='lbfgs') reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_5(self): from lale.lib.sklearn import MLPClassifier reg = MLPClassifier(nesterovs_momentum=False, solver='lbfgs') reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_2b(self): reg = MLPClassifier(beta_2=0.8, solver="sgd") reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_3(self): reg = MLPClassifier(n_iter_no_change=100, solver="lbfgs") reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_10(self): reg = MLPClassifier(learning_rate="invscaling", power_t=0.4, solver="lbfgs") reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_9(self): reg = MLPClassifier(learning_rate_init=0.002, solver="lbfgs") reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_7(self): reg = MLPClassifier(shuffle=False, solver="lbfgs") reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_6(self): reg = MLPClassifier(momentum=0.8, solver="lbfgs") reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_5(self): reg = MLPClassifier(nesterovs_momentum=False, solver="lbfgs") reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_4(self): reg = MLPClassifier(early_stopping=True, solver="lbfgs") reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_10(self): from lale.lib.sklearn import MLPClassifier reg = MLPClassifier(learning_rate='invscaling', power_t = 0.4, solver='lbfgs') reg.fit(self.X_train, self.y_train)
def test_mlp_classifier(self): from lale.lib.sklearn import MLPClassifier reg = MLPClassifier(early_stopping=False, validation_fraction=0.2) reg.fit(self.X_train, self.y_train)
def test_with_defaults(self): trainable = MLPClassifier() trained = trainable.fit(self.train_X, self.train_y) _ = trained.predict(self.test_X)
def test_mlp_classifier_2(self): from lale.lib.sklearn import MLPClassifier reg = MLPClassifier(epsilon=0.8, solver='sgd') reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_2e(self): reg = MLPClassifier(epsilon=0.8, solver="sgd") reg.fit(self.X_train, self.y_train)
def test_max_fun(self): with self.assertRaisesRegex(jsonschema.ValidationError, "argument 'max_fun' was unexpected"): _ = MLPClassifier(max_fun=1000)
def test_mlp_classifier_3(self): from lale.lib.sklearn import MLPClassifier reg = MLPClassifier(n_iter_no_change=100, solver='lbfgs') reg.fit(self.X_train, self.y_train)
def test_mlp_classifier_4(self): from lale.lib.sklearn import MLPClassifier reg = MLPClassifier(early_stopping=True, solver='lbfgs') reg.fit(self.X_train, self.y_train)
def test_mlp_classifier(self): reg = MLPClassifier(early_stopping=False, validation_fraction=0.2) reg.fit(self.X_train, self.y_train)