<jupyter_start><jupyter_text>From the visualization , we can clearly see that there is a positive linear relation between the number of hours studied and percentage of score.  Preparing the Data for Model evaluation<jupyter_code># Creating Attributes(inputs) & labels(outputs)
X = df.iloc[:, :-1].values  
y = df.iloc[:, 1].values  
# For model Evaluation : We need to Split the data into Training & testing
from sklearn.model_selection import train_test_split  
X_train, X_test, y_train, y_test = train_test_split(X,y, 
                            test_size=0.3, random_state=0)<jupyter_output><empty_output><jupyter_text>Model Creation<jupyter_code>from sklearn.linear_model import LinearRegression
#creating Liner Regression model & fiting the model
model = LinearRegression()
model.fit(X_train,y_train)
#Equation coefficent and intercept
print ('the estimated intercept %.2f '%model.intercept_)
print ('the coefficient is %d ' %len(model.coef_))
# Plotting the regression line
line = model.coef_*X+model.intercept_

# Plotting for the test data
plt.scatter(X, y)
plt.plot(X, line,color="purple")
plt.show()<jupyter_output><empty_output><jupyter_text>Making predictions of model<jupyter_code># Comparing Actual vs Predicted
y_pred = model.predict(X_test) 
test_df = pd.DataFrame({'Actual': y_test, 'Predicted': y_pred})  
test_df<jupyter_output><empty_output><jupyter_text>Model Evaluation: This Step is to check the performance of the algorithm, We use here Mean absolute error<jupyter_code>from sklearn import metrics  
print('Mean Absolute Error:', 
      metrics.mean_absolute_error(y_test, y_pred))<jupyter_output>Mean Absolute Error: 4.419727808027652<jupyter_text>Testing your own input:<jupyter_code>hrs = [9.25]
score_pred = model.predict([hrs])
print("Predicted Score of Studing 9.25 Hours = {}".format(score_pred[0]))<jupyter_output>Predicted Score of Studing 9.25 Hours = 92.91505723477056
{'fraction_non_alphanumeric': 0.09821428571428571, 'fraction_numerical': 0.025210084033613446, 'mean_word_length': 6.134831460674158, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '228121', 'license': 'Unlicense', 'n_tokens_mistral': 672, 'n_tokens_neox': 618, 'n_words': 170, 'path': 'Task _ 1 Prediction using Supervised ML.ipynb', 'repo_name': 'ankitapiu/Supervised-Linear_Regression', 'size': '1904'}