aek-auto-mlbuilder 0.6.0__tar.gz → 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/PKG-INFO +1 -1
  2. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder/__init__.py +2 -1
  3. aek_auto_mlbuilder-0.7.0/aek_auto_mlbuilder/naive_bayes.py +65 -0
  4. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder.egg-info/PKG-INFO +1 -1
  5. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder.egg-info/SOURCES.txt +1 -0
  6. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/setup.py +3 -3
  7. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/LICENSE +0 -0
  8. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/README.md +0 -0
  9. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder/base.py +0 -0
  10. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder/decision_tree.py +0 -0
  11. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder/knn.py +0 -0
  12. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder/linear_regression.py +0 -0
  13. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder/logistic_regression.py +0 -0
  14. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder/random_forest.py +0 -0
  15. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder/svm.py +0 -0
  16. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder/utils.py +0 -0
  17. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder.egg-info/dependency_links.txt +0 -0
  18. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder.egg-info/requires.txt +0 -0
  19. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/aek_auto_mlbuilder.egg-info/top_level.txt +0 -0
  20. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/pyproject.toml +0 -0
  21. {aek_auto_mlbuilder-0.6.0 → aek_auto_mlbuilder-0.7.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aek-auto-mlbuilder
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Automatic ML model builder in Python
5
5
  Home-page: https://github.com/alpemre8/aek-auto-mlbuilder
6
6
  Author: Alp Emre Karaahmet
@@ -5,4 +5,5 @@ from .logistic_regression import LogisticClassifier
5
5
  from .decision_tree import DecisionTreeModel
6
6
  from .knn import KNNModel
7
7
  from .random_forest import RandomForestModel
8
- from .svm import SVMModel
8
+ from .svm import SVMModel
9
+ from .naive_bayes import NaiveBayesModel
@@ -0,0 +1,65 @@
1
+ from sklearn.naive_bayes import GaussianNB, MultinomialNB, BernoulliNB
2
+ from .base import BaseModel
3
+
4
+
5
+ class NaiveBayesModel(BaseModel):
6
+ """
7
+ Naive bayes model supporting gaussianNB, multinomialNB, bernoulliNB
8
+ use 'nb_type' param to specify the variant: gaussian, multinomial, bernoulli
9
+ brute force hyperparameter search is using
10
+ """
11
+ def __init__(self, nb_type="gaussian", param_grid=None):
12
+ super().__init__()
13
+ self.nb_type = nb_type.lower()
14
+
15
+ if self.nb_type == "gaussian":
16
+
17
+ self.param_grid = param_grid or {
18
+ "var_smoothing": [1e-9, 1e-8, 1e-7]
19
+ }
20
+ elif self.nb_type == "multinomial":
21
+
22
+ self.param_grid = param_grid or {
23
+ "alpha": [1.0, 0.5, 0.1]
24
+ }
25
+ elif self.nb_type == "bernoulli":
26
+
27
+ self.param_grid = param_grid or {
28
+ "alpha": [1.0, 0.5, 0.1],
29
+ "binarize": [0.0, 0.5, 1.0]
30
+ }
31
+ else:
32
+ raise ValueError("nb_type must be 'gaussian', 'multinomial', 'bernoulli'")
33
+
34
+ def train(self, X, y):
35
+ best_score = -float("inf")
36
+ best_model = None
37
+
38
+ if self.nb_type == "gaussian":
39
+ for var_smoothing in self.param_grid["var_smoothing"]:
40
+ model = GaussianNB(var_smoothing=var_smoothing)
41
+ model.fit(X, y)
42
+ score = model.score(X, y)
43
+ if score > best_score:
44
+ best_score = score
45
+ best_model = model
46
+ elif self.nb_type == "multinomial":
47
+ for alpha in self.param_grid["alpha"]:
48
+ model = MultinomialNB(alpha=alpha)
49
+ model.fit(X, y)
50
+ score = model.score(X, y)
51
+ if score > best_score:
52
+ best_score = score
53
+ best_model = model
54
+ elif self.nb_type == "bernoulli":
55
+ for alpha in self.param_grid["alpha"]:
56
+ for binarize in self.param_grid["binarize"]:
57
+ model = BernoulliNB(alpha=alpha, binarize=binarize)
58
+ model.fit(X, y)
59
+ score = model.score(X, y)
60
+ if score > best_score:
61
+ best_score = score
62
+ best_model = model
63
+ self.best_model = best_model
64
+ self.best_score = best_score
65
+ return self.best_model
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aek-auto-mlbuilder
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Automatic ML model builder in Python
5
5
  Home-page: https://github.com/alpemre8/aek-auto-mlbuilder
6
6
  Author: Alp Emre Karaahmet
@@ -8,6 +8,7 @@ aek_auto_mlbuilder/decision_tree.py
8
8
  aek_auto_mlbuilder/knn.py
9
9
  aek_auto_mlbuilder/linear_regression.py
10
10
  aek_auto_mlbuilder/logistic_regression.py
11
+ aek_auto_mlbuilder/naive_bayes.py
11
12
  aek_auto_mlbuilder/random_forest.py
12
13
  aek_auto_mlbuilder/svm.py
13
14
  aek_auto_mlbuilder/utils.py
@@ -1,8 +1,8 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
- name="aek-auto-mlbuilder", # PyPI dağıtım adı
5
- version="0.6.0",
4
+ name="aek-auto-mlbuilder",
5
+ version="0.7.0",
6
6
  description="Automatic ML model builder in Python",
7
7
  long_description=open("README.md", encoding="utf-8").read(),
8
8
  long_description_content_type="text/markdown",
@@ -16,5 +16,5 @@ setup(
16
16
  "scikit-learn>=1.0",
17
17
  "numpy>=1.23",
18
18
  "pandas>=1.5"
19
- ], # bağımlılıkları buraya eklersin
19
+ ],
20
20
  )