BUC算法的java实现
发布日期:2021-05-06 00:52:27 浏览次数:12 分类:技术文章

本文共 1989 字,大约阅读时间需要 6 分钟。

import java.util.ArrayList;import java.util.Arrays;import java.io.BufferedReader;import java.io.File;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.IOException;public class BUC {       private String [][] dataSet;    private ArrayList
dimension; private ArrayList
inputList; private ArrayList
removeList; private Integer minSup; public BUC(int rank, int col,Integer minSup, String filename) { this.dataSet = new String[rank][col]; this.dimension = new ArrayList
(); this.minSup = minSup; this.inputList = new ArrayList
(); this.removeList = new ArrayList
(); this.readFile(filename); this.getDimension(); this.getOutput(0); } //读取csv数据到dataSet里面 public void readFile(String filename){ File inFile = new File(filename); // 读取的CSV文件 String inString = ""; try { BufferedReader reader = new BufferedReader(new FileReader(inFile)); inString = reader.readLine(); String [] tempRank = null; for(int i=0;inString!=null;i++){ tempRank = inString.split(","); for(int j=0;j
getDimension(ArrayList
a){ for(int i=0;i
getDimension(ArrayList
a,Integer k){ if(k>this.dataSet[0].length){ return null; }else { for(int i=0;i
endSet = new ArrayList
(); for(int i=0;i
t){ boolean flag = true; for(int i=0;i
tempSet = new ArrayList
(); this.getDimension(tempSet); Integer [] SetCount = new Integer[tempSet.size()]; for(int i=0;i
=this.minSup){ this.inputList.add(tempSet.get(i)+"<"+SetCount[i]+">"); }else { this.removeList.add(tempSet.get(i)); } } }else { ArrayList
tempSet = new ArrayList
(); tempSet = this.getDimension(tempSet,dim); this.removeList = new ArrayList
(); Integer [] SetCount = new Integer[tempSet.size()]; for(int i=0;i
=this.minSup){ this.inputList.add(tempSet.get(i)+"<"+SetCount[i]+">"); }else { this.removeList.add(tempSet.get(i)); } } System.out.println("输出结果为:"+this.inputList.toString()); } } //工作函数 public void getOutput(int dim){ if(dim

在这里插入图片描述

上一篇:redis
下一篇:linux一些基础查询操作(迅速查看电脑状态)

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2025年04月06日 04时19分37秒