def test_sklearn_linear_regression_verbose(self): X, y = iris_data() rows = [] def myprint(*args, **kwargs): rows.append(' '.join(map(str, args))) check_model_representation(LinearRegression, X, y, verbose=True, fLOG=myprint, suffix='A') check_model_representation(LinearRegression, X.tolist(), y.tolist(), verbose=True, fLOG=myprint, suffix='B') self.assertGreater(len(rows), 2) xdf = pandas.DataFrame(X) try: check_model_representation(LinearRegression, xdf, y.tolist(), verbose=True, fLOG=myprint, suffix='B') except TypeError as e: self.assertIn("value is not a numpy.array but", str(e)) return self.assertGreater(len(rows), 2)
def test_sklearn_tree2(self): from sklearn.tree import DecisionTreeRegressor X, y = iris_data() check_model_representation(model=DecisionTreeRegressor(max_depth=2), X=X, y=y, verbose=True, suffix="t2")
def test_sklearn_tree1(self): from sklearn.tree import DecisionTreeRegressor X, y = iris_data() check_model_representation(DecisionTreeRegressor(max_depth=1), X, y, verbose=False, suffix="t1")
def test_sklearn_linear_regression_verbose(self): from sklearn.linear_model import LinearRegression X, y = iris_data() rows = [] def myprint(*args, **kwargs): rows.append(' '.join(map(str, args))) check_model_representation( LinearRegression, X, y, verbose=True, fLOG=myprint) self.assertGreater(len(rows), 2)