Esempio n. 1
0
    def test_joblib_pickle(self):
        reg1 = self.regressor_class(**self.kwargs)
        reg1.fit(self.X_train, self.y_train)
        y_pred1 = reg1.predict(self.X_test)
        joblib.dump(reg1, 'test_reg.pkl')

        # Remove model file
        cleanup()

        reg2 = joblib.load('test_reg.pkl')
        y_pred2 = reg2.predict(self.X_test)

        np.testing.assert_allclose(y_pred1, y_pred2)
Esempio n. 2
0
    def test_pickle(self):
        reg1 = self.regressor_class(**self.kwargs)
        reg1.fit(self.X_train, self.y_train)
        y_pred1 = reg1.predict(self.X_test)
        s = pickle.dumps(reg1)

        # Remove model file
        cleanup()

        reg2 = pickle.loads(s)
        y_pred2 = reg2.predict(self.X_test)

        np.testing.assert_allclose(y_pred1, y_pred2)
Esempio n. 3
0
    def test_joblib_pickle(self):
        clf1 = self.classifier_class(**self.kwargs)
        clf1.fit(self.X_train, self.y_train)
        y_pred1 = clf1.predict(self.X_test)
        joblib.dump(clf1, 'test_clf.pkl')

        # Remove model file
        cleanup()

        clf2 = joblib.load('test_clf.pkl')
        y_pred2 = clf2.predict(self.X_test)

        np.testing.assert_allclose(y_pred1, y_pred2)
Esempio n. 4
0
    def test_pickle(self):
        clf1 = self.classifier_class(**self.kwargs)
        clf1.fit(self.X_train, self.y_train)
        y_pred1 = clf1.predict(self.X_test)
        s = pickle.dumps(clf1)

        # Remove model file
        cleanup()

        clf2 = pickle.loads(s)
        y_pred2 = clf2.predict(self.X_test)

        np.testing.assert_allclose(y_pred1, y_pred2)
Esempio n. 5
0
    def test_joblib_pickle(self):
        est1 = self.estimator_class(**self.kwargs)
        est1.fit(self.X_train, self.y_train)
        y_pred1 = est1.predict(self.X_test)
        joblib.dump(est1, 'test_est.pkl')

        # Remove model file
        cleanup()

        est2 = joblib.load('test_est.pkl')
        y_pred2 = est2.predict(self.X_test)

        np.testing.assert_allclose(y_pred1, y_pred2)
Esempio n. 6
0
    def test_pickle(self):
        est1 = self.estimator_class(**self.kwargs)
        est1.fit(self.X_train, self.y_train)
        y_pred1 = est1.predict(self.X_test)
        s = pickle.dumps(est1)

        # Remove model file
        cleanup()

        est2 = pickle.loads(s)
        y_pred2 = est2.predict(self.X_test)

        np.testing.assert_allclose(y_pred1, y_pred2)