diff --git a/CHANGELOG.md b/CHANGELOG.md index cbca0db9..eb3daacd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added ### Changed +- testcase for LogisticRegressionCV, LogisticRegression - `README.md` updated - `AUTHORS.md` updated ## [1.1] - 2024-11-25 diff --git a/pymilo/utils/data_exporter.py b/pymilo/utils/data_exporter.py index 53d090a8..2a538858 100644 --- a/pymilo/utils/data_exporter.py +++ b/pymilo/utils/data_exporter.py @@ -56,16 +56,3 @@ def prepare_simple_clustering_datasets(): X = iris.data # Features y = iris.target # Target (labels) return X, y - - -def prepare_logistic_regression_datasets(threshold=None): - """ - Generate a dataset for logistic regression (the iris). - - :param threshold: threshold for train/test splitting - :int threshold: int - :return: splitted dataset for logistic regression - """ - iris_X, iris_y = datasets.load_iris(return_X_y=True) - threshold = threshold if threshold else len(iris_y) // 2 - return _split_X_y(iris_X, iris_y, threshold) diff --git a/tests/test_linear_models/logistic/logistic_regression.py b/tests/test_linear_models/logistic/logistic_regression.py index d3968d90..4b7ac6e9 100644 --- a/tests/test_linear_models/logistic/logistic_regression.py +++ b/tests/test_linear_models/logistic/logistic_regression.py @@ -1,17 +1,17 @@ from sklearn.linear_model import LogisticRegression -from pymilo.utils.test_pymilo import pymilo_regression_test -from pymilo.utils.data_exporter import prepare_simple_regression_datasets +from pymilo.utils.test_pymilo import pymilo_classification_test +from pymilo.utils.data_exporter import prepare_simple_classification_datasets MODEL_NAME = "Logistic-Regression" def logistic_regression(): - x_train, y_train, x_test, y_test = prepare_simple_regression_datasets() + x_train, y_train, x_test, y_test = prepare_simple_classification_datasets() # Create Logistic regression object logistic_regression_random_state = 4 logistic_regression = LogisticRegression( random_state=logistic_regression_random_state) # Train the model using the training sets logistic_regression.fit(x_train, y_train) - assert pymilo_regression_test( + assert pymilo_classification_test( logistic_regression, MODEL_NAME, (x_test, y_test)) == True diff --git a/tests/test_linear_models/logistic/logistic_regression_cv.py b/tests/test_linear_models/logistic/logistic_regression_cv.py index 378ae1f0..4cfdeecf 100644 --- a/tests/test_linear_models/logistic/logistic_regression_cv.py +++ b/tests/test_linear_models/logistic/logistic_regression_cv.py @@ -1,12 +1,12 @@ from sklearn.linear_model import LogisticRegressionCV -from pymilo.utils.test_pymilo import pymilo_regression_test -from pymilo.utils.data_exporter import prepare_logistic_regression_datasets +from pymilo.utils.test_pymilo import pymilo_classification_test +from pymilo.utils.data_exporter import prepare_simple_classification_datasets MODEL_NAME = "Logistic-Regression-CV" def logistic_regression_cv(): - x_train, y_train, x_test, y_test = prepare_logistic_regression_datasets() + x_train, y_train, x_test, y_test = prepare_simple_classification_datasets() # Create Logistic regression cv object logistic_regression_cv = 5 logistic_regression_random_state = 0 @@ -15,5 +15,5 @@ def logistic_regression_cv(): random_state=logistic_regression_random_state) # Train the model using the training sets logistic_regression_cv.fit(x_train, y_train) - assert pymilo_regression_test( + assert pymilo_classification_test( logistic_regression_cv, MODEL_NAME, (x_test, y_test)) == True