ml-lab-codes
An educational Python library that provides instant access to complete source codes for Machine Learning Laboratory experiments (Experiments 1a to 5b).
Designed for students, educators, and developers to easily view, inspect, and copy verified lab experiment programs directly in the Python shell, terminal, or Jupyter/Colab notebooks without having to execute the scripts or download datasets.
Features
- Zero-Dependency Code Inspection: Display verified machine learning lab programs without downloading datasets or running heavy training loops.
- Single Function API: Use
show_code(program_number)to print the full source code for any program (1 to 5). - All Experiments Covered: Includes all sub-experiments (e.g. 1a & 1b, 3a & 3b, 4a & 4b, 5a & 5b) mapped into 5 self-contained programs.
Installation
Install via pip:
pip install ml-lab-codes
If you plan to run and execute the machine learning models locally, you can also install the optional ML dependencies:
pip install "ml-lab-codes[ml]"
Usage
Display Program Code
import ml_lab_codes
# Print the complete code for Experiment 1 (1a & 1b)
ml_lab_codes.show_code(1)
You can also import show_code directly:
from ml_lab_codes import show_code
# Display Experiment 3 (ID3 & CART Decision Trees)
show_code(3)
List All Available Programs
import ml_lab_codes
ml_lab_codes.list_programs()
Programme Mapping
| Number | Source File | Experiments Covered | Dataset Used |
|---|---|---|---|
| 1 | prog1.py |
Ex.No 1a: Linear Regression Ex.No 1b: Logistic Regression |
Student Performance Dataset Breast Cancer Wisconsin Dataset |
| 2 | prog2.py |
Ex.No 2: Naive Bayes Classifier | Wine Recognition Dataset |
| 3 | prog3.py |
Ex.No 3a: Decision Tree (ID3 Algorithm) Ex.No 3b: Decision Tree (CART Algorithm) |
Play Tennis Dataset Iris Dataset |
| 4 | prog4.py |
Ex.No 4a: Linear SVM Classifier Ex.No 4b: Non-Linear SVM Classifier (RBF Kernel) |
Online Food Ordering Dataset Online Food Ordering Dataset |
| 5 | prog5.py |
Ex.No 5a: k-Nearest Neighbor Classification Ex.No 5b: k-Nearest Neighbor Regression |
Iris Dataset Iris Dataset |
Error Handling
If an invalid or out-of-range program number is passed:
from ml_lab_codes import show_code
try:
show_code(6)
except ValueError as e:
print(e)
# Output: Invalid program number '6'. Please choose a number from 1 to 5.
License
MIT License. See LICENSE for details.
Metadata
Release files for ml-lab-codes 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ml_lab_codes-0.1.0.tar.gz | 14.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ml_lab_codes-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.3 kB
Release files / ml_lab_codes-0.1.0.tar.gz
| Download URL | ml_lab_codes-0.1.0.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d61f6563d276ba91b0c95306a6ea05d17620084c6840093d1f8323389f8d355d
|
|
BLAKE2b-256 checksum How to use checksums |
967c511b24e69ca7215f86df415966cf1c5fb538425dd608f1a64bfab68e38d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / ml_lab_codes-0.1.0-py3-none-any.whl
| Download URL | ml_lab_codes-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6f659549ab404da4487fd63ab721aa286a47cb9cf16a3d4ac857ebad86520be
|
|
BLAKE2b-256 checksum How to use checksums |
61d07e52464c7a86d8312777d047de4e111d53788806e7df3323f2d4b455662f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for ml-lab-codes 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.