素朴贝叶斯分类器的实现 (php)

WBOY
Release: 2016-06-13 11:01:26
Original
1260 people have browsed it

朴素贝叶斯分类器的实现 (php)

本文用php实现了一个朴素贝叶斯分类器,针对属性值为离散型变量的记录进行贝叶斯分类。

?

通过对sample.csv文件中数据的学习,得到分类模型,然后对predict.csv中的数据的类指标进行预测。

针对每个被预测数据,计算属于每个类的概率,然后概率最大的类就是该数据被预测的类归属。

?

附件中包含了程序文件:bys.php,样本文件:sample.csv,待预测数据文件:predict.csv。

?

?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!