ARTIFICIAL INTELLIGENCE PRACTICAL FILE
Project: AI-Based Growth / Disease Risk Prediction (Random Forest + Anomaly Detection)
Student: Ratnadip Ghosh | Class XII – Humanities | KV No. 2 Kanchrapara | Roll: 12667621
INDEX
1. Project Aim & Overview
2. Dataset & Features
3. Workflow Diagram
4. Code 0 – Imports
5. Code 1 – Load + Encode + Train
6. Code 2 – Summary Card
7. Code 3 – Training (Short)
8. Code 4 – Prediction Output
9. Code 5 – Anomaly Detection
10. Code 6 – Evaluation
11. Code 6B – Confusion Matrix Save
12. Code 7 – Output Folder
13. Code 8 – Save Confusion Matrix PNG
14. Code 9 – Feature Importance PNG
15. Code 10 – Trend Graph PNG
16. Code 11 – Sample Table PNG
17. Code 12 – Accuracy Card PNG
18. Code 13 – Export CSV
19–28. Results & Reference Visuals (Evidence Pages)
1. Project Aim & Overview
A supervised Machine Learning model (Random Forest) is trained to predict Growth_Status / risk class from
structured health indicators. The system also flags anomalies using Z-score rules and saves outputs (charts/tables)
as PNG images for documentation.
2. Dataset & Features
Inputs used: Age_months, Height_z, Weight_z, BMI_z, ASD_score, ID_risk (encoded). Target: Growth_Status
(encoded). Train/test split is stratified to keep class balance during evaluation.
3. Workflow Diagram
Figure: End-to-end AI workflow used in this project.
4. Code 0 – Imports
Purpose: Load libraries for data, ML, and plotting.
Impact: Enables full pipeline execution.
Figure: Code block (captured as image for guaranteed visibility).
Figure: Related output/diagram.
5. Code 1 – Load + Encode + Train
Purpose: Prepare data and train Random Forest.
Impact: Builds the main prediction model and prints accuracy/report.
Figure: Code block (captured as image for guaranteed visibility).
Figure: Related output/diagram.
6. Code 2 – Summary Card
Purpose: Generate a clean test summary image.
Impact: Adds a professional visual result for documentation.
Figure: Code block (captured as image for guaranteed visibility).
7. Code 3 – Training (Short)
Purpose: A simplified training block.
Impact: Easy explanation for practical file evaluation.
Figure: Code block (captured as image for guaranteed visibility).
8. Code 4 – Prediction Output
Purpose: Predict and print sample outputs.
Impact: Demonstrates working predictions on test cases.
Figure: Code block (captured as image for guaranteed visibility).
9. Code 5 – Anomaly Detection
Purpose: Flag extreme Z-score deviations.
Impact: Adds extra detection layer beyond classification.
Figure: Code block (captured as image for guaranteed visibility).
10. Code 6 – Evaluation
Purpose: Accuracy + report + confusion matrix plot.
Impact: Provides measurable proof of model performance.
Figure: Code block (captured as image for guaranteed visibility).
11. Code 6B – Confusion Matrix Save
Purpose: Save labeled confusion matrix PNG.
Impact: Produces a clean image for your practical file.
Figure: Code block (captured as image for guaranteed visibility).
12. Code 7 – Output Folder
Purpose: Create output directory + safe filenames.
Impact: Organizes all generated images properly.
Figure: Code block (captured as image for guaranteed visibility).
13. Code 8 – Save Confusion Matrix PNG
Purpose: Export confusion matrix to folder.
Impact: No manual screenshots needed.
Figure: Code block (captured as image for guaranteed visibility).
14. Code 9 – Feature Importance PNG
Purpose: Plot and save feature importances.
Impact: Improves interpretability (which features matter).
Figure: Code block (captured as image for guaranteed visibility).
15. Code 10 – Trend Graph PNG
Purpose: Plot growth trend for a child over time.
Impact: Adds time-series style analysis.
Figure: Code block (captured as image for guaranteed visibility).
16. Code 11 – Sample Table PNG
Purpose: Save prediction table as image.
Impact: Clear evidence of actual vs predicted.
Figure: Code block (captured as image for guaranteed visibility).
17. Code 12 – Accuracy Card PNG
Purpose: Save final accuracy card.
Impact: Strong presentation of final results.
Figure: Code block (captured as image for guaranteed visibility).
18. Code 13 – Export CSV
Purpose: Save cleaned dataset + predictions.
Impact: Completes the pipeline with exports.
Figure: Code block (captured as image for guaranteed visibility).
19. Results & Reference Visuals
The following pages contain output visuals and reference diagrams used to support evaluation.
Evidence Page 19
Figure: Visual evidence / supporting diagram.
Evidence Page 20
Figure: Visual evidence / supporting diagram.
Evidence Page 21
Figure: Visual evidence / supporting diagram.
Evidence Page 22
Figure: Visual evidence / supporting diagram.
Evidence Page 23
Figure: Visual evidence / supporting diagram.
Evidence Page 24
Figure: Visual evidence / supporting diagram.
Evidence Page 25
Figure: Visual evidence / supporting diagram.
Evidence Page 26
Figure: Visual evidence / supporting diagram.
Evidence Page 27
Figure: Visual evidence / supporting diagram.
Conclusion
This practical file shows the complete AI workflow with visible code (as images) and supporting visuals. It documents
preprocessing, Random Forest training, prediction, anomaly detection, evaluation, and automated output saving.