Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move existing ML solutions into safeds.ml.classical package #213

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/tutorials/machine_learning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"execution_count": null,
"outputs": [],
"source": [
"from safeds.ml.regression import LinearRegression\n",
"from safeds.ml.classical.regression import LinearRegression\n",
"\n",
"model = LinearRegression()\n",
"fitted_model = model.fit(tagged_table)"
Expand Down
1 change: 1 addition & 0 deletions src/safeds/ml/classical/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Classes for classical machine learning, i.e. machine learning that does not use neural networks."""
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.ensemble import AdaBoostClassifier as sk_AdaBoostClassifier

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._classifier import Classifier

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.tree import DecisionTreeClassifier as sk_DecisionTreeClassifier

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._classifier import Classifier

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.ensemble import GradientBoostingClassifier as sk_GradientBoostingClassifier

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._classifier import Classifier

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.neighbors import KNeighborsClassifier as sk_KNeighborsClassifier

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._classifier import Classifier

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.linear_model import LogisticRegression as sk_LogisticRegression

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._classifier import Classifier

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.ensemble import RandomForestClassifier as sk_RandomForestClassifier

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._classifier import Classifier

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.ensemble import AdaBoostRegressor as sk_AdaBoostRegressor

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._regressor import Regressor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.tree import DecisionTreeRegressor as sk_DecisionTreeRegressor

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._regressor import Regressor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.linear_model import ElasticNet as sk_ElasticNet

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._regressor import Regressor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.ensemble import GradientBoostingRegressor as sk_GradientBoostingRegressor

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._regressor import Regressor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.neighbors import KNeighborsRegressor as sk_KNeighborsRegressor

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._regressor import Regressor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.linear_model import Lasso as sk_Lasso

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._regressor import Regressor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.linear_model import LinearRegression as sk_LinearRegression

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._regressor import Regressor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.ensemble import RandomForestRegressor as sk_RandomForestRegressor

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._regressor import Regressor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from sklearn.linear_model import Ridge as sk_Ridge

from safeds.ml._util_sklearn import fit, predict
from safeds.ml.classical._util_sklearn import fit, predict

from ._regressor import Regressor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pytest
from safeds.data.tabular.containers import Table, TaggedTable
from safeds.ml.classification import (
from safeds.ml.classical.classification import (
AdaBoost,
Classifier,
DecisionTree,
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@
import pytest
from safeds.data.tabular.containers import Column, Table, TaggedTable
from safeds.data.tabular.exceptions import ColumnLengthMismatchError
from safeds.ml.exceptions import (
DatasetContainsTargetError,
DatasetMissesFeaturesError,
LearningError,
ModelNotFittedError,
PredictionError,
)
from safeds.ml.regression import (
from safeds.ml.classical.regression import (
AdaBoost,
DecisionTree,
ElasticNetRegression,
Expand All @@ -27,7 +20,14 @@
)

# noinspection PyProtectedMember
from safeds.ml.regression._regressor import _check_metrics_preconditions
from safeds.ml.classical.regression._regressor import _check_metrics_preconditions
from safeds.ml.exceptions import (
DatasetContainsTargetError,
DatasetMissesFeaturesError,
LearningError,
ModelNotFittedError,
PredictionError,
)

if TYPE_CHECKING:
from _pytest.fixtures import FixtureRequest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import warnings

from safeds.data.tabular.containers import Table
from safeds.ml.regression import LinearRegression
from safeds.ml.classical.regression import LinearRegression


def test_predict_should_not_warn_about_feature_names() -> None:
Expand Down