aek-auto-mlbuilder 0.6.1__tar.gz → 0.8.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 (22) hide show
  1. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/PKG-INFO +1 -1
  2. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder/__init__.py +3 -1
  3. aek_auto_mlbuilder-0.8.0/aek_auto_mlbuilder/kmeans.py +41 -0
  4. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder/knn.py +1 -1
  5. aek_auto_mlbuilder-0.8.0/aek_auto_mlbuilder/naive_bayes.py +65 -0
  6. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder/random_forest.py +1 -1
  7. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder/svm.py +1 -1
  8. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder.egg-info/PKG-INFO +1 -1
  9. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder.egg-info/SOURCES.txt +2 -0
  10. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/setup.py +1 -1
  11. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/LICENSE +0 -0
  12. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/README.md +0 -0
  13. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder/base.py +0 -0
  14. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder/decision_tree.py +0 -0
  15. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder/linear_regression.py +0 -0
  16. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder/logistic_regression.py +0 -0
  17. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder/utils.py +0 -0
  18. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder.egg-info/dependency_links.txt +0 -0
  19. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder.egg-info/requires.txt +0 -0
  20. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/aek_auto_mlbuilder.egg-info/top_level.txt +0 -0
  21. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.0}/pyproject.toml +0 -0
  22. {aek_auto_mlbuilder-0.6.1 → aek_auto_mlbuilder-0.8.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.1
3
+ Version: 0.8.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,6 @@ 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
10
+ from .kmeans import KMeansModel
@@ -0,0 +1,41 @@
1
+ from sklearn.cluster import KMeans
2
+ from .base import BaseModel
3
+
4
+
5
+ class KMeansModel(BaseModel):
6
+ """
7
+ K-Means clustering model (unsupervised learning)
8
+ Brute force method has been using
9
+ """
10
+ def __init__(self, param_grid=None):
11
+ super().__init__()
12
+ self.param_grid = param_grid or {
13
+ "n_clusters": [2, 3, 4, 5, 6],
14
+ "init": ["k-means++", "random"],
15
+ "n_init": [10, 20],
16
+ "max_iter": [300, 500]
17
+ }
18
+
19
+ def train(self, X, y):
20
+ best_score = -float("inf")
21
+ best_model = None
22
+
23
+ for n_clusters in self.param_grid["n_clusters"]:
24
+ for init in self.param_grid["init"]:
25
+ for n_init in self.param_grid["n_init"]:
26
+ for max_iter in self.param_grid["max_iter"]:
27
+ model = KMeans(
28
+ n_clusters=n_clusters,
29
+ init=init,
30
+ n_init=n_init,
31
+ max_iter=max_iter,
32
+ random_state=42
33
+ )
34
+ model.fit(X, y)
35
+ score = -model.inertia_
36
+ if score > best_score:
37
+ best_score = score
38
+ best_model = model
39
+ self.best_model = best_model
40
+ self.best_score = best_score
41
+ return self.best_model
@@ -8,7 +8,7 @@ class KNNModel(BaseModel):
8
8
  """
9
9
  KNN model for classification for classification or regression
10
10
  Use "task" for "classification" or "regression"
11
- Brute-force search is using
11
+ Brute-force search has been using
12
12
  """
13
13
  def __init__(self, task="classification", param_grid=None):
14
14
  super().__init__()
@@ -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 has been 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
@@ -5,7 +5,7 @@ class RandomForestModel(BaseModel):
5
5
  """
6
6
  Random Forest model for classification or regression
7
7
  Use task either "classification" or "regression"
8
- brute force method is using
8
+ brute force method has been using
9
9
  """
10
10
  def __init__(self, task="classification", param_grid=None):
11
11
  super().__init__()
@@ -8,7 +8,7 @@ class SVMModel(BaseModel):
8
8
  """
9
9
  support vector machine for classification and regression
10
10
  use task parameter for "regression" or "classification"
11
- brute force is using
11
+ brute force has been using
12
12
  """
13
13
  def __init__(self, task="classification", param_grid=None):
14
14
  super().__init__()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aek-auto-mlbuilder
3
- Version: 0.6.1
3
+ Version: 0.8.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,9 +5,11 @@ setup.py
5
5
  aek_auto_mlbuilder/__init__.py
6
6
  aek_auto_mlbuilder/base.py
7
7
  aek_auto_mlbuilder/decision_tree.py
8
+ aek_auto_mlbuilder/kmeans.py
8
9
  aek_auto_mlbuilder/knn.py
9
10
  aek_auto_mlbuilder/linear_regression.py
10
11
  aek_auto_mlbuilder/logistic_regression.py
12
+ aek_auto_mlbuilder/naive_bayes.py
11
13
  aek_auto_mlbuilder/random_forest.py
12
14
  aek_auto_mlbuilder/svm.py
13
15
  aek_auto_mlbuilder/utils.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="aek-auto-mlbuilder",
5
- version="0.6.1",
5
+ version="0.8.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",