Grade Classifier

A small PyTorch model that predicts a school grade from a percentage between 0 and 100.

Educational project: The training data is artificially generated from fixed percentage ranges. This model is intended for learning and experimentation, not for real student assessment.

Model details

  • Framework: PyTorch
  • Task: Five-class classification
  • Input: One percentage value, normalized to 0.0–1.0
  • Output: Grade 1, 2, 3, 4, or 5
  • Architecture: Linear(1, 7) β†’ ReLU β†’ Linear(7, 5)
  • Recorded test accuracy: 99.90%

The synthetic data uses these ranges:

Percentage Grade
0–48.9% 1
49–61.9% 2
62–74.9% 3
75–88.9% 4
89–100% 5

Usage

import torch
import torch.nn as nn


model = nn.Sequential(
    nn.Linear(1, 7),
    nn.ReLU(),
    nn.Linear(7, 5),
)

state_dict = torch.load("best_model.pth", map_location="cpu", weights_only=True)
model.load_state_dict(state_dict)
model.eval()

percentage = 75.0
input_tensor = torch.tensor([[percentage / 100.0]], dtype=torch.float32)

with torch.no_grad():
    probabilities = torch.softmax(model(input_tensor), dim=1)[0]
    predicted_grade = probabilities.argmax().item() + 1

print(f"Predicted grade: {predicted_grade}")
print("Probabilities:", probabilities.tolist())

The model expects the uploaded weights file to be named best_model.pth.

Evaluation

The reported accuracy was measured on a randomly held-out synthetic test set. Because the data follows deterministic rules, accuracy can vary between runs, especially near the grade boundaries.

Repository

Source code, training scripts, the Google Colab notebook, and testing utilities are available on GitHub:

Jero009/grade-classifier

License

MIT

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support