quicklearnkit 0.3.2__tar.gz → 0.4.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.
Files changed (22) hide show
  1. quicklearnkit-0.4.1/PKG-INFO +88 -0
  2. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/pyproject.toml +1 -1
  3. quicklearnkit-0.4.1/quicklearnkit/pipeline.py +255 -0
  4. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/quicklearnkit/quickimports.py +2 -1
  5. quicklearnkit-0.4.1/quicklearnkit.egg-info/PKG-INFO +88 -0
  6. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/quicklearnkit.egg-info/SOURCES.txt +1 -0
  7. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/quicklearnkit.egg-info/top_level.txt +1 -0
  8. quicklearnkit-0.4.1/readme.md +50 -0
  9. quicklearnkit-0.3.2/PKG-INFO +0 -429
  10. quicklearnkit-0.3.2/quicklearnkit.egg-info/PKG-INFO +0 -429
  11. quicklearnkit-0.3.2/readme.md +0 -391
  12. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/LICENSE +0 -0
  13. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/quicklearnkit/__init__.py +0 -0
  14. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/quicklearnkit/classifier.py +0 -0
  15. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/quicklearnkit/plotting.py +0 -0
  16. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/quicklearnkit/randomizer.py +0 -0
  17. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/quicklearnkit/regressor.py +0 -0
  18. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/quicklearnkit/split.py +0 -0
  19. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/quicklearnkit/utils.py +0 -0
  20. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/quicklearnkit.egg-info/dependency_links.txt +0 -0
  21. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/quicklearnkit.egg-info/requires.txt +0 -0
  22. {quicklearnkit-0.3.2 → quicklearnkit-0.4.1}/setup.cfg +0 -0
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.4
2
+ Name: quicklearnkit
3
+ Version: 0.4.1
4
+ Summary: Learning-first machine learning utilities library for simplified imports, sampling, splitting, and probabilistic preprocessing.
5
+ Author: Hazi Afrid
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Masterhazi
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Requires-Python: >=3.8
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: numpy
32
+ Requires-Dist: pandas
33
+ Requires-Dist: scikit-learn
34
+ Requires-Dist: xgboost
35
+ Requires-Dist: seaborn
36
+ Requires-Dist: matplotlib
37
+ Dynamic: license-file
38
+
39
+
40
+ # QuickLearnKit
41
+
42
+ [![PyPI version](https://img.shields.io/pypi/v/quicklearnkit.svg)](https://pypi.org/project/quicklearnkit/)
43
+ [![Python versions](https://img.shields.io/pypi/pyversions/quicklearnkit.svg)](https://pypi.org/project/quicklearnkit/)
44
+ [![Documentation Status](https://readthedocs.org/projects/quicklearnkit/badge/?version=latest)](https://quicklearnkit.readthedocs.io/en/latest/)
45
+ [![License](https://img.shields.io/pypi/l/quicklearnkit.svg)](LICENSE)
46
+
47
+ QuickLearnKit is a **learning-first machine learning utilities library** designed to simplify common ML workflows while preserving full control for advanced users.
48
+
49
+ It provides:
50
+
51
+ - Simplified model imports
52
+ - Sampling and dataset utilities
53
+ - Train–test splitting
54
+ - Probabilistic, group-aware imputation
55
+ - Teaching-friendly visualization wrappers
56
+ - Notebook → Script pipeline compilation
57
+
58
+ ---
59
+
60
+ ## Installation
61
+
62
+ ```bash
63
+ pip install quicklearnkit
64
+ ````
65
+
66
+ ---
67
+
68
+ ## Documentation
69
+
70
+ Full documentation is available at:
71
+
72
+ 👉 [https://quicklearnkit.readthedocs.io/en/latest/](https://quicklearnkit.readthedocs.io/en/latest/)
73
+
74
+ ---
75
+
76
+ ## Philosophy
77
+
78
+ > Remove mechanical friction so students can focus on concepts, not syntax.
79
+
80
+ QuickLearnKit bridges:
81
+
82
+ Learning → Experimentation → Structured building
83
+
84
+ ---
85
+
86
+ ## License
87
+
88
+ MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "quicklearnkit"
7
- version = "0.3.2"
7
+ version = "0.4.1"
8
8
  description = "Learning-first machine learning utilities library for simplified imports, sampling, splitting, and probabilistic preprocessing."
9
9
  readme = "readme.md"
10
10
  license = { file = "LICENSE" }
@@ -0,0 +1,255 @@
1
+ import inspect
2
+ from typing import Callable, List, Dict, Optional
3
+
4
+
5
+ class Pipeline:
6
+ def __init__(self):
7
+ self._committed: List[Dict] = []
8
+ self._compiled: bool = False
9
+ self._imports = set()
10
+
11
+
12
+ def commit(
13
+ self,
14
+ func: Callable = None,
15
+ inputs: Optional[List[str]] = None,
16
+ outputs: Optional[List[str]] = None,
17
+ stage: Optional[str] = None,
18
+ mode: Optional[str] = None,
19
+ ):
20
+
21
+ # Semi-auto commit mode
22
+
23
+ if mode == "functions":
24
+ import inspect
25
+
26
+ caller_globals = inspect.currentframe().f_back.f_globals
27
+ new_functions = []
28
+
29
+ for name, obj in caller_globals.items():
30
+
31
+ if not inspect.isfunction(obj):
32
+ continue
33
+
34
+ if not hasattr(obj, "__code__"):
35
+ continue
36
+
37
+ # Must belong to caller's module
38
+ if obj.__module__ != caller_globals.get("__name__"):
39
+ continue
40
+
41
+ # Skip private
42
+ if name.startswith("_"):
43
+ continue
44
+
45
+ # Ensure top-level only
46
+ if obj.__qualname__ != obj.__name__:
47
+ continue
48
+
49
+ # Skip already committed
50
+ if any(entry["func"] == obj for entry in self._committed):
51
+ continue
52
+
53
+ new_functions.append(obj)
54
+
55
+ if not new_functions:
56
+ print("[QuickLearn] ⚠ No new top-level functions found.")
57
+ return
58
+
59
+ for fn in new_functions:
60
+ self._committed.append({
61
+ "func": fn,
62
+ "inputs": [],
63
+ "outputs": [],
64
+ "stage": stage or "General"
65
+ })
66
+ print(f"[QuickLearn] ✅ Auto-committed: {fn.__name__}")
67
+
68
+ return
69
+
70
+ if self._compiled:
71
+ raise RuntimeError("Pipeline already compiled. Reset before committing again.")
72
+
73
+ if not callable(func):
74
+ raise TypeError("commit() expects a callable function.")
75
+
76
+ # Guard: func must be provided in manual mode
77
+ if func is None:
78
+ raise ValueError("commit() requires a function unless mode='functions' is used.")
79
+
80
+ # Guard: block lambdas
81
+ if func.__name__ == "<lambda>":
82
+ raise ValueError("Cannot commit lambda functions.")
83
+
84
+ # Guard: only allow top-level functions
85
+ if func.__qualname__ != func.__name__:
86
+ raise ValueError("Only top-level functions can be committed.")
87
+
88
+ # Guard: must be user-defined Python function (not builtin)
89
+ if not hasattr(func, "__code__"):
90
+ raise ValueError("Only user-defined Python functions can be committed.")
91
+
92
+
93
+ for entry in self._committed:
94
+ if entry["func"] == func:
95
+ # Update metadata instead of skipping
96
+ if inputs is not None:
97
+ entry["inputs"] = inputs
98
+ if outputs is not None:
99
+ entry["outputs"] = outputs
100
+ if stage is not None:
101
+ entry["stage"] = stage
102
+
103
+ print(f"[QuickLearn] 🔄 Updated metadata for: {func.__name__}")
104
+ return
105
+
106
+ self._committed.append({
107
+ "func": func,
108
+ "inputs": inputs or [],
109
+ "outputs": outputs or [],
110
+ "stage": stage or "General"
111
+ })
112
+
113
+ print(f"[QuickLearn] ✅ Committed: {func.__name__}")
114
+
115
+ def summary(self):
116
+ if not self._committed:
117
+ print("[QuickLearn] No committed functions.")
118
+ return
119
+
120
+ print("\n[QuickLearn] 📦 Pipeline Summary\n")
121
+
122
+ for i, entry in enumerate(self._committed, start=1):
123
+ print(f"{i}. {entry['func'].__name__}")
124
+ print(f" Stage: {entry['stage']}")
125
+ print(f" Inputs: {entry['inputs']}")
126
+ print(f" Outputs: {entry['outputs']}\n")
127
+
128
+ def add_import(self, imports):
129
+ before = len(self._imports)
130
+ if isinstance(imports, str):
131
+ lines = imports.strip().split("\n")
132
+ elif isinstance(imports, list):
133
+ lines = imports
134
+ else:
135
+ raise TypeError("add_import() expects a string or list of strings.")
136
+ for line in lines:
137
+ cleaned = line.strip()
138
+ if not cleaned:
139
+ continue
140
+
141
+ if not (cleaned.startswith("import ") or cleaned.startswith("from ")):
142
+ raise ValueError(f"Invalid import statement: {cleaned}")
143
+
144
+ self._imports.add(cleaned)
145
+ after = len(self._imports)
146
+ print(f"[QuickLearn] 📦 Registered {after - before} new import(s).")
147
+
148
+
149
+ def _validate_dependencies(self, strict: bool = False):
150
+ print("[QuickLearn] 🔍 Validating dependencies...")
151
+
152
+ available_outputs = set()
153
+ warnings = []
154
+
155
+ for entry in self._committed:
156
+ func_name = entry["func"].__name__
157
+ inputs = entry["inputs"]
158
+ outputs = entry["outputs"]
159
+
160
+ # Check for missing inputs
161
+ missing = [inp for inp in inputs if inp not in available_outputs]
162
+
163
+ if missing:
164
+ message = (
165
+ f"[QuickLearn Warning] '{func_name}' expects input(s) {missing} "
166
+ f"which were not produced by previous steps."
167
+ )
168
+ warnings.append(message)
169
+
170
+ # Check for duplicate outputs
171
+ duplicates = [out for out in outputs if out in available_outputs]
172
+ if duplicates:
173
+ message = (
174
+ f"[QuickLearn Warning] '{func_name}' produces duplicate output(s) {duplicates}."
175
+ )
176
+ warnings.append(message)
177
+
178
+ available_outputs.update(outputs)
179
+
180
+ if warnings:
181
+ if strict:
182
+ raise RuntimeError("\n".join(warnings))
183
+ else:
184
+ for w in warnings:
185
+ print(w)
186
+ print(f"[QuickLearn] ⚠ {len(warnings)} warning(s) detected.")
187
+ else:
188
+ print("[QuickLearn] ✅ No dependency issues detected.")
189
+
190
+
191
+
192
+ def compile(self, filename: str, validate: bool | str = True, group_comments: bool = True):
193
+
194
+ if self._compiled:
195
+ raise RuntimeError("Pipeline already compiled.")
196
+
197
+ if not self._committed:
198
+ raise RuntimeError("No committed functions found. Nothing to compile.")
199
+
200
+ print(f"[QuickLearn] 🚀 Compiling {len(self._committed)} committed functions...")
201
+
202
+ if validate:
203
+ if validate == "strict":
204
+ self._validate_dependencies(strict=True)
205
+ else:
206
+ self._validate_dependencies(strict=False)
207
+
208
+
209
+ with open(filename, "w") as f:
210
+
211
+ # Warn if no imports registered
212
+ if not self._imports:
213
+ print("[QuickLearn Warning] No imports registered. Compiled file may fail if dependencies are missing.")
214
+
215
+ # Write registered imports
216
+ for imp in sorted(self._imports):
217
+ f.write(imp + "\n")
218
+
219
+ if self._imports:
220
+ f.write("\n\n")
221
+
222
+ current_stage = None
223
+
224
+ for entry in self._committed:
225
+
226
+ if group_comments and entry["stage"] != current_stage:
227
+ current_stage = entry["stage"]
228
+ f.write("# ==============================\n")
229
+ f.write(f"# {current_stage}\n")
230
+ f.write("# ==============================\n\n")
231
+
232
+ try:
233
+ source = inspect.getsource(entry["func"])
234
+ except OSError:
235
+ raise RuntimeError(
236
+ f"Could not retrieve source for function '{entry['func'].__name__}'. "
237
+ "Ensure it is defined in a proper Python file or notebook cell."
238
+ )
239
+
240
+ f.write(source)
241
+ f.write("\n\n")
242
+
243
+ f.write("if __name__ == '__main__':\n")
244
+ f.write(" print('Pipeline ready.')\n")
245
+
246
+ self._compiled = True
247
+ print("[QuickLearn] ✅ Compilation successful.")
248
+ print(f"[QuickLearn] 📄 Pipeline written to '{filename}'")
249
+
250
+
251
+ def reset(self):
252
+ self._committed.clear()
253
+ self._compiled = False
254
+ self._imports.clear()
255
+ print("[QuickLearn] 🔄 Pipeline reset.")
@@ -11,6 +11,7 @@ from .classifier import LogisticRegressionmodel, KNeighborsClassifiermodel, Deci
11
11
  from .utils import create_random, ProbabilisticImputer
12
12
  from .randomizer import Sampler
13
13
  from .split import train_test_split
14
+ from .pipeline import Pipeline
14
15
  from .plotting import (
15
16
  bar_plot,
16
17
  line_plot,
@@ -26,6 +27,6 @@ __all__=[
26
27
  'KNeighborsClassifiermodel', 'DecisionTreeClassifiermodel', 'RandomForestClassifiermodel','AdaBoostClassifiermodel',
27
28
  'GradientBoostingClassifiermodel', 'XGBClassifiermodel', 'SVClassifiermodel',
28
29
  'create_random', 'Sampler', 'train_test_split', "ProbabilisticImputer","bar_plot", "line_plot", "scatter_plot", "count_plot", "box_plot",
29
- "hist_plot",
30
+ "hist_plot", "Pipeline",
30
31
  ]
31
32
 
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.4
2
+ Name: quicklearnkit
3
+ Version: 0.4.1
4
+ Summary: Learning-first machine learning utilities library for simplified imports, sampling, splitting, and probabilistic preprocessing.
5
+ Author: Hazi Afrid
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Masterhazi
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Requires-Python: >=3.8
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: numpy
32
+ Requires-Dist: pandas
33
+ Requires-Dist: scikit-learn
34
+ Requires-Dist: xgboost
35
+ Requires-Dist: seaborn
36
+ Requires-Dist: matplotlib
37
+ Dynamic: license-file
38
+
39
+
40
+ # QuickLearnKit
41
+
42
+ [![PyPI version](https://img.shields.io/pypi/v/quicklearnkit.svg)](https://pypi.org/project/quicklearnkit/)
43
+ [![Python versions](https://img.shields.io/pypi/pyversions/quicklearnkit.svg)](https://pypi.org/project/quicklearnkit/)
44
+ [![Documentation Status](https://readthedocs.org/projects/quicklearnkit/badge/?version=latest)](https://quicklearnkit.readthedocs.io/en/latest/)
45
+ [![License](https://img.shields.io/pypi/l/quicklearnkit.svg)](LICENSE)
46
+
47
+ QuickLearnKit is a **learning-first machine learning utilities library** designed to simplify common ML workflows while preserving full control for advanced users.
48
+
49
+ It provides:
50
+
51
+ - Simplified model imports
52
+ - Sampling and dataset utilities
53
+ - Train–test splitting
54
+ - Probabilistic, group-aware imputation
55
+ - Teaching-friendly visualization wrappers
56
+ - Notebook → Script pipeline compilation
57
+
58
+ ---
59
+
60
+ ## Installation
61
+
62
+ ```bash
63
+ pip install quicklearnkit
64
+ ````
65
+
66
+ ---
67
+
68
+ ## Documentation
69
+
70
+ Full documentation is available at:
71
+
72
+ 👉 [https://quicklearnkit.readthedocs.io/en/latest/](https://quicklearnkit.readthedocs.io/en/latest/)
73
+
74
+ ---
75
+
76
+ ## Philosophy
77
+
78
+ > Remove mechanical friction so students can focus on concepts, not syntax.
79
+
80
+ QuickLearnKit bridges:
81
+
82
+ Learning → Experimentation → Structured building
83
+
84
+ ---
85
+
86
+ ## License
87
+
88
+ MIT License
@@ -3,6 +3,7 @@ pyproject.toml
3
3
  readme.md
4
4
  quicklearnkit/__init__.py
5
5
  quicklearnkit/classifier.py
6
+ quicklearnkit/pipeline.py
6
7
  quicklearnkit/plotting.py
7
8
  quicklearnkit/quickimports.py
8
9
  quicklearnkit/randomizer.py
@@ -0,0 +1,50 @@
1
+
2
+ # QuickLearnKit
3
+
4
+ [![PyPI version](https://img.shields.io/pypi/v/quicklearnkit.svg)](https://pypi.org/project/quicklearnkit/)
5
+ [![Python versions](https://img.shields.io/pypi/pyversions/quicklearnkit.svg)](https://pypi.org/project/quicklearnkit/)
6
+ [![Documentation Status](https://readthedocs.org/projects/quicklearnkit/badge/?version=latest)](https://quicklearnkit.readthedocs.io/en/latest/)
7
+ [![License](https://img.shields.io/pypi/l/quicklearnkit.svg)](LICENSE)
8
+
9
+ QuickLearnKit is a **learning-first machine learning utilities library** designed to simplify common ML workflows while preserving full control for advanced users.
10
+
11
+ It provides:
12
+
13
+ - Simplified model imports
14
+ - Sampling and dataset utilities
15
+ - Train–test splitting
16
+ - Probabilistic, group-aware imputation
17
+ - Teaching-friendly visualization wrappers
18
+ - Notebook → Script pipeline compilation
19
+
20
+ ---
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ pip install quicklearnkit
26
+ ````
27
+
28
+ ---
29
+
30
+ ## Documentation
31
+
32
+ Full documentation is available at:
33
+
34
+ 👉 [https://quicklearnkit.readthedocs.io/en/latest/](https://quicklearnkit.readthedocs.io/en/latest/)
35
+
36
+ ---
37
+
38
+ ## Philosophy
39
+
40
+ > Remove mechanical friction so students can focus on concepts, not syntax.
41
+
42
+ QuickLearnKit bridges:
43
+
44
+ Learning → Experimentation → Structured building
45
+
46
+ ---
47
+
48
+ ## License
49
+
50
+ MIT License