Skip to content

Instantly share code, notes, and snippets.

@odysseuskir
Last active October 27, 2023 20:42
Show Gist options
  • Save odysseuskir/bb15976a242310882c81cea5ec87cef0 to your computer and use it in GitHub Desktop.
Save odysseuskir/bb15976a242310882c81cea5ec87cef0 to your computer and use it in GitHub Desktop.
Getting in a public university in Greece requires candidates to take the Panhellenics examination. Your average grades from the exam, must be above the university's required minimum grade. That required minimum grade changes every year, so I made this script that forecasts that grade for next year. Accuracy has not been proven yet!
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
years = np.array(range(2004, 2024)).reshape(-1, 1)
required_gpa = np.array(
[17.1, 17.1, 16.8, 17.1, 17.1, 17.6, 17.8, 16.3, 16.3, 15.5, 16.3, 16.0, 16.0, 15.8, 16.4, 16.7, 16.8, 17.3, 17.1,
17.7]) # Change me!
poly = PolynomialFeatures(degree=2)
X_poly = poly.fit_transform(years)
model = LinearRegression()
model.fit(X_poly, required_gpa)
next_years = np.array([2024, 2025, 2026]).reshape(-1, 1)
next_years_poly = poly.transform(next_years)
predicted_gpa = model.predict(next_years_poly)
for year, gpa in zip(next_years, predicted_gpa):
print(f"Estimated required GPA for {year}: {gpa:.2f}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment