Skip to content

Commit

Permalink
feat: New public API making usage more simple (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmnemoi authored Sep 16, 2023
1 parent 6d5883f commit db1aa7e
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 7 deletions.
6 changes: 6 additions & 0 deletions cmnemoi_learn/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""
cmnemoi-learn is a personal reimplementation of Machine Learning algorithms
with high quality development practices.
"""

__all__ = ["classification", "regression"]
File renamed without changes.
7 changes: 7 additions & 0 deletions cmnemoi_learn/classification/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""
Module implementing machine learning models for regression tasks.
"""

from ._logistic_regression import LogisticRegression

__all__ = ["LogisticRegression"]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np

from cmnemoi_learn.abstract_model import AbstractModel
from .._abstract_model import AbstractModel


class AbstractClassifier(AbstractModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Optional, Self
import numpy as np

from cmnemoi_learn.classification.abstract_classifier import AbstractClassifier
from ._abstract_classifier import AbstractClassifier


class LogisticRegression(AbstractClassifier):
Expand Down
7 changes: 7 additions & 0 deletions cmnemoi_learn/regression/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""
Module implementing machine learning models for regression tasks.
"""

from ._linear_regression import LinearRegression

__all__ = ["LinearRegression"]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np

from cmnemoi_learn.abstract_model import AbstractModel
from .._abstract_model import AbstractModel


class AbstractRegressor(AbstractModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
from numpy.linalg import pinv

from cmnemoi_learn.regression.abstract_regressor import AbstractRegressor
from ._abstract_regressor import AbstractRegressor


class LinearRegression(AbstractRegressor):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cmnemoi-learn"
version = "0.3.0"
version = "0.4.0"
description = "Machine Learning from scratch by Charles-Meldhine Madi Mnemoi"
authors = ["Charles-Meldhine Madi Mnemoi <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion tests/classification/test_logistic_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from sklearn.linear_model import LogisticRegression as SklearnLogisticRegression
from sklearn.metrics import accuracy_score

from cmnemoi_learn.classification.logistic_regression import LogisticRegression
from cmnemoi_learn.classification import LogisticRegression

RANDOM_STATE = 42

Expand Down
2 changes: 1 addition & 1 deletion tests/regression/test_linear_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from sklearn.linear_model import LinearRegression as SklearnLinearRegression
from sklearn.metrics import mean_squared_error

from cmnemoi_learn.regression.linear_regression import LinearRegression
from cmnemoi_learn.regression import LinearRegression

np.random.seed(42)

Expand Down

0 comments on commit db1aa7e

Please sign in to comment.