Marks Prediction of Students in Machine Learning
Free Machine Learning courses with 130+ real-time projects Start Now!!
Program 1
# Machine Learning model for student marks predication import pandas as pd import numpy as np import matplotlib.pyplot as plt import os from sklearn import linear_model mydf=pd.read_excel("D://MLFile/result.xlsx") mymodel=linear_model.LinearRegression() mymodel.fit(mydf.drop('marks',axis='columns'),mydf.marks) # Trained Data set h=float(input("Enter hours for Marks Predication: ")) alpha=mymodel.intercept_ beta=mymodel.coef_ y=alpha+beta*h os.system('cls') print(mydf) print("Predicated Marks :",mymodel.predict([[h]])) print("Predicated Marks as per Fourmla :",y) mynewdf=pd.read_excel("D://MLFile/nohours.xlsx") mymrk=mymodel.predict((mynewdf)) print(mymrk) mynewdf['Marks']=mymrk print(mynewdf) mynewdf.to_excel("D://MLFile/newResult.xlsx") print("--------Predication done successfully-------------------")
Did you like this article? If Yes, please give DataFlair 5 Stars on Google