Predicting values using Bayesian model and getting error

299 Views Asked by At

Dataset fileI am predicting no_of_people values using bayesian model in python. I am using this dataset given in picture.my error is also attached in the picture Dataset sample Error in prediction

#My code is here 
import numpy as np
from pgmpy.models import BayesianModel
import pandas as pd
data = pd.read_csv('C:/Users/hp/Desktop/file3.csv')
train = data[:40]
test = data[40:].drop('no_of_people', axis=1)
restaurant_model = BayesianModel(
[('location', 'cost'),
('quality', 'cost'),
('location', 'no_of_people'),
('cost', 'no_of_people')])
restaurant_model.fit(train)
restaurant_model.get_cpds()
restaurant_model.predict(test).values.ravel()

Please help me to solve this problem. How can I predict these values perfectly.

0

There are 0 best solutions below