def test_predict(): """Assert that the TPOT predict function raises a ValueError when no optimized pipeline exists""" tpot_obj = TPOT() try: tpot_obj.predict(testing_features) assert False # Should be unreachable except ValueError: pass
def test_predict(): """Ensure that the TPOT predict function raises a ValueError when no optimized pipeline exists""" tpot_obj = TPOT() try: tpot_obj.predict(testing_features) assert False # Should be unreachable except ValueError: pass
def test_predict_2(): """Ensure that the TPOT predict function returns a DataFrame of shape (num_testing_rows,)""" tpot_obj = TPOT() tpot_obj._training_classes = training_classes tpot_obj._training_features = training_features tpot_obj._optimized_pipeline = creator.Individual.\ from_string('_logistic_regression(input_df, 1.0, 0, True)', tpot_obj._pset) result = tpot_obj.predict(testing_features) assert result.shape == (testing_features.shape[0],)
def test_predict_2(): """Assert that the TPOT predict function returns a numpy matrix of shape (num_testing_rows,)""" tpot_obj = TPOT() tpot_obj._optimized_pipeline = creator.Individual.\ from_string('DecisionTreeClassifier(input_matrix)', tpot_obj._pset) tpot_obj._fitted_pipeline = tpot_obj._toolbox.compile(expr=tpot_obj._optimized_pipeline) tpot_obj._fitted_pipeline.fit(training_features, training_classes) result = tpot_obj.predict(testing_features) assert result.shape == (testing_features.shape[0],)
def test_predict_2(): """Ensure that the TPOT predict function returns a DataFrame of shape (num_testing_rows,)""" tpot_obj = TPOT() tpot_obj._training_classes = training_classes tpot_obj._training_features = training_features tpot_obj._optimized_pipeline = creator.Individual.\ from_string('_logistic_regression(input_df, 1.0, 0, True)', tpot_obj._pset) result = tpot_obj.predict(testing_features) assert result.shape == (testing_features.shape[0], )
def test_predict_2(): """Assert that the TPOT predict function returns a numpy matrix of shape (num_testing_rows,)""" tpot_obj = TPOT() tpot_obj._optimized_pipeline = creator.Individual.\ from_string('DecisionTreeClassifier(input_matrix)', tpot_obj._pset) tpot_obj._fitted_pipeline = tpot_obj._toolbox.compile( expr=tpot_obj._optimized_pipeline) tpot_obj._fitted_pipeline.fit(training_features, training_classes) result = tpot_obj.predict(testing_features) assert result.shape == (testing_features.shape[0], )