【发布时间】:2025-12-13 03:50:01
【问题描述】:
我已经阅读了关于朴素贝叶斯的文章,它是一种分类技术算法,可以根据您提供的数据进行预测,但在这个示例中,我无法理解输出 [3,4] 的来源。
如下示例:
#assigning predictor and target variables
x= np.array([[-3,7],[1,5], [1,2], [-2,0], [2,3], [-4,0], [-1,1], [1,1], [-2,2], [2,7], [-4,1], [-2,7]])
Y = np.array([3, 3, 3, 3, 4, 3, 3, 4, 3, 4, 4, 4]
#Create a Gaussian Classifier
model = GaussianNB()
# Train the model using the training sets
model.fit(x, y)
#Predict Output
predicted= model.predict([[1,2],[3,4]])
print predicted
Output: ([3,4])
谁能解释在这种情况下 [3,4] 是如何生成的,这是什么意思?
【问题讨论】:
标签: python scikit-learn statistics naivebayes