<jupyter_start><jupyter_text>TASK 1 By <NAME><jupyter_code>import numpy as np
import pandas as pd 
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn import preprocessing
from sklearn import metrics
from sklearn.linear_model import LinearRegression 
from sklearn.model_selection import train_test_split
data = pd.read_csv("Student_scores_dataset.csv")
data.head(5)
data.info()
data.describe()
data.plot(x='Hours', y='Scores', style='o')  
plt.title('Hours vs Percentage')  
plt.xlabel('Hours Studied')  
plt.ylabel('Percentage Score')  
plt.show()<jupyter_output><empty_output><jupyter_text>*Data Preparation*<jupyter_code>x = data.iloc[:,:1].values  
y = data.iloc[:,1].values<jupyter_output><empty_output><jupyter_text>*Algorithm*<jupyter_code>x_train, x_test, y_train, y_test = train_test_split(x, y, test_size = 0.2, random_state = 60)
linear=LinearRegression()
linear.fit(x_train, y_train)
print("Training done")
c = float(linear.coef_[0])
d = float(linear.intercept_)
line = c*x + d
plt.plot(x,line)
plt.scatter(x,y)
plt.ylabel('Score')
plt.xlabel('Number of Hours')   
plt.title('Regression Line')  
plt.show()<jupyter_output><empty_output><jupyter_text>*Making Prediction*<jupyter_code>print(x_test)
ypred = linear.predict(x_test)
dataframe = pd.DataFrame({'Actual': y_test, 'Predicted': ypred})  
dataframe
hours = 9.25
own_pred = linear.predict(np.array([hours]).reshape(-1,1))
print("No of Hours = {}".format(hours))
print("Predicted Score = {}".format(own_pred[0]))<jupyter_output>No of Hours = 9.25
Predicted Score = 92.74757780643363<jupyter_text>Evaluation of the model<jupyter_code>print('Mean Absolute Error:',metrics.mean_absolute_error(y_test, ypred)) 
print("Mean Squared Error:",metrics.mean_squared_error(y_test, ypred))<jupyter_output>Mean Squared Error: 14.458645457297166
{'fraction_non_alphanumeric': 0.14183222958057395, 'fraction_numerical': 0.028145695364238412, 'mean_word_length': 7.931034482758621, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '489934', 'license': 'MIT', 'n_tokens_mistral': 740, 'n_tokens_neox': 677, 'n_words': 124, 'path': 'Task1/Linear_Regression.ipynb', 'repo_name': 'christi-john/Sparks', 'size': '1821'}