使用贝叶斯模型预测值并获得错误

问题描述

Dataset file我在 Python 中使用贝叶斯模型预测 no_of_people 值。我正在使用图片中给出的这个数据集。我的错误也附在图片

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',('location','no_of_people'),('cost','no_of_people')])
restaurant_model.fit(train)
restaurant_model.get_cpds()
restaurant_model.predict(test).values.ravel()

请帮我解决这个问题。我如何才能完美地预测这些值。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)