How to compare expected and predicted values

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

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

Jul 14, 2019 in Machine Learning by Rishi

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


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 14, 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,150 points
+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
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,570 points
+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,320 points
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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,472 views
0 votes
1 answer
0 votes
1 answer

Purpose of fit method in sklearn module in python?

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

answered May 14, 2020 in Python by Mahesh
• 140 points