Metadata-Version: 2.4
Name: practical08
Version: 0.7.7
Summary: Beginner-friendly ML practicals, runnable code, theory and viva questions
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Education
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.23
Requires-Dist: pandas>=1.5
Requires-Dist: scikit-learn>=1.2
Requires-Dist: matplotlib>=3.6
Requires-Dist: seaborn>=0.12
Dynamic: license-file

# Practical08 0.7.4

Practical08 provides 12 beginner-friendly machine-learning practicals, complete runnable starter code, Units I–VI theory, the supplied ML oral question-and-answer bank, and an expanded Program 12 loan-approval viva guide. The examples are written to work with the actual CSV filenames in the supplied dataset bundle.

## Install

```bash
python -m pip install -e .
```

Python 3.9+ is required. Dependencies: pandas, NumPy, scikit-learn, and Matplotlib. Market-basket mining is implemented internally and does **not** require `mlxtend`.

## Run

Place a dataset in your current folder, or pass its full path:

```python
from practical08 import run_practical, ask, get_code, explain, get_oral_questions, loan_viva

run_practical("heart", "heart.csv", show_plots=True)
run_practical("house", "house_price_prediction.csv", area=2000, show_plots=True)
ask("Unit V")
ask("sms")                 # prints code followed by a line-by-line explanation
ask("loan")                # prints the same Loan Approval code and line-by-line explanation
ask("oral")                # prints the full ML oral Q&A bank
ask("loan viva")           # prints Program 12 detailed viva guide
loan_viva()                # same Program 12 guide as a function
print(get_oral_questions("all"))
print(get_code("loan"))    # complete starter script for an installed package
print(explain("diabetes"))
```

`run_practical` keys: `heart`, `temperature`, `admission`, `sms`, `kmeans`, `apriori`, `ensemble`, `student`, `diabetes`, `titanic`, `house`, `loan`. Numeric practical numbers 1–12 also work.

## Dataset files

| # | Practical | Default CSV | Target / task |
|---|---|---|---|
| 1 | Heart preprocessing/classification | `heart.csv` | `target` |
| 2 | Temperature regression | `temperature.csv` | `AverageTemperatureFahr` |
| 3 | Graduate admission | `Admission_Prediction.csv` | binarized `Chance_of_Admit` |
| 4 | SMS spam | `SMS spam filtering Dataset.csv` | `v1` / `v2` |
| 5 | Customer segmentation | `Mall_Customers.csv` | K-Means on income/spending |
| 6 | Market basket | `Groceries_dataset.csv` | member/date/item transactions |
| 7 | Healthcare ensemble | `healthcare_disease_prediction_dataset.csv` | `DiseaseStatus` |
| 8 | Student result | `student_result_dataset.csv` | `Result` |
| 9 | Diabetes | `diabetes.csv` | `Outcome` |
| 10 | Titanic | `Titanic.csv` | `Survived` |
| 11 | House prices | `house_price_prediction.csv` | `price` from `sqft_living` |
| 12 | Loan approval | `Loan Prediction dataset.csv` | `Loan_Status` |

## Important notes

- Pass the CSV path explicitly if the file is not in the current working directory.
- The admission practical uses 0.5 as a teaching threshold to convert admission chance into a binary class; this is a modelling choice, not an official admissions decision.
- Student result modelling intentionally excludes `Final_Exam_Marks` to avoid target leakage when predicting the final result.
- The provided Titanic CSV includes `Survived`; another test-only Titanic file without that column cannot be used to evaluate a supervised classifier.
- Apriori support/confidence thresholds can be changed: `run_practical("apriori", path, min_support=0.005, min_confidence=0.5)`.
- Metrics are educational baselines, not guarantees of real-world performance.


## Added in v0.7.3: Viva and oral question bank

- `ask("oral")` displays exactly 150 numbered ML oral questions and answers.
- `ask("loan")` displays the practical code followed by a line-by-line explanation.
- `get_oral_questions("all")` returns the full oral question bank as text.
- `ask("loan viva")` or `loan_viva()` displays the detailed Program 12 guide.
- `get_oral_questions("loan")` returns the Program 12 guide as text.
- Both text resources are bundled inside the package and can be read offline once the package is installed. The ML practicals still require the runtime dependencies listed in `pyproject.toml`.


## Added in v0.7.4

- `ask("loan")` returns a standalone Loan Approval Decision Tree script, explanation, and viva questions.
- `ask("oral")` and `get_oral_questions("all")` provide exactly the first 150 numbered questions from the supplied oral bank.


## Jupyter Notebook usage (v0.7.5)
Load your dataset in a notebook cell yourself and assign it to `df`. Then run `from practical08 import ask; ask("loan")` to display complete code, explanation, and viva Q&A. `ask("oral")` displays the bundled 150 oral questions and answers. The practical snippets do not load CSV files or prompt for file paths. Column names must match the practical's expected schema.

## v0.7.7 output-format update
The code returned by `ask("loan")` and the other practical aliases is notebook-ready and assumes the dataset has already been loaded into a DataFrame named `df`. It does not ask for a path or load CSV files. This release updates templates to reflect the supplied practical documents, including Heart, Admission, Healthcare Bagging vs Boosting, Student Random Forest, Diabetes, Titanic, House Price, Loan Approval, Customer Segmentation, and Market Basket.


## v0.7.7 output format
`ask("12")` and `ask("loan")` are equivalent. Both print the full practical code first and a numbered line-by-line explanation afterward. Practical output does not include a problem statement, result section, or viva questions. Code assumes the dataset is already loaded as the pandas DataFrame `df`.
