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 14, 2019 in Machine Learning by Rishi

recategorized Sep 7, 2020 by MD 13,350 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 14, 2019 by Tina

Related Questions In Machine Learning

0 votes
1 answer

How to calculate ctc probability for given input and expected output?

The loss for a batch is defined ...READ MORE

answered Mar 17, 2022 in Machine Learning by Dev
• 6,000 points
778 views
0 votes
1 answer

How to add random and/or fixed effects into cloglog regression in R

The standard glm function can be used ...READ MORE

answered Apr 13, 2022 in Machine Learning by anonymous
703 views
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,220 points
18,804 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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,468 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
3,588 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP