breezeml 0.1.1__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.
breezeml-0.1.1/LICENSE ADDED
@@ -0,0 +1,2 @@
1
+ MIT License
2
+ Copyright (c) 2025 Akash
@@ -0,0 +1,3 @@
1
+ include LICENSE
2
+ include README.md
3
+ recursive-include examples *
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: breezeml
3
+ Version: 0.1.1
4
+ Summary: Beginner-friendly wrapper around scikit-learn: train, evaluate, explain, and compare ML models in one line.
5
+ Author-email: Akash Anipakalu Giridhar <your.email@example.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/your-username/breezeml
8
+ Project-URL: Repository, https://github.com/your-username/breezeml
9
+ Project-URL: Documentation, https://github.com/your-username/breezeml#readme
10
+ Keywords: machine-learning,scikit-learn,beginners,data-science,education
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: pandas>=1.3
24
+ Requires-Dist: numpy>=1.21
25
+ Requires-Dist: scikit-learn>=1.1
26
+ Requires-Dist: joblib>=1.1
27
+ Requires-Dist: matplotlib>=3.5
28
+ Dynamic: license-file
29
+
30
+ # BreezeML v0.1.0
31
+
32
+ If you can load a CSV, you can train a model.
33
+
34
+ Quickstart:
35
+ ```python
36
+ from breezeml import datasets, fit, predict, creator
37
+ print(creator())
38
+ df = datasets.iris()
39
+ model = fit(df, "species")
40
+ print(predict(model, df.drop(columns=["species"]))[:5])
41
+ ```
@@ -0,0 +1,12 @@
1
+ # BreezeML v0.1.0
2
+
3
+ If you can load a CSV, you can train a model.
4
+
5
+ Quickstart:
6
+ ```python
7
+ from breezeml import datasets, fit, predict, creator
8
+ print(creator())
9
+ df = datasets.iris()
10
+ model = fit(df, "species")
11
+ print(predict(model, df.drop(columns=["species"]))[:5])
12
+ ```
@@ -0,0 +1,7 @@
1
+ from .breezeml import (
2
+ EasyModel, classify, regress, auto,
3
+ fit, predict, from_csv, report, load,
4
+ save, creator, datasets
5
+ )
6
+
7
+ __version__ = "0.1.1"
@@ -0,0 +1,219 @@
1
+ """
2
+ BreezeML: Beginner-friendly wrapper around scikit-learn
3
+
4
+ Created by Akash Anipakalu Giridhar 🔥✨
5
+ (PATCH: compute RMSE via sqrt(MSE) to support older scikit-learn versions without 'squared' kwarg)
6
+ """
7
+ import pandas as pd
8
+ import numpy as np
9
+ import joblib
10
+
11
+ from sklearn.model_selection import train_test_split
12
+ from sklearn.preprocessing import StandardScaler, OneHotEncoder
13
+ from sklearn.impute import SimpleImputer
14
+ from sklearn.compose import ColumnTransformer
15
+ from sklearn.pipeline import Pipeline
16
+ from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
17
+ from sklearn.linear_model import LogisticRegression, LinearRegression
18
+ from sklearn.metrics import (
19
+ accuracy_score, f1_score,
20
+ r2_score, mean_absolute_error, mean_squared_error
21
+ )
22
+ from sklearn import datasets as skdatasets
23
+
24
+ __all__ = [
25
+ "classify", "regress", "fit", "predict", "from_csv",
26
+ "report", "save", "load", "auto", "creator", "datasets"
27
+ ]
28
+
29
+
30
+ class EasyModel:
31
+ def __init__(self, pipeline, target, task):
32
+ self.pipeline = pipeline
33
+ self.target = target
34
+ self.task = task
35
+
36
+ def predict(self, X):
37
+ return self.pipeline.predict(X)
38
+
39
+ def save(self, path):
40
+ joblib.dump(self, path)
41
+
42
+ @staticmethod
43
+ def load(path):
44
+ return joblib.load(path)
45
+
46
+
47
+ def _detect_types(df, target):
48
+ X = df.drop(columns=[target])
49
+ numeric = X.select_dtypes(include=[np.number]).columns
50
+ categorical = X.select_dtypes(exclude=[np.number]).columns
51
+ return list(numeric), list(categorical)
52
+
53
+
54
+ def _build_preprocessor(numeric, categorical):
55
+ num_pipe = Pipeline([
56
+ ("imputer", SimpleImputer(strategy="median")),
57
+ ("scaler", StandardScaler())
58
+ ])
59
+ cat_pipe = Pipeline([
60
+ ("imputer", SimpleImputer(strategy="most_frequent")),
61
+ ("onehot", OneHotEncoder(handle_unknown="ignore"))
62
+ ])
63
+ return ColumnTransformer([
64
+ ("num", num_pipe, numeric),
65
+ ("cat", cat_pipe, categorical)
66
+ ])
67
+
68
+
69
+ def classify(df, target, algo="forest", return_report=True):
70
+ X = df.drop(columns=[target])
71
+ y = df[target]
72
+ numeric, categorical = _detect_types(df, target)
73
+ pre = _build_preprocessor(numeric, categorical)
74
+
75
+ model = RandomForestClassifier(random_state=42) if algo == "forest" else LogisticRegression(max_iter=200)
76
+ pipe = Pipeline([("pre", pre), ("model", model)])
77
+
78
+ X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y, test_size=0.2, random_state=42)
79
+ pipe.fit(X_train, y_train)
80
+
81
+ em = EasyModel(pipe, target, "classification")
82
+
83
+ if not return_report:
84
+ return em
85
+ preds = pipe.predict(X_test)
86
+ report = {
87
+ "accuracy": float(accuracy_score(y_test, preds)),
88
+ "f1": float(f1_score(y_test, preds, average="weighted"))
89
+ }
90
+ return em, report
91
+
92
+
93
+ def regress(df, target, algo="forest", return_report=True):
94
+ X = df.drop(columns=[target])
95
+ y = df[target]
96
+ numeric, categorical = _detect_types(df, target)
97
+ pre = _build_preprocessor(numeric, categorical)
98
+
99
+ model = RandomForestRegressor(random_state=42) if algo == "forest" else LinearRegression()
100
+ pipe = Pipeline([("pre", pre), ("model", model)])
101
+
102
+ X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
103
+ pipe.fit(X_train, y_train)
104
+
105
+ em = EasyModel(pipe, target, "regression")
106
+
107
+ if not return_report:
108
+ return em
109
+ preds = pipe.predict(X_test)
110
+ mse = mean_squared_error(y_test, preds) # avoid 'squared' kwarg for compatibility
111
+ rmse = float(np.sqrt(mse))
112
+ report = {
113
+ "r2": float(r2_score(y_test, preds)),
114
+ "mae": float(mean_absolute_error(y_test, preds)),
115
+ "rmse": rmse
116
+ }
117
+ return em, report
118
+
119
+
120
+ def fit(df, target):
121
+ y = df[target]
122
+ if y.dtype == "object" or y.nunique() < 20:
123
+ m, _ = classify(df, target)
124
+ else:
125
+ m, _ = regress(df, target)
126
+ return m
127
+
128
+
129
+ def predict(model, X):
130
+ return model.predict(X)
131
+
132
+
133
+ def from_csv(path, target):
134
+ df = pd.read_csv(path)
135
+ model = fit(df, target)
136
+ y = df[target]
137
+ preds = model.predict(df.drop(columns=[target]))
138
+
139
+ if model.task == "classification":
140
+ return model, {
141
+ "accuracy": float(accuracy_score(y, preds)),
142
+ "f1": float(f1_score(y, preds, average="weighted"))
143
+ }
144
+ else:
145
+ mse = mean_squared_error(y, preds)
146
+ rmse = float(np.sqrt(mse))
147
+ return model, {
148
+ "r2": float(r2_score(y, preds)),
149
+ "mae": float(mean_absolute_error(y, preds)),
150
+ "rmse": rmse
151
+ }
152
+
153
+
154
+ def report(model, df):
155
+ y = df[model.target]
156
+ preds = model.predict(df.drop(columns=[model.target]))
157
+ if model.task == "classification":
158
+ return {
159
+ "accuracy": float(accuracy_score(y, preds)),
160
+ "f1": float(f1_score(y, preds, average="weighted"))
161
+ }
162
+ else:
163
+ mse = mean_squared_error(y, preds)
164
+ rmse = float(np.sqrt(mse))
165
+ return {
166
+ "r2": float(r2_score(y, preds)),
167
+ "mae": float(mean_absolute_error(y, preds)),
168
+ "rmse": rmse
169
+ }
170
+
171
+
172
+ def save(model, path):
173
+ model.save(path)
174
+
175
+
176
+ def load(path):
177
+ return EasyModel.load(path)
178
+
179
+
180
+ def auto(df, target):
181
+ """Automatically pick classification or regression based on target."""
182
+ y = df[target]
183
+ if y.dtype == "object" or y.nunique() < 20:
184
+ return classify(df, target)
185
+ else:
186
+ return regress(df, target)
187
+
188
+
189
+ def creator():
190
+ return "Created by Akash Anipakalu Giridhar 🔥✨"
191
+
192
+
193
+ class datasets:
194
+ @staticmethod
195
+ def iris():
196
+ data = skdatasets.load_iris(as_frame=True)
197
+ df = data.frame.copy()
198
+ df.rename(columns={"target": "species"}, inplace=True)
199
+ return df
200
+
201
+ @staticmethod
202
+ def breast_cancer():
203
+ data = skdatasets.load_breast_cancer(as_frame=True)
204
+ df = data.frame.copy()
205
+ df.rename(columns={"target": "label"}, inplace=True)
206
+ return df
207
+
208
+ @staticmethod
209
+ def wine():
210
+ data = skdatasets.load_wine(as_frame=True)
211
+ df = data.frame.copy()
212
+ df.rename(columns={"target": "class"}, inplace=True)
213
+ return df
214
+
215
+ @staticmethod
216
+ def diabetes():
217
+ data = skdatasets.load_diabetes(as_frame=True)
218
+ df = data.frame.copy()
219
+ return df
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: breezeml
3
+ Version: 0.1.1
4
+ Summary: Beginner-friendly wrapper around scikit-learn: train, evaluate, explain, and compare ML models in one line.
5
+ Author-email: Akash Anipakalu Giridhar <your.email@example.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/your-username/breezeml
8
+ Project-URL: Repository, https://github.com/your-username/breezeml
9
+ Project-URL: Documentation, https://github.com/your-username/breezeml#readme
10
+ Keywords: machine-learning,scikit-learn,beginners,data-science,education
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: pandas>=1.3
24
+ Requires-Dist: numpy>=1.21
25
+ Requires-Dist: scikit-learn>=1.1
26
+ Requires-Dist: joblib>=1.1
27
+ Requires-Dist: matplotlib>=3.5
28
+ Dynamic: license-file
29
+
30
+ # BreezeML v0.1.0
31
+
32
+ If you can load a CSV, you can train a model.
33
+
34
+ Quickstart:
35
+ ```python
36
+ from breezeml import datasets, fit, predict, creator
37
+ print(creator())
38
+ df = datasets.iris()
39
+ model = fit(df, "species")
40
+ print(predict(model, df.drop(columns=["species"]))[:5])
41
+ ```
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ breezeml/__init__.py
6
+ breezeml/breezeml.py
7
+ breezeml.egg-info/PKG-INFO
8
+ breezeml.egg-info/SOURCES.txt
9
+ breezeml.egg-info/dependency_links.txt
10
+ breezeml.egg-info/requires.txt
11
+ breezeml.egg-info/top_level.txt
12
+ examples/test_classification.py
13
+ examples/test_regression.py
14
+ examples/test_save_load.py
@@ -0,0 +1,5 @@
1
+ pandas>=1.3
2
+ numpy>=1.21
3
+ scikit-learn>=1.1
4
+ joblib>=1.1
5
+ matplotlib>=3.5
@@ -0,0 +1 @@
1
+ breezeml
@@ -0,0 +1,7 @@
1
+ from breezeml import datasets, fit, predict, creator
2
+
3
+ print("Easter Egg:", creator())
4
+ df = datasets.iris()
5
+ model = fit(df, "species")
6
+ yhat = predict(model, df.drop(columns=["species"]))
7
+ print("First 10 predictions:", yhat[:10])
@@ -0,0 +1,7 @@
1
+ from breezeml import datasets, fit, predict
2
+
3
+ print("Running regression test...")
4
+ df = datasets.diabetes()
5
+ model = fit(df, "target")
6
+ yhat = predict(model, df.drop(columns=["target"]))
7
+ print("First 10 predictions:", yhat[:10])
@@ -0,0 +1,28 @@
1
+ from breezeml import datasets, fit, save, load, predict
2
+
3
+ print("Running save/load test...")
4
+
5
+ # Train a simple model on Iris
6
+ df = datasets.iris()
7
+ model = fit(df, "species")
8
+
9
+ # Save to disk
10
+ model_path = "iris_model.joblib"
11
+ save(model, model_path)
12
+ print(f"Model saved to: {model_path}")
13
+
14
+ # Load back
15
+ loaded = load(model_path)
16
+ print("Model loaded.")
17
+
18
+ # Sanity check: predictions should match (on same data)
19
+ X = df.drop(columns=["species"])
20
+ orig_pred = predict(model, X)[:10]
21
+ loaded_pred = predict(loaded, X)[:10]
22
+
23
+ print("Original preds (first 10):", orig_pred)
24
+ print("Loaded preds (first 10):", loaded_pred)
25
+
26
+ # Optional: assert equality for the first 50 rows
27
+ same = (orig_pred[:50] == loaded_pred[:50]).all()
28
+ print("Do first 50 predictions match?", bool(same))
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "breezeml"
7
+ version = "0.1.1"
8
+ description = "Beginner-friendly wrapper around scikit-learn: train, evaluate, explain, and compare ML models in one line."
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.8"
12
+ authors = [
13
+ {name = "Akash Anipakalu Giridhar", email = "your.email@example.com"}
14
+ ]
15
+ keywords = ["machine-learning", "scikit-learn", "beginners", "data-science", "education"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Education",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.8",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
26
+ ]
27
+ dependencies = [
28
+ "pandas>=1.3",
29
+ "numpy>=1.21",
30
+ "scikit-learn>=1.1",
31
+ "joblib>=1.1",
32
+ "matplotlib>=3.5"
33
+ ]
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/your-username/breezeml"
37
+ Repository = "https://github.com/your-username/breezeml"
38
+ Documentation = "https://github.com/your-username/breezeml#readme"
39
+
40
+ [tool.setuptools.packages.find]
41
+ where = [""]
42
+ include = ["breezeml*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+