def test_SGDRegression(self):
     nrows, ncols = 500, 5
     X = np.random.rand(nrows, ncols)
     y = X.dot(np.random.rand(ncols))
     data = Table(X, y)
     sgd = SGDRegressionLearner()
     res = CrossValidation(data, [sgd], k=3)
     self.assertLess(RMSE(res)[0], 0.1)
Esempio n. 2
0
 def test_SGDRegression(self):
     nrows, ncols = 500, 5
     X = np.random.rand(nrows, ncols)
     y = X.dot(np.random.rand(ncols))
     data = Table.from_numpy(None, X, y)
     sgd = SGDRegressionLearner()
     cv = CrossValidation(k=3)
     res = cv(data, [sgd])
     self.assertLess(RMSE(res)[0], 0.1)
Esempio n. 3
0
 def test_coefficients(self):
     lrn = SGDRegressionLearner()
     mod = lrn(Table("housing"))
     self.assertEqual(len(mod.coefficients), len(mod.domain.attributes))