<jupyter_start><jupyter_text>Project One:-><jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('student_scores - student_scores.csv')
print(df.head(5))<jupyter_output>Hours  Scores
0    2.5      21
1    5.1      47
2    3.2      27
3    8.5      75
4    3.5      30<jupyter_text>Plotting of data<jupyter_code>df.plot(x = 'Hours',y = 'Scores', style = 'o')
plt.title('Hours vs Percentage of Study')
plt.xlabel('Hours Studied')
plt.ylabel('Percentage Score')
plt.show()<jupyter_output><empty_output><jupyter_text>Seperate Data into X,y labels<jupyter_code>X = df.iloc[:,0].values
y = df.iloc[:,1].values
X.shape
X = X.reshape(-1,1)
Y = y.reshape(-1,1)
X.shape
# preparing the data-set.
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X,y,
                                                   test_size = 0.2, random_state = 0)<jupyter_output><empty_output><jupyter_text>Using Linear Regression<jupyter_code>#importing libraries
from sklearn.linear_model import LinearRegression
lr = LinearRegression()
lr.fit(X_train,y_train)
print('Linear Regression Complete')
line = lr.coef_*X + lr.intercept_

plt.scatter(X,y)
plt.plot(X,line)
plt.show()<jupyter_output><empty_output><jupyter_text>Prediction<jupyter_code>print(X_test)
y_pred = lr.predict(X_test)
print(y_pred)
df = pd.DataFrame({'Actual': y_test, 'Predicted': y_pred})
print(df)<jupyter_output>Actual  Predicted
0      20  16.884145
1      27  33.732261
2      69  75.357018
3      30  26.794801
4      62  60.491033<jupyter_text>Predicting for 9.25 hrs<jupyter_code>hrs = np.array([[9.25]])
hrs.reshape(-1,1)
prediction = lr.predict(hrs)
print(prediction)
from sklearn import metrics
print('Mean absolute Error:', metrics.mean_absolute_error(y_test,y_pred))<jupyter_output>Mean absolute Error: 4.183859899002975
{'fraction_non_alphanumeric': 0.12459893048128343, 'fraction_numerical': 0.06096256684491978, 'mean_word_length': 4.551928783382789, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '326781', 'license': 'MIT', 'n_tokens_mistral': 806, 'n_tokens_neox': 737, 'n_words': 141, 'path': 'Project_1.ipynb', 'repo_name': 'akashbisht81/Sparks_Foundation', 'size': '1870'}