# deeper **Repository Path**: jtyoui/deepper ## Basic Information - **Project Name**: deeper - **Description**: 用Java写的分类算法,贝叶斯和决策树 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: http://www.tyoui.cn/ - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2018-01-12 - **Last Updated**: 2024-11-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # **deeper** [![tyoui](https://github.com/zhangwei0530/logo/blob/master/logo/photolog.png?raw=true)](http://www.tyoui.cn) [![](https://github.com/zhangwei0530/logo/blob/master/logo/logo.png?raw=true)](http://www.tyoui.cn) ## 这个一个平时自己学习数据分析的资料 [![](https://travis-ci.org/zhangyingwei/cockroach.svg?branch=master)]() [![](https://img.shields.io/badge/language-java-orange.svg)]() [![](https://img.shields.io/badge/jdk-1.8-green.svg)]() [![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) ## 可以用maven repository下载 cn.tyoui deeper 1.8.1 ### 详细步骤 数据都是文本格式,并且是UTF-8无BOM编码的格式。数据之间用\t(Tab键)隔开。放在resources下 无头名内容:比如: 打喷嚏 护士 感冒 打喷嚏 农夫 过敏 头痛 建筑工人 脑震荡 头痛 建筑工人 感冒 打喷嚏 教师 感冒 头痛 教师 脑震荡 数据为了防止错误,请使用notepad++保存。 ### 启动决策树分类(离散型) public static void main(String[] args) throws Exception { DT dt = new DT(); dt.readerData("student.txt");//读取文件 Tree trees = new Tree();//新建一个树 dt.loopTree(trees);//循环创建树 dt.writeTree(trees, "log.txt");//写出数据 } 注意:决策树现在只能支持离散型 ### 启动朴素贝叶斯(离散型和连续型 ) public static void main(String[] args) throws Exception { NBC nbc = new NBC(); nbc.readArrayFile("human.txt");//读取文本 List list = nbc.eigenvalue();//获取特征值 //4是指在第4列是连续型(非离散型),30.23是测试值 //nbc.setRowContinual(4, 30.23);//说明该值是连续型 for (String key : list) { double score = nbc.start("不帅", "不好", "矮", "不上进", key);//开始计算概率 System.out.println(key + "的概率是:" + score); } } ### 详细文档 [Deeper文档](http://doc.tyoui.cn/deeper)