Commit fecb8e7e authored by Eteri's avatar Eteri

erp5_wendelin: add test for importing sklearn

parent 8aa70355
...@@ -325,4 +325,20 @@ class Test(ERP5TypeTestCase): ...@@ -325,4 +325,20 @@ class Test(ERP5TypeTestCase):
self.assertSameSet(data_stream_2.getRecursivePredecessorValueList(), \ self.assertSameSet(data_stream_2.getRecursivePredecessorValueList(), \
[data_stream_1]) [data_stream_1])
self.assertSameSet(data_stream_5.getRecursivePredecessorValueList(), \ self.assertSameSet(data_stream_5.getRecursivePredecessorValueList(), \
[data_stream_4, data_stream_3, data_stream_2, data_stream_1]) [data_stream_4, data_stream_3, data_stream_2, data_stream_1])
\ No newline at end of file
def test_08_ImportSklearn(self):
"""
Test import of Scikit-learn and minimal example of usage.
"""
from sklearn.linear_model import LinearRegression
X = np.array([[1, 1], [1, 2], [2, 2], [2, 3]])
# y = 1 * x_0 + 2 * x_1 + 3
y = np.dot(X, np.array([1, 2])) + 3
reg = LinearRegression().fit(X, y)
predicted = reg.predict(np.array([[4, 10]]))
self.assertEqual(predicted.all(),np.array([27.]).all())
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment