aek-auto-mlbuilder 0.1.1__tar.gz → 0.3.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.
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/PKG-INFO +1 -1
- aek_auto_mlbuilder-0.3.0/aek_auto_mlbuilder/__init__.py +5 -0
- aek_auto_mlbuilder-0.3.0/aek_auto_mlbuilder/decision_tree.py +45 -0
- aek_auto_mlbuilder-0.3.0/aek_auto_mlbuilder/logistic_regression.py +48 -0
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/PKG-INFO +1 -1
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/SOURCES.txt +2 -0
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/setup.py +1 -1
- aek_auto_mlbuilder-0.1.1/aek_auto_mlbuilder/__init__.py +0 -3
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/LICENSE +0 -0
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/README.md +0 -0
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder/base.py +0 -0
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder/linear_regression.py +0 -0
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder/utils.py +0 -0
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/dependency_links.txt +0 -0
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/requires.txt +0 -0
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/top_level.txt +0 -0
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/pyproject.toml +0 -0
- {aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/setup.cfg +0 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
|
2
|
+
from .base import BaseModel
|
3
|
+
|
4
|
+
|
5
|
+
class DecisionTreeModel(BaseModel):
|
6
|
+
"""
|
7
|
+
Decision Tree for classification or regression
|
8
|
+
Use "task" param to specify "classification" or "regression"
|
9
|
+
Brute force search included
|
10
|
+
"""
|
11
|
+
|
12
|
+
def __init__(self, task="classification", param_grid=None):
|
13
|
+
super().__init__()
|
14
|
+
self.task = task
|
15
|
+
self.param_grid = param_grid or {
|
16
|
+
"max_depth": [None, 3, 5, 10],
|
17
|
+
"min_samples_split": [2, 5, 10],
|
18
|
+
"min_samples_leaf": [1, 2, 4]
|
19
|
+
}
|
20
|
+
|
21
|
+
def train(self, X, y):
|
22
|
+
best_score = -float("inf")
|
23
|
+
best_model = None
|
24
|
+
|
25
|
+
if self.task.lower() == "classification":
|
26
|
+
ModelClass = DecisionTreeClassifier
|
27
|
+
else:
|
28
|
+
ModelClass = DecisionTreeRegressor
|
29
|
+
|
30
|
+
for max_depth in self.param_grid["max_depth"]:
|
31
|
+
for min_samples_split in self.param_grid["min_samples_split"]:
|
32
|
+
for min_samples_leaf in self.param_grid["min_samples_leaf"]:
|
33
|
+
model = ModelClass(
|
34
|
+
max_depth=max_depth,
|
35
|
+
min_samples_split=min_samples_split,
|
36
|
+
min_samples_leaf=min_samples_leaf
|
37
|
+
)
|
38
|
+
model.fit(X, y)
|
39
|
+
score = model.score(X, y)
|
40
|
+
if score > best_score:
|
41
|
+
best_score = score
|
42
|
+
best_model = model
|
43
|
+
self.best_model = best_model
|
44
|
+
self.best_score = best_score
|
45
|
+
return self.best_model
|
@@ -0,0 +1,48 @@
|
|
1
|
+
from sklearn.linear_model import LogisticRegression
|
2
|
+
from sklearn.preprocessing import StandardScaler
|
3
|
+
from sklearn.pipeline import make_pipeline
|
4
|
+
from .base import BaseModel
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
class LogisticClassifier(BaseModel):
|
9
|
+
"""
|
10
|
+
Basic Logistic Regression class for binary/multi-class classification.
|
11
|
+
Brute-force parameter search included.
|
12
|
+
"""
|
13
|
+
|
14
|
+
def __init__(self, param_grid=None):
|
15
|
+
super().__init__()
|
16
|
+
self.param_grid = param_grid or {
|
17
|
+
"C": [0.01, 0.1, 1, 10],
|
18
|
+
"penalty": ["l2"],
|
19
|
+
"solver": ["lbfgs"],
|
20
|
+
"fit_intercept": [True, False]
|
21
|
+
}
|
22
|
+
def train(self, X, y):
|
23
|
+
best_score = -float("inf")
|
24
|
+
best_model = None
|
25
|
+
|
26
|
+
for C in self.param_grid["C"]:
|
27
|
+
for penalty in self.param_grid["penalty"]:
|
28
|
+
for solver in self.param_grid["solver"]:
|
29
|
+
for fit_intercept in self.param_grid["fit_intercept"]:
|
30
|
+
model = make_pipeline(
|
31
|
+
StandardScaler(),
|
32
|
+
LogisticRegression(
|
33
|
+
C=C,
|
34
|
+
penalty=penalty,
|
35
|
+
solver=solver,
|
36
|
+
fit_intercept=fit_intercept,
|
37
|
+
max_iter=1000
|
38
|
+
)
|
39
|
+
)
|
40
|
+
model.fit(X, y)
|
41
|
+
score = model.score(X, y)
|
42
|
+
if score > best_score:
|
43
|
+
best_score = score
|
44
|
+
best_model = model
|
45
|
+
|
46
|
+
self.best_model = best_model
|
47
|
+
self.best_score = best_score
|
48
|
+
return self.best_model
|
{aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/SOURCES.txt
RENAMED
@@ -4,7 +4,9 @@ pyproject.toml
|
|
4
4
|
setup.py
|
5
5
|
aek_auto_mlbuilder/__init__.py
|
6
6
|
aek_auto_mlbuilder/base.py
|
7
|
+
aek_auto_mlbuilder/decision_tree.py
|
7
8
|
aek_auto_mlbuilder/linear_regression.py
|
9
|
+
aek_auto_mlbuilder/logistic_regression.py
|
8
10
|
aek_auto_mlbuilder/utils.py
|
9
11
|
aek_auto_mlbuilder.egg-info/PKG-INFO
|
10
12
|
aek_auto_mlbuilder.egg-info/SOURCES.txt
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name="aek-auto-mlbuilder", # PyPI dağıtım adı
|
5
|
-
version="0.
|
5
|
+
version="0.3.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",
|
File without changes
|
File without changes
|
File without changes
|
{aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder/linear_regression.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/requires.txt
RENAMED
File without changes
|
{aek_auto_mlbuilder-0.1.1 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|