# 数据挖掘实验Java代码
**Repository Path**: breezewangsz/data-mining-experiment
## Basic Information
- **Project Name**: 数据挖掘实验Java代码
- **Description**: 数据挖掘实验Java代码
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 0
- **Created**: 2023-03-08
- **Last Updated**: 2023-03-16
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 环境
JDK1.8(重要)
lib(存放jar包)jar包引入 点击第一个jar包按住shift在点击最后一个jar包鼠标右击即可全选。
# 运行
## 1.Main
## arff文件转换为关系表文本文件input.txt
`可以使用Weka软件将arff文件转换为关系表文本文件input.txt,具体步骤如下:`
1. `打开Weka软件,选择“Explorer”界面。`
2. `点击“Open file”按钮,选择要转换的arff文件并打开。`
3. `在“Preprocess”选项卡中,选择“Open file”按钮,然后选择要转换的arff文件。`
4. `在“Preprocess”选项卡中,选择“Save as”按钮,在弹出窗口中选择“CSV (comma delimited)”格式。`
5. `选择要保存的文件路径和文件名,然后点击“Save”按钮。`
6. `转换完成后,在指定的路径中找到生成的CSV文件,可以用记事本或其他文本编辑器打开。`
7. `将CSV文件中的逗号替换为制表符,以便将其作为关系表文本文件打开和使用。`
8. `将替换后的文件保存为input.txt文件即可。 以上就是将arff文件转换为关系表文本文件input.txt的步骤。`
### 结果
```
支持度阈值:0.002285;实例数:14;属性数:4;项数:35
1项集:
数量:6;最大频次:6
2项集:
数量:8;最大频次:3
3项集:
数量:1;最大频次:2
4项集:
数量:14;最大频次:1
模式总数量:29
模式平均长度:2.5;平均数量:7.25;平均频次:3.0
模式与实例长度比:0.625;数量比:0.5178571428571429;频次比:0.21428571428571427
4项集频次:1;
4项集频次:1;
4项集频次:1;
4项集频次:1;
4项集频次:1;
4项集频次:1;
4项集频次:1;
4项集频次:1;
4项集频次:1;
4项集频次:1;
4项集频次:1;
4项集频次:1;
4项集频次:1;
4项集频次:1;
```
## 2.运行LoadArffFile
```
@relation weather.symbolic
@attribute outlook {sunny,overcast,rainy}
@attribute temperature {hot,mild,cool}
@attribute humidity {high,normal}
@attribute windy {TRUE,FALSE}
@attribute play {yes,no}
@data
sunny,hot,high,FALSE,no
sunny,hot,high,TRUE,no
overcast,hot,high,FALSE,yes
rainy,mild,high,FALSE,yes
rainy,cool,normal,FALSE,yes
rainy,cool,normal,TRUE,no
overcast,cool,normal,TRUE,yes
sunny,mild,high,FALSE,no
sunny,cool,normal,FALSE,yes
rainy,mild,normal,FALSE,yes
sunny,mild,normal,TRUE,yes
overcast,mild,high,TRUE,yes
overcast,hot,normal,FALSE,yes
rainy,mild,high,TRUE,no
@relation weather.symbolic
@attribute outlook {sunny,overcast,rainy}
@attribute temperature {hot,mild,cool}
@attribute humidity {high,normal}
@attribute windy {TRUE,FALSE}
@attribute play {yes,no}
@data
sunny,hot,high,FALSE,no
sunny,hot,high,TRUE,no
overcast,hot,high,FALSE,yes
rainy,mild,high,FALSE,yes
rainy,cool,normal,FALSE,yes
rainy,cool,normal,TRUE,no
overcast,cool,normal,TRUE,yes
sunny,mild,high,FALSE,no
sunny,cool,normal,FALSE,yes
rainy,mild,normal,FALSE,yes
sunny,mild,normal,TRUE,yes
overcast,mild,high,TRUE,yes
overcast,hot,normal,FALSE,yes
rainy,mild,high,TRUE,no
进程已结束,退出代码为 0
```
## 3.运行J48Classifier
```
J48 unpruned tree
------------------
outlook = sunny
| humidity <= 75: yes (2.0)
| humidity > 75: no (3.0)
outlook = overcast: yes (4.0)
outlook = rainy
| windy = TRUE: no (2.0)
| windy = FALSE: yes (3.0)
Number of Leaves : 5
Size of the tree : 8
```