Dataset file我使用python中的贝叶斯模型预测没有人的价值观。我正在使用图片中给出的数据集。我的错误也附在图片
#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()
请帮我解决这个问题。我怎样才能完美地预测这些值呢
目前没有回答
相关问题 更多 >
编程相关推荐