automlease 0.1.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.
- automlease-0.1.0/PKG-INFO +85 -0
- automlease-0.1.0/README.md +57 -0
- automlease-0.1.0/automlease/__init__.py +6 -0
- automlease-0.1.0/automlease/core.py +154 -0
- automlease-0.1.0/automlease.egg-info/PKG-INFO +85 -0
- automlease-0.1.0/automlease.egg-info/SOURCES.txt +9 -0
- automlease-0.1.0/automlease.egg-info/dependency_links.txt +1 -0
- automlease-0.1.0/automlease.egg-info/requires.txt +6 -0
- automlease-0.1.0/automlease.egg-info/top_level.txt +1 -0
- automlease-0.1.0/setup.cfg +4 -0
- automlease-0.1.0/setup.py +27 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: automlease
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Automatic Machine Learning for beginners — train ML models in 3 lines!
|
|
5
|
+
Home-page: https://github.com/vickybanna3327-byte/automlease
|
|
6
|
+
Author: Vikash Singh Rajput
|
|
7
|
+
Author-email: vickybanna3327@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: pandas
|
|
14
|
+
Requires-Dist: scikit-learn
|
|
15
|
+
Requires-Dist: matplotlib
|
|
16
|
+
Requires-Dist: seaborn
|
|
17
|
+
Requires-Dist: joblib
|
|
18
|
+
Requires-Dist: rich
|
|
19
|
+
Dynamic: author
|
|
20
|
+
Dynamic: author-email
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: requires-dist
|
|
26
|
+
Dynamic: requires-python
|
|
27
|
+
Dynamic: summary
|
|
28
|
+
|
|
29
|
+
# automlease 🤖
|
|
30
|
+
|
|
31
|
+
**Automatic Machine Learning for absolute beginners.**
|
|
32
|
+
Train a machine learning model in just 3 lines of Python code!
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
```bash
|
|
36
|
+
pip install automlease
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
```python
|
|
41
|
+
from automlease import AutoML
|
|
42
|
+
|
|
43
|
+
model = AutoML()
|
|
44
|
+
model.fit('your_data.csv', target='target_column')
|
|
45
|
+
model.report()
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## What it does automatically
|
|
49
|
+
|
|
50
|
+
- ✅ Loads any CSV file
|
|
51
|
+
- ✅ Cleans missing values
|
|
52
|
+
- ✅ Converts text columns to numbers
|
|
53
|
+
- ✅ Detects if task is classification or regression
|
|
54
|
+
- ✅ Trains multiple ML models and picks the best one
|
|
55
|
+
- ✅ Shows a detailed evaluation report
|
|
56
|
+
- ✅ Creates feature importance chart
|
|
57
|
+
- ✅ Saves the best model automatically
|
|
58
|
+
|
|
59
|
+
## Example — Heart Disease Prediction
|
|
60
|
+
```python
|
|
61
|
+
from automlease import AutoML
|
|
62
|
+
|
|
63
|
+
model = AutoML()
|
|
64
|
+
model.fit('heart_disease.csv', target='target')
|
|
65
|
+
model.report()
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Built With
|
|
69
|
+
|
|
70
|
+
- pandas
|
|
71
|
+
- scikit-learn
|
|
72
|
+
- matplotlib
|
|
73
|
+
- seaborn
|
|
74
|
+
- joblib
|
|
75
|
+
- rich
|
|
76
|
+
|
|
77
|
+
## Author
|
|
78
|
+
|
|
79
|
+
**Vikash Singh Rajput**
|
|
80
|
+
BTech Management Graduate — NAIT, Edmonton, Canada
|
|
81
|
+
GitHub: https://github.com/vickybanna3327-byte
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
MIT License
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# automlease 🤖
|
|
2
|
+
|
|
3
|
+
**Automatic Machine Learning for absolute beginners.**
|
|
4
|
+
Train a machine learning model in just 3 lines of Python code!
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
```bash
|
|
8
|
+
pip install automlease
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
```python
|
|
13
|
+
from automlease import AutoML
|
|
14
|
+
|
|
15
|
+
model = AutoML()
|
|
16
|
+
model.fit('your_data.csv', target='target_column')
|
|
17
|
+
model.report()
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## What it does automatically
|
|
21
|
+
|
|
22
|
+
- ✅ Loads any CSV file
|
|
23
|
+
- ✅ Cleans missing values
|
|
24
|
+
- ✅ Converts text columns to numbers
|
|
25
|
+
- ✅ Detects if task is classification or regression
|
|
26
|
+
- ✅ Trains multiple ML models and picks the best one
|
|
27
|
+
- ✅ Shows a detailed evaluation report
|
|
28
|
+
- ✅ Creates feature importance chart
|
|
29
|
+
- ✅ Saves the best model automatically
|
|
30
|
+
|
|
31
|
+
## Example — Heart Disease Prediction
|
|
32
|
+
```python
|
|
33
|
+
from automlease import AutoML
|
|
34
|
+
|
|
35
|
+
model = AutoML()
|
|
36
|
+
model.fit('heart_disease.csv', target='target')
|
|
37
|
+
model.report()
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Built With
|
|
41
|
+
|
|
42
|
+
- pandas
|
|
43
|
+
- scikit-learn
|
|
44
|
+
- matplotlib
|
|
45
|
+
- seaborn
|
|
46
|
+
- joblib
|
|
47
|
+
- rich
|
|
48
|
+
|
|
49
|
+
## Author
|
|
50
|
+
|
|
51
|
+
**Vikash Singh Rajput**
|
|
52
|
+
BTech Management Graduate — NAIT, Edmonton, Canada
|
|
53
|
+
GitHub: https://github.com/vickybanna3327-byte
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT License
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
import numpy as np
|
|
3
|
+
import matplotlib.pyplot as plt
|
|
4
|
+
import seaborn as sns
|
|
5
|
+
import joblib
|
|
6
|
+
from sklearn.model_selection import train_test_split
|
|
7
|
+
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
|
|
8
|
+
from sklearn.linear_model import LogisticRegression, LinearRegression
|
|
9
|
+
from sklearn.metrics import (accuracy_score, classification_report,
|
|
10
|
+
mean_squared_error, r2_score)
|
|
11
|
+
from sklearn.preprocessing import LabelEncoder
|
|
12
|
+
from rich.console import Console
|
|
13
|
+
from rich.table import Table
|
|
14
|
+
from rich import print as rprint
|
|
15
|
+
|
|
16
|
+
console = Console()
|
|
17
|
+
|
|
18
|
+
class AutoML:
|
|
19
|
+
def __init__(self):
|
|
20
|
+
self.model = None
|
|
21
|
+
self.best_model_name = None
|
|
22
|
+
self.task_type = None
|
|
23
|
+
self.X_train = None
|
|
24
|
+
self.X_test = None
|
|
25
|
+
self.y_train = None
|
|
26
|
+
self.y_test = None
|
|
27
|
+
self.feature_names = None
|
|
28
|
+
self.results = {}
|
|
29
|
+
|
|
30
|
+
def fit(self, data, target):
|
|
31
|
+
console.print("\n[bold blue]AutoMLease — Starting Automatic ML Pipeline...[/bold blue]\n")
|
|
32
|
+
|
|
33
|
+
# Step 1 - Load data
|
|
34
|
+
if isinstance(data, str):
|
|
35
|
+
df = pd.read_csv(data)
|
|
36
|
+
console.print(f"[green]✅ Dataset loaded: {df.shape[0]} rows, {df.shape[1]} columns[/green]")
|
|
37
|
+
else:
|
|
38
|
+
df = data.copy()
|
|
39
|
+
console.print(f"[green]✅ Dataset received: {df.shape[0]} rows, {df.shape[1]} columns[/green]")
|
|
40
|
+
|
|
41
|
+
# Step 2 - Clean data
|
|
42
|
+
console.print("[yellow]🔄 Cleaning data...[/yellow]")
|
|
43
|
+
le = LabelEncoder()
|
|
44
|
+
for col in df.select_dtypes(include='object').columns:
|
|
45
|
+
df[col] = le.fit_transform(df[col].astype(str))
|
|
46
|
+
df = df.dropna()
|
|
47
|
+
console.print(f"[green]✅ Data cleaned: {df.shape[0]} rows remaining[/green]")
|
|
48
|
+
|
|
49
|
+
# Step 3 - Split features and target
|
|
50
|
+
X = df.drop(target, axis=1)
|
|
51
|
+
y = df[target]
|
|
52
|
+
self.feature_names = list(X.columns)
|
|
53
|
+
|
|
54
|
+
# Step 4 - Detect task type
|
|
55
|
+
unique_values = y.nunique()
|
|
56
|
+
if unique_values <= 10:
|
|
57
|
+
self.task_type = 'classification'
|
|
58
|
+
console.print("[green]✅ Task detected: Classification[/green]")
|
|
59
|
+
else:
|
|
60
|
+
self.task_type = 'regression'
|
|
61
|
+
console.print("[green]✅ Task detected: Regression[/green]")
|
|
62
|
+
|
|
63
|
+
# Step 5 - Train test split
|
|
64
|
+
self.X_train, self.X_test, self.y_train, self.y_test = train_test_split(
|
|
65
|
+
X, y, test_size=0.2, random_state=42)
|
|
66
|
+
console.print(f"[green]✅ Data split: {len(self.X_train)} training, {len(self.X_test)} testing[/green]")
|
|
67
|
+
|
|
68
|
+
# Step 6 - Train models and pick best
|
|
69
|
+
console.print("[yellow]🔄 Training models...[/yellow]")
|
|
70
|
+
if self.task_type == 'classification':
|
|
71
|
+
models = {
|
|
72
|
+
'Random Forest': RandomForestClassifier(n_estimators=100, random_state=42),
|
|
73
|
+
'Logistic Regression': LogisticRegression(max_iter=1000, random_state=42)
|
|
74
|
+
}
|
|
75
|
+
best_score = 0
|
|
76
|
+
for name, m in models.items():
|
|
77
|
+
m.fit(self.X_train, self.y_train)
|
|
78
|
+
score = accuracy_score(self.y_test, m.predict(self.X_test))
|
|
79
|
+
self.results[name] = score
|
|
80
|
+
console.print(f" [cyan]{name}: {score*100:.2f}% accuracy[/cyan]")
|
|
81
|
+
if score > best_score:
|
|
82
|
+
best_score = score
|
|
83
|
+
self.model = m
|
|
84
|
+
self.best_model_name = name
|
|
85
|
+
else:
|
|
86
|
+
models = {
|
|
87
|
+
'Random Forest': RandomForestRegressor(n_estimators=100, random_state=42),
|
|
88
|
+
'Linear Regression': LinearRegression()
|
|
89
|
+
}
|
|
90
|
+
best_score = -999
|
|
91
|
+
for name, m in models.items():
|
|
92
|
+
m.fit(self.X_train, self.y_train)
|
|
93
|
+
score = r2_score(self.y_test, m.predict(self.X_test))
|
|
94
|
+
self.results[name] = score
|
|
95
|
+
console.print(f" [cyan]{name}: R² = {score:.4f}[/cyan]")
|
|
96
|
+
if score > best_score:
|
|
97
|
+
best_score = score
|
|
98
|
+
self.model = m
|
|
99
|
+
self.best_model_name = name
|
|
100
|
+
|
|
101
|
+
# Step 7 - Save best model
|
|
102
|
+
joblib.dump(self.model, 'best_model.pkl')
|
|
103
|
+
console.print(f"\n[bold green]🏆 Best Model: {self.best_model_name}[/bold green]")
|
|
104
|
+
console.print("[green]✅ Model saved as best_model.pkl[/green]")
|
|
105
|
+
return self
|
|
106
|
+
|
|
107
|
+
def report(self):
|
|
108
|
+
console.print("\n[bold blue]====== AUTOMLEASE REPORT ======[/bold blue]\n")
|
|
109
|
+
|
|
110
|
+
# Results table
|
|
111
|
+
table = Table(title="Model Comparison")
|
|
112
|
+
table.add_column("Model", style="cyan")
|
|
113
|
+
table.add_column("Score", style="green")
|
|
114
|
+
for name, score in self.results.items():
|
|
115
|
+
marker = "🏆" if name == self.best_model_name else ""
|
|
116
|
+
if self.task_type == 'classification':
|
|
117
|
+
table.add_row(f"{marker} {name}", f"{score*100:.2f}%")
|
|
118
|
+
else:
|
|
119
|
+
table.add_row(f"{marker} {name}", f"R² = {score:.4f}")
|
|
120
|
+
console.print(table)
|
|
121
|
+
|
|
122
|
+
# Detailed report
|
|
123
|
+
y_pred = self.model.predict(self.X_test)
|
|
124
|
+
if self.task_type == 'classification':
|
|
125
|
+
console.print("\n[bold]Detailed Classification Report:[/bold]")
|
|
126
|
+
console.print(classification_report(self.y_test, y_pred))
|
|
127
|
+
else:
|
|
128
|
+
mse = mean_squared_error(self.y_test, y_pred)
|
|
129
|
+
r2 = r2_score(self.y_test, y_pred)
|
|
130
|
+
console.print(f"\n[bold]Regression Results:[/bold]")
|
|
131
|
+
console.print(f"Mean Squared Error: {mse:.4f}")
|
|
132
|
+
console.print(f"R² Score: {r2:.4f}")
|
|
133
|
+
|
|
134
|
+
# Feature importance chart
|
|
135
|
+
if hasattr(self.model, 'feature_importances_'):
|
|
136
|
+
console.print("\n[yellow]📊 Generating feature importance chart...[/yellow]")
|
|
137
|
+
importances = self.model.feature_importances_
|
|
138
|
+
feat_df = pd.DataFrame({
|
|
139
|
+
'Feature': self.feature_names,
|
|
140
|
+
'Importance': importances
|
|
141
|
+
}).sort_values('Importance', ascending=False).head(10)
|
|
142
|
+
|
|
143
|
+
plt.figure(figsize=(10, 6))
|
|
144
|
+
sns.barplot(data=feat_df, x='Importance', y='Feature', palette='viridis')
|
|
145
|
+
plt.title(f'Top Features — {self.best_model_name}')
|
|
146
|
+
plt.tight_layout()
|
|
147
|
+
plt.savefig('feature_importance.png')
|
|
148
|
+
plt.show()
|
|
149
|
+
console.print("[green]✅ Chart saved as feature_importance.png[/green]")
|
|
150
|
+
|
|
151
|
+
console.print("\n[bold green]====== REPORT COMPLETE ======[/bold green]\n")
|
|
152
|
+
|
|
153
|
+
def predict(self, data):
|
|
154
|
+
return self.model.predict(data)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: automlease
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Automatic Machine Learning for beginners — train ML models in 3 lines!
|
|
5
|
+
Home-page: https://github.com/vickybanna3327-byte/automlease
|
|
6
|
+
Author: Vikash Singh Rajput
|
|
7
|
+
Author-email: vickybanna3327@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: pandas
|
|
14
|
+
Requires-Dist: scikit-learn
|
|
15
|
+
Requires-Dist: matplotlib
|
|
16
|
+
Requires-Dist: seaborn
|
|
17
|
+
Requires-Dist: joblib
|
|
18
|
+
Requires-Dist: rich
|
|
19
|
+
Dynamic: author
|
|
20
|
+
Dynamic: author-email
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: requires-dist
|
|
26
|
+
Dynamic: requires-python
|
|
27
|
+
Dynamic: summary
|
|
28
|
+
|
|
29
|
+
# automlease 🤖
|
|
30
|
+
|
|
31
|
+
**Automatic Machine Learning for absolute beginners.**
|
|
32
|
+
Train a machine learning model in just 3 lines of Python code!
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
```bash
|
|
36
|
+
pip install automlease
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
```python
|
|
41
|
+
from automlease import AutoML
|
|
42
|
+
|
|
43
|
+
model = AutoML()
|
|
44
|
+
model.fit('your_data.csv', target='target_column')
|
|
45
|
+
model.report()
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## What it does automatically
|
|
49
|
+
|
|
50
|
+
- ✅ Loads any CSV file
|
|
51
|
+
- ✅ Cleans missing values
|
|
52
|
+
- ✅ Converts text columns to numbers
|
|
53
|
+
- ✅ Detects if task is classification or regression
|
|
54
|
+
- ✅ Trains multiple ML models and picks the best one
|
|
55
|
+
- ✅ Shows a detailed evaluation report
|
|
56
|
+
- ✅ Creates feature importance chart
|
|
57
|
+
- ✅ Saves the best model automatically
|
|
58
|
+
|
|
59
|
+
## Example — Heart Disease Prediction
|
|
60
|
+
```python
|
|
61
|
+
from automlease import AutoML
|
|
62
|
+
|
|
63
|
+
model = AutoML()
|
|
64
|
+
model.fit('heart_disease.csv', target='target')
|
|
65
|
+
model.report()
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Built With
|
|
69
|
+
|
|
70
|
+
- pandas
|
|
71
|
+
- scikit-learn
|
|
72
|
+
- matplotlib
|
|
73
|
+
- seaborn
|
|
74
|
+
- joblib
|
|
75
|
+
- rich
|
|
76
|
+
|
|
77
|
+
## Author
|
|
78
|
+
|
|
79
|
+
**Vikash Singh Rajput**
|
|
80
|
+
BTech Management Graduate — NAIT, Edmonton, Canada
|
|
81
|
+
GitHub: https://github.com/vickybanna3327-byte
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
MIT License
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
automlease
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="automlease",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
author="Vikash Singh Rajput",
|
|
7
|
+
author_email="vickybanna3327@gmail.com",
|
|
8
|
+
description="Automatic Machine Learning for beginners — train ML models in 3 lines!",
|
|
9
|
+
long_description=open("README.md").read(),
|
|
10
|
+
long_description_content_type="text/markdown",
|
|
11
|
+
url="https://github.com/vickybanna3327-byte/automlease",
|
|
12
|
+
packages=find_packages(),
|
|
13
|
+
classifiers=[
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
],
|
|
18
|
+
python_requires=">=3.8",
|
|
19
|
+
install_requires=[
|
|
20
|
+
"pandas",
|
|
21
|
+
"scikit-learn",
|
|
22
|
+
"matplotlib",
|
|
23
|
+
"seaborn",
|
|
24
|
+
"joblib",
|
|
25
|
+
"rich",
|
|
26
|
+
],
|
|
27
|
+
)
|