ITEP 303 – WEB AND DATABASE INTEGRATION
Name : Group # :
Performance Task # : 2 Date :
Section: ML Model in Python
Activity Description
This laboratory activity introduces students to predictive modeling using real-world datasets
sourced from Kaggle or other open online repositories. Acting as junior data scientists and
backend developers, students will preprocess data, select features, and develop a machine learning
prediction model using Python.
In modern web-based systems, prediction models are widely used for:
Sales forecasting
Student performance prediction
User behavior analysis
Recommendation and decision-support systems
This activity simulates how prediction models are built before being deployed in web applications,
APIs, or database-driven systems.
The activity emphasizes:
Preparing datasets for machine learning
Selecting appropriate prediction techniques (Regression or Classification)
Training and evaluating a prediction model
Interpreting model performance metrics
Applying predictions to new user input data
Laboratory Objective
At the end of this laboratory activity, the students should be able to:
1. Select an appropriate dataset from Kaggle or any reliable online source
2. Clean and preprocess data for machine learning tasks
3. Identify input features and target variables
4. Develop a prediction model using:
Linear Regression or Decision Tree Regressor (for numeric prediction), or
Decision Tree Classifier (for categorical prediction)
5. Split data into training and testing sets
6. Evaluate model performance using suitable metrics (Accuracy, R² Score, F1 Score)
7. Use the trained model to generate predictions from new user inputs
8. Explain how prediction models can be integrated into web and database systems
Background
Prediction models are a core component of intelligent web systems. Before predictions can be
served through dashboards, APIs, or backend services, data must be prepared and models must be
trained and validated.
In this laboratory, students will build a simple yet complete end-to-end prediction pipeline,
similar to what is used in real-world applications such as:
Predicting student grades based on study hours
Predicting product sales
Classifying performance levels or customer categories
Dataset Requirements
Students may use:
Kaggle datasets ([Link] or
Any publicly available CSV dataset online
The dataset must:
Contain at least one numeric input feature
Contain one target variable (numeric or categorical)
Have at least 50 records
PART 1: Dataset Selection and Understanding
Task 1.1 – Dataset Selection
Download a dataset from Kaggle or another trusted source
Briefly describe the dataset and its real-world application
Task 1.2 – Initial Data Inspection
Use Pandas to inspect the dataset.
Guide Questions:
1. How many rows and columns are in the dataset?
2. What are the input features and target variable?
3. Are there missing or inconsistent values?
PART 2: Data Preprocessing
Task 2.1 – Handle Missing Values
Perform at least one of the following:
Remove rows with critical missing values
Fill missing numeric values using mean or median
Encode categorical values if necessary
Task 2.2 – Feature Selection
Select the most relevant feature(s) for prediction
Justify why these features were chosen
PART 3: Building the Prediction Model
Task 3.1 – Split the Dataset
Split the dataset into training and testing sets (e.g., 80% / 20%)
Task 3.2 – Model Development
Choose one model:
Linear Regression
Decision Tree Regressor
Decision Tree Classifier
Train the model using the training data.
PART 4: Model Evaluation
Task 4.1 – Performance Metrics
Use appropriate metrics:
∙ Regression: R² Score
∙ Classification: Accuracy, F1 Score, Confusion Matrix
Guide Questions:
1. How well does the model perform?
2. Is the model overfitting or underfitting?
PART 5: Making Predictions
Task 5.1 – User Input Prediction
Accept a sample input from the user
Use the trained model to generate a prediction
Task 5.2 – Interpretation
Explain what the prediction means in a real-world context
PART 6: Reflection and Application
Guide Questions:
1. How can this prediction model be integrated into a web system?
2. What improvements can be made to increase model accuracy?
3. Why is data preprocessing critical in prediction systems?
Laboratory Output Requirements
Students must submit:
1. Python script (.py file)
2. Dataset used (CSV format)
3. Screenshots of:
o Model performance output
o Sample prediction result
4. Short reflection (5–7 sentences)
Rubric for Grading
Criteria Excellent Very Satisfacto Needs Poi
(90– 100%) Good ry Improvement
(80–89 (70–79% (<70%)
%) ) nts
Dataset Appropriate Dataset Dataset Dataset
Selection & dataset with acceptable weakly inappropriate
Understanding clear justified
justification
Data Clean, well Minor Inconsiste Poor or missing 10
Preprocessing justified issues nt
preprocessing cleaning
20
Criteria Excellent Very Satisfacto Needs Poi
(90– 100%) Good ry Improvement
(80–89 (70–79% (<70%)
%) ) nts
Model Correct model Minor Model Model incorrect
Development selection and errors works but
20
training weak
Model Metrics Metrics Limited Missing/incorrect
Evaluation correct and correct interpretatio 15
well n
interpreted
Prediction & Accurate Good Basic No explanation 15
Interpretation prediction with explanatio explanation
strong n 10
explanation
Reflection & Strong Adequate Minimal Missing
Application real-world
integration
Code Quality Clean, Minor Disorganized Poor
& readable, issues
Organization well-comment
ed