How to compare expected and predicted values

0 votes
from sklearn.datasets import load_boston
boston_data = load_boston()
df = pd.DataFrame(boston_data.data , columns = boston_data.feature_names)
df
x = df
y = boston_data.target
x.columns
reg.fit(x,y)
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(x, y)
reg.fit(x_train, y_train)
predicted = reg.predict(x_test)
expected = y_test

How to I compare the predicted and expected values to understand the model?

Jul 13, 2019 in Machine Learning by Rishi

recategorized Sep 7, 2020 by MD 1,909 views
on basis of RMS value how would i know the accuracy of my model

Hi@Muhammad,

In RMSE, the errors are squared before they are averaged. This basically implies that RMSE assigns a higher weight to larger errors. This indicates that RMSE is much more useful when large errors are present and they drastically affect the model's performance. It avoids taking the absolute value of the error and this trait is useful in many mathematical calculations. In this metric also, the lower the value, the better is the performance of the model.

1 answer to this question.

0 votes

The predict() function returns a plain numpy array you can just represent it in a tabular format with original value to see the difference.

To check the accuracy of your model you can check out the RMS value. You can calculate RMS using the below code. 

import numpy as np
print("RMS: %r " % np.sqrt(np.mean((predicted - expected) ** 2)))
answered Jul 13, 2019 by Tina

Related Questions In Machine Learning

0 votes
1 answer
+1 vote
2 answers

ValueError: Not enough values to unpack

Make the following changes in your script, ...READ MORE

answered Jun 24, 2019 in Machine Learning by Omkar
• 69,090 points
12,308 views
+1 vote
1 answer

how to analysis the heatmap to find the correlation

Hi @Vikas, there are 5 simple steps ...READ MORE

answered Sep 30, 2019 in Machine Learning by Vishal
4,155 views
0 votes
0 answers

How to know if a problem is solvable by machine learning?

I have recently started learning the machine. ...READ MORE

Nov 21, 2019 in Machine Learning by Hannah
• 18,550 points
201 views
+1 vote
1 answer

not able to see all columns and rows of a pandas DataFrame?

Hi@akhtar, Your data set contains lots of rows ...READ MORE

answered Apr 8, 2020 in Machine Learning by MD
• 95,060 points
1,569 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,855 views
0 votes
0 answers
0 votes
1 answer

Purpose of fit method in sklearn module in python?

it basically trains your model using the ...READ MORE

answered May 13, 2020 in Python by Mahesh
• 140 points
1,573 views