Metadata-Version: 2.4
Name: numlearnl9
Version: 1.0.0
Summary: Educational Machine Learning lab practicals study companion (Experiments 2-9) with Matplotlib visualizations
Home-page: https://github.com/yourusername/numlearnl9
Author: Machine Learning Lab Student
Author-email: ML Lab Student <student@academic.edu>
License: MIT
Project-URL: Homepage, https://github.com/yourusername/numlearnl9
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Intended Audience :: Education
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.20.0
Requires-Dist: scipy>=1.7.0
Requires-Dist: scikit-learn>=1.0.0
Requires-Dist: matplotlib>=3.4.0
Requires-Dist: pandas>=1.3.0
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# `numlearnl9` - Machine Learning Lab Practicals Reference

**`numlearnl9`** is an educational Python reference package designed for computer science and data science engineering students working through undergraduate **Machine Learning Laboratory (Lab 9 / Practical Coursework)** assignments.

It provides modular implementations of standard machine learning lab experiments (Experiments 2 through 9), complete with mathematical explanations, evaluation metrics, and **Matplotlib visual plots** (decision boundaries, decision trees, scree plots, Kruskal's MST cuts, and DBSCAN density maps).

---

## 🎯 Educational Purpose & Scope

This package is intended as an **academic study reference and learning aid**:
* **Direct Inspection**: Review clean algorithmic code or deep-dive into step-by-step commented theory.
* **Visual Verification**: Observe algorithm mechanics through generated Matplotlib figures.
* **Reproducible Experiments**: Run standard datasets (Iris, Breast Cancer, synthetic clusters) under controlled random seeds.

---

## 📚 Curriculum & Experiments Covered

| Lab Exp | Title & Objective | Key Algorithm & Concept | Matplotlib Visualizations |
| :---: | :--- | :--- | :--- |
| **exp2** | **Linear & Logistic Regression** | Ordinary Least Squares (OLS) regression & binary classification via Sigmoid cross-entropy loss. | Scatter plot with fitted regression line; 2D decision boundary with probability contour mesh. |
| **exp3** | **CART Classification Tree** | Recursive binary partitioning using Gini Impurity index on 2D feature space. | Visual decision tree diagram (`plot_tree`) with Gini scores and sample counts; 2D decision boundary map. |
| **exp4** | **CART Regression Tree** | Piecewise constant function approximation minimizing squared error (variance reduction). | Step-function curves comparing depths (2 vs 5); regression tree diagram. |
| **exp5** | **Dimensionality Reduction (PCA)** | Eigen-decomposition of covariance matrix from scratch in NumPy vs Scikit-Learn. | Scree plot of individual and cumulative variance; 2D PCA projection scatter plot. |
| **exp6** | **Bagging & Random Forest** | Bootstrap Aggregation and random subspace sampling to reduce estimator variance. | Top 10 feature importances horizontal bar chart; Out-Of-Bag (OOB) error vs number of trees curve. |
| **exp7** | **Linear & Non-Linear SVM** | Maximal margin hyperplane with Linear vs RBF Kernel; Support Vector Regression (SVR). | Side-by-side linear vs non-linear RBF decision boundaries with support vectors circled; SVR fit curve. |
| **exp8** | **MST Graph-Based Clustering** | Complete Euclidean graph clustering via Kruskal's algorithm and cutting the $(k-1)$ longest edges. | Complete MST with cut edges highlighted in red dashed lines; resulting $k$ clusters with centroids. |
| **exp9** | **DBSCAN Density Clustering** | Non-parametric density clustering with core, border, and noise identification. | 5-NN K-Distance Elbow curve; 2D cluster scatter plot with core, border, and noise points. |

---

## 💻 Usage

### 1. In Python

```python
import numlearnl9

# View clean, uncommented code:
numlearnl9.exp(2)

# View code with detailed theoretical documentation and line comments:
numlearnl9.exp(2, comments=True)

# Directly run the experiment and open interactive Matplotlib windows:
numlearnl9.run(2)

# List all syllabus experiments:
numlearnl9.list_experiments()
```

### 2. Standalone Folder Access (`ml` and `mlc`)
If you extract the repository files locally, you can also import or run the scripts directly:

```python
import ml
ml.exp(2)        # Clean code

import mlc
mlc.exp(2)       # Commented code
```

### 3. Command Line Interface (CLI)

```bash
# View code for experiment 8
python -m numlearnl9 8

# View code with detailed comments
python -m numlearnl9 8 --comments

# Execute experiment 8 directly
python -m numlearnl9 8 --run

# List all experiments
python -m numlearnl9 --list
```

---

## 🛠️ Installation

```bash
pip install numlearnl9
```

**Prerequisites:**
* Python >= 3.8
* `numpy`, `scipy`, `scikit-learn`, `matplotlib`, `pandas`

---

## 📄 License
This educational project is distributed under the [MIT License](LICENSE).
