Student Performance Prediction Using Machine Learning
1. Introduction
Artificial Intelligence (AI) enables machines to simulate human intelligence such as learning,
reasoning, and decision-making. A major branch of AI is Machine Learning (ML), which allows
computers to learn patterns from data and make predictions.
In education, AI can help teachers and students analyze performance patterns and identify factors
that influence academic success.
This project develops a machine learning model to predict student marks using multiple factors
including:
Study Hours
Attendance
Sleep Hours
Practice Test Scores
Classroom Participation
Unlike simple models that consider only one variable, this project uses multiple features, making the
prediction more realistic.
2. Objectives
The objectives of this project are:
To understand the basic concepts of Artificial Intelligence and Machine Learning
To apply the AI Project Cycle
To collect and analyze a dataset related to student performance
To build a Multiple Linear Regression model
To evaluate the prediction accuracy of the model
To understand how multiple factors affect academic performance
3. AI Project Cycle
This project follows the AI Project Cycle, which includes five important stages.
3.1 Problem Statement
Teachers and students often want to understand what factors influence student marks.
While study hours are important, other variables such as attendance, sleep quality, and practice tests
also affect performance.
Goal
Develop a machine learning model that predicts student marks based on multiple academic and
behavioral factors.
3.2 Data Acquisition
Data was collected for the following variables:
Feature Description
Study Hours Average hours studied per day
Attendance Percentage of classes attended
Sleep Hours Average daily sleep
Practice Test Score Score obtained in practice exams
Classroom Participation Engagement in class (1–10 scale)
Final Marks Final examination marks
Sample Dataset
Study Sleep Practice Final
Attendance Participation
Hours Hours Score Marks
2 65 6 40 3 45
3 70 7 45 4 50
4 72 7 50 5 55
5 75 6 55 6 60
6 80 7 60 7 68
7 85 7 65 8 75
8 88 8 70 8 82
9 92 8 75 9 88
10 95 8 80 10 94
For demonstration purposes, a small dataset is used, but real-world machine learning models require
much larger datasets.
3.3 Data Exploration
Data exploration helps identify relationships between variables.
Using Python libraries such as Pandas and Matplotlib, the dataset was analyzed and visualized.
Observations
Students studying 8–10 hours tend to score above 80 marks
Attendance above 85% strongly correlates with higher marks
Higher practice test scores usually lead to better final marks
Sleep between 6–8 hours appears beneficial for performance
Classroom participation positively influences results
These observations indicate that multiple factors influence academic success.
3.4 Modelling
The project uses Multiple Linear Regression, which predicts a value based on several independent
variables.
Python Implementation
import pandas as pd
import [Link] as plt
from sklearn.linear_model import LinearRegression
# -----------------------------
# Realistic Dataset
data = {
'StudyHours':[2,3,4,5,6,7,8,9,10],
'Attendance':[80,70,75,80,85,90,95,92,95],
'SleepHours':[7,6,7,7,6,7,7,6,7],
'PracticeScore':[40,45,50,55,60,65,70,75,80],
'Participation':[5,6,6,7,7,6,5,6,6],
'Marks':[50,52,58,65,70,72,75,78,82]
}
df = [Link](data)
print("----- Dataset -----")
print(df)
# -----------------------------
# Features and Target
X = df[['StudyHours','Attendance','SleepHours','PracticeScore','Participation']]
y = df['Marks']
# -----------------------------
# Create and Train Model
model = LinearRegression()
[Link](X, y)
print("\n----- Model Trained Successfully -----")
# -----------------------------
# Take input from user
print("\nEnter details of the student to predict marks:")
try:
study_hours = float(input("Study Hours: "))
attendance = float(input("Attendance (%): "))
sleep_hours = float(input("Sleep Hours: "))
practice_score = float(input("Practice Test Score: "))
participation = float(input("Classroom Participation (1-10): "))
except ValueError:
print("Invalid input! Please enter numeric values.")
exit()
new_student = [Link]([[study_hours, attendance, sleep_hours, practice_score, participation]],
columns=['StudyHours','Attendance','SleepHours','PracticeScore','Participation'])
# -----------------------------
# Predict and clamp between 0–100
predicted_marks = [Link](new_student)
predicted_marks = max(0, min(100, predicted_marks[0])) # Clamp to [0,100]
print(f"\nPredicted Marks for the student: {predicted_marks:.2f}")
# -----------------------------
# Graphs
# Graph 1: Study Hours vs Marks
[Link](figsize=(6,4))
[Link](df['StudyHours'], df['Marks'], color='blue')
[Link]('Study Hours')
[Link]('Marks')
[Link]('Study Hours vs Marks')
[Link](True)
[Link]()
# Graph 2: Attendance vs Marks
[Link](figsize=(6,4))
[Link](df['Attendance'], df['Marks'], color='green')
[Link]('Attendance (%)')
[Link]('Marks')
[Link]('Attendance vs Marks')
[Link](True)
[Link]()
# Graph 3: Practice Score vs Marks
[Link](figsize=(6,4))
[Link](df['PracticeScore'], df['Marks'], color='red')
[Link]('Practice Test Score')
[Link]('Marks')
[Link]('Practice Score vs Marks')
[Link](True)
[Link]()
# Graph 4: Classroom Participation vs Marks
[Link](figsize=(6,4))
[Link](df['Participation'], df['Marks'], color='orange')
[Link]('Classroom Participation')
[Link]('Marks')
[Link]('Participation vs Marks')
[Link](True)
[Link]()
The model learns the relationship between the input variables and the final marks.
3.5 Visualization
Graphs help visualize the relationship between variables.
Example graphs created:
Study Hours vs Marks
Attendance vs Marks
Practice Test Score vs Marks
Classroom Participation vs Marks
Scatter plots show a positive correlation between most variables and marks.
3.6 Evaluation
Evaluation Results
The model successfully predicts student marks using multiple factors
Predictions closely match actual marks in the dataset
Practice test scores and attendance appear to have strong influence
Using multiple variables improves prediction accuracy
4. Results
The machine learning model successfully predicts student marks based on five factors.
Key findings:
Study hours alone are not sufficient to determine performance
Attendance and practice tests significantly influence marks
Students with good participation and attendance perform better overall
5. Ethical Considerations
When using AI in education, ethical issues must be considered.
Student data must remain private and confidential
AI predictions should assist teachers, not replace them
Models should avoid bias or unfair evaluation
AI systems must be used responsibly in academic environments
6. Conclusion
This project demonstrates how Machine Learning can be applied in education to analyze student
performance.
By using multiple factors such as study hours, attendance, sleep, and practice tests, the model
provides a more realistic prediction of academic performance.
AI-based analysis can help educators better understand student learning patterns and support
academic improvement.