aek-auto-mlbuilder 0.9.0__py3-none-any.whl → 0.10.0__py3-none-any.whl
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.
- aek_auto_mlbuilder/__init__.py +2 -1
- aek_auto_mlbuilder/agglomerative.py +40 -0
- {aek_auto_mlbuilder-0.9.0.dist-info → aek_auto_mlbuilder-0.10.0.dist-info}/METADATA +1 -1
- {aek_auto_mlbuilder-0.9.0.dist-info → aek_auto_mlbuilder-0.10.0.dist-info}/RECORD +7 -6
- {aek_auto_mlbuilder-0.9.0.dist-info → aek_auto_mlbuilder-0.10.0.dist-info}/WHEEL +0 -0
- {aek_auto_mlbuilder-0.9.0.dist-info → aek_auto_mlbuilder-0.10.0.dist-info}/licenses/LICENSE +0 -0
- {aek_auto_mlbuilder-0.9.0.dist-info → aek_auto_mlbuilder-0.10.0.dist-info}/top_level.txt +0 -0
aek_auto_mlbuilder/__init__.py
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
from sklearn.cluster import AgglomerativeClustering
|
2
|
+
from .base import BaseModel
|
3
|
+
|
4
|
+
class AgglomerativeModel(BaseModel):
|
5
|
+
"""
|
6
|
+
Agglomerative clustering model
|
7
|
+
brute force search is being used
|
8
|
+
"""
|
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
|
+
"linkage": ["ward", "complete", "average", "single"]
|
15
|
+
}
|
16
|
+
|
17
|
+
def train(self, X):
|
18
|
+
best_score = -float("inf")
|
19
|
+
best_model = None
|
20
|
+
|
21
|
+
for n_clusters in self.param_grid["n_clusters"]:
|
22
|
+
for linkage in self.param_grid["linkage"]:
|
23
|
+
model = AgglomerativeClustering(
|
24
|
+
n_clusters=n_clusters,
|
25
|
+
linkage=linkage
|
26
|
+
)
|
27
|
+
labels = model.fit_predict(X)
|
28
|
+
clusters = set(labels)
|
29
|
+
score = 0
|
30
|
+
for k in clusters:
|
31
|
+
cluster_size = (labels == k).sum()
|
32
|
+
score += 1 / cluster_size
|
33
|
+
if score > best_score:
|
34
|
+
best_score = score
|
35
|
+
best_model = model
|
36
|
+
|
37
|
+
self.best_model = best_model
|
38
|
+
self.best_score = best_score
|
39
|
+
return self.best_model
|
40
|
+
|
@@ -1,4 +1,5 @@
|
|
1
|
-
aek_auto_mlbuilder/__init__.py,sha256=
|
1
|
+
aek_auto_mlbuilder/__init__.py,sha256=7CehkJhvgV-aXCeAOHTRQ02XfpmzxQ3M4QgluGBPysA,449
|
2
|
+
aek_auto_mlbuilder/agglomerative.py,sha256=fqxvJien430QCCdPFn997BqLNshYn8JmG5hFnQFSzko,1260
|
2
3
|
aek_auto_mlbuilder/base.py,sha256=GgMdAoceRjwz3i9rVQ0RAjvn5ZdRS-sAkLWjymbE8s0,385
|
3
4
|
aek_auto_mlbuilder/dbscan.py,sha256=Z9jXoixn7L2WFOHChkWaiZ9sj_Qo0j5R7_kNMacL0ik,986
|
4
5
|
aek_auto_mlbuilder/decision_tree.py,sha256=OImOHaREz2jWcANXVC6VKcatFJfzrtyCHJKXNA5-hoI,1606
|
@@ -10,8 +11,8 @@ aek_auto_mlbuilder/naive_bayes.py,sha256=UCZrLOTo7ibgwSQH5aqZgyrDvMWkM4-aQwQJDk_
|
|
10
11
|
aek_auto_mlbuilder/random_forest.py,sha256=RpT5-QX1D6iGjRtcPFuRtqMrdmnDNklA9w3uwbtYYlM,2023
|
11
12
|
aek_auto_mlbuilder/svm.py,sha256=-IQjzHIzHhgpi2mIgWVzIDKlhAS7o_tMVQhN_epseKw,1619
|
12
13
|
aek_auto_mlbuilder/utils.py,sha256=NcoM3b4Ng1Ogk3iKuz9DcMVwppGRqOLRp5g9jBCkWxY,190
|
13
|
-
aek_auto_mlbuilder-0.
|
14
|
-
aek_auto_mlbuilder-0.
|
15
|
-
aek_auto_mlbuilder-0.
|
16
|
-
aek_auto_mlbuilder-0.
|
17
|
-
aek_auto_mlbuilder-0.
|
14
|
+
aek_auto_mlbuilder-0.10.0.dist-info/licenses/LICENSE,sha256=eSVo2jJj9FB1xvr0zZ9U1fXkyjjnT6-WM3O4HSFKJOc,133
|
15
|
+
aek_auto_mlbuilder-0.10.0.dist-info/METADATA,sha256=xUKbDAzNJiMmG5IpoB_Q2eLPfDDkvfysYFcPN7WiCBU,1401
|
16
|
+
aek_auto_mlbuilder-0.10.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
17
|
+
aek_auto_mlbuilder-0.10.0.dist-info/top_level.txt,sha256=2ZY5rMRnVvrAH2GRGUbd6n9ey8cg_uk5iJwke0hQzFE,19
|
18
|
+
aek_auto_mlbuilder-0.10.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|