From c944d262f552e879056be33fd7b80b79d46d7c0e Mon Sep 17 00:00:00 2001 From: Maharshpatel1709 <54908868+Maharshpatel1709@users.noreply.github.com> Date: Thu, 1 Oct 2020 01:44:30 +0530 Subject: [PATCH] Update Simple_Linear_Regression.py Added a function which shows the accuracy of the linear model. --- Simple_Linear_Regression.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Simple_Linear_Regression.py b/Simple_Linear_Regression.py index e36f0d4..c03a734 100644 --- a/Simple_Linear_Regression.py +++ b/Simple_Linear_Regression.py @@ -27,6 +27,10 @@ Y_Pred = regressor.predict(X_Test) +# Showing accuracy of the model + +acc = regressor.score(X_Test, Y_Test) +print(acc) # Visualising the Training set results @@ -44,4 +48,4 @@ plt.title('Salary vs Experience (Training Set)') plt.xlabel('Years of experience') plt.ylabel('Salary') -plt.show() \ No newline at end of file +plt.show()