数据挖掘课程设计Word格式.docx
- 文档编号:16797419
- 上传时间:2022-11-26
- 格式:DOCX
- 页数:9
- 大小:66.80KB
数据挖掘课程设计Word格式.docx
《数据挖掘课程设计Word格式.docx》由会员分享,可在线阅读,更多相关《数据挖掘课程设计Word格式.docx(9页珍藏版)》请在冰豆网上搜索。
如果在最高位包含2,4,8个不同的值,则将区间划分为4个等宽的区间。
如果在最高有效位包含1,5,10个不同的值,则将区间划分成5个等宽的区间。
该规则可以递归地用于每个区间,为给定的数值属性创建概念分层。
三.实验要求
用Java语言实现3-4-5规则划分算法。
四.实验准备
1.了解3-4-5规则划分的具体过程
2.具体详细的算法模块用什么方法实现分析
3.对总体进行可行性的研究
4.具体的编程实现3-4-5规则划分
5.算法优点缺点
优点:
可以将数据分割成相对一致、看上去自然的区间
缺点:
需要自己确定数据来开始分割,要有一定数据分析能力
五.实验步骤
六.功能代码
1.自定义数据的low和high的值为以后做准备
packagezhj;
publicclassData{
privateintlow;
privateinthigh;
publicData(intlow,inthigh){
this.low=low;
this.high=high;
}
publicStringtoStirng(){
return"
("
+low+"
"
+high+"
]"
;
publicintgetHigh(){
returnhigh;
publicvoidsetHigh(inthigh){
this.high=high;
publicintgetLow(){
returnlow;
publicvoidsetLow(intlow){
this.low=low;
}
2.基本功能代码
importjava.util.ArrayList;
publicclassMyData{
privateintmin;
privateintmax;
privateintlow=-159867;
privateinthigh=1838761;
privateintmsd;
privateintlow1;
privateinthigh1;
privateArrayList<
Data>
a=newArrayList<
();
//区间的存储
publicMyData(intmin,intmax){
this.min=min;
this.max=max;
this.msd=(int)(Math.pow(10,("
"
+max).length()-1));
this.low1=-msd;
this.high1=(Integer.parseInt((high+"
).substring(0,1))+1)*msd;
a.add(newData(low1,high1));
publicvoidthree(){//第三步
ArrayList<
a1=newArrayList<
a1.add(a.get(0));
a.removeAll(a);
//清空
inttemp=a1.get(0).getLow();
for(inti=0;
i<
count(a1.get(0));
i++){
temp+=msd;
//System.out.println("
temp="
+temp);
if(temp>
a1.get(0).getHigh()){
temp-=msd;
temp+=msd/10;
}
a.add(newData(a1.get(0).getLow()+temp,temp));
}
publicvoidfour(){//第四步
intlows=-(int)((Integer.parseInt((min+"
).substring(1,2))+1)*Math
.pow(10,(min+"
).length()-1));
inthighs=(int)((Integer.parseInt((max+"
).substring(0,1))+1)*Math
.pow(10,(max+"
a.remove(0);
a.add(0,newData(lows,0));
a.add(newData(a.get
(2).getHigh(),highs));
publicvoidfinall(){//第五步
//复制前一个区间集
a.size();
a1.add(a.get(i));
//清空区间
a1.size();
i++){//取出没个区间并且按照3-4-5规则划分
getInt(count(a1.get(i)),a1.get(i));
//if(!
isTrue()){//迭代
//finall();
//System.out.println(this.printA());
//}
publicbooleanisTrue(){//停止迭代的条件
if((a.get(i).getHigh()-a.get(i).getLow())<
100000){
returntrue;
}
returnfalse;
publicvoidgetInt(intk,Datad){//通过传进要划分的区间和将要划分为k个区间
intx=(d.getHigh()-d.getLow())/k;
//区间的步长
k;
a.add(newData(d.getLow()+i*x,d.getLow()+(i+1)*x));
//把最后一层的区间添加到区间列表
publicintcount(Datad){//返回下一个分区间的大小
intm=-1;
switch(counts(d)){
case1:
case5:
case10:
m=5;
break;
case3:
case6:
case9:
m=3;
case2:
case4:
case8:
m=4;
default:
//System.out.println("
default!
);
returnm;
publicintcounts(Datad){//计算1-10合法
intk;
k=(d.getHigh()-d.getLow())/msd;
if(k<
=10){
returnk;
}else{
k=10*(d.getHigh()-d.getLow())/msd;
returnk;
publicStringtoString(){
相关数据:
\n"
+"
min="
+min+"
\nmax="
+max+"
\nlow="
+low
+"
\nhigh="
+high+"
\nmsd="
+msd+"
\nlow1="
+low1
\nhigh1="
+high1+"
\n**************"
publicArrayList<
getA(){
returna;
publicvoidsetA(ArrayList<
a){
this.a=a;
publicStringprintA(){
Stringstr="
划分后的区间:
str+=a.get(i).toStirng()+"
returnstr;
publicstaticvoidmain(String[]args){
MyDatam=newMyData(-351976,4700896);
System.out.println(m);
System.out.println(m.printA());
m.three();
m.four();
m.finall();
七.实验结果
min=-351976
max=4700896
low=-159867
high=1838761
msd=1000000
low1=-1000000
high1=2000000
**************
(-1000000,2000000]
(-1000000,0]
(0,1000000]
(1000000,2000000]
(-4000000,0]
(2000000,5000000]
(-4000000,-3000000]
(-3000000,-2000000]
(-2000000,-1000000]
(0,200000]
(200000,400000]
(400000,600000]
(600000,800000]
(800000,1000000]
(1000000,1200000]
(1200000,1400000]
(1400000,1600000]
(1600000,1800000]
(1800000,2000000]
(2000000,3000000]
(3000000,4000000]
(4000000,5000000]
八.实验心得
通过此次课程设计,加强了对3-4-5规则划分的理解,也是自己的动手能力有所提高。
但是也让我发现了自己很多的不足之处,在JAVA编码的能力上还有待提高,希望以后能多有这样的课设让自己的能力可以提高。
这一次的课程设计编码阶段有几个同学给了我很大的帮助,也让我知道了团队协作能大大的提高工作效率,所以我也希望以后能有一些团队形式的锻炼。
总之这次课设让我学会了很多东西,对我有了许多的启发。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数据 挖掘 课程设计