|
|
@ -3,12 +3,14 @@ package com.sztzjy.marketing.util.algorithm;
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
import com.alibaba.excel.context.AnalysisContext;
|
|
|
|
import com.alibaba.excel.context.AnalysisContext;
|
|
|
|
import com.alibaba.excel.event.AnalysisEventListener;
|
|
|
|
import com.alibaba.excel.event.AnalysisEventListener;
|
|
|
|
|
|
|
|
import com.sztzjy.marketing.config.exception.handler.ServiceException;
|
|
|
|
import com.sztzjy.marketing.entity.dto.AssociationRulesDTO;
|
|
|
|
import com.sztzjy.marketing.entity.dto.AssociationRulesDTO;
|
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
import java.io.BufferedReader;
|
|
|
@ -67,6 +69,9 @@ public class Apriori {
|
|
|
|
|
|
|
|
|
|
|
|
//剪枝步:从候选集C中删除小于最小支持度的,并放入频繁集L中
|
|
|
|
//剪枝步:从候选集C中删除小于最小支持度的,并放入频繁集L中
|
|
|
|
public static void pruning(HashMap<ArrayList<String>, Integer> C,HashMap<ArrayList<String>, Integer> L,double min_support) {
|
|
|
|
public static void pruning(HashMap<ArrayList<String>, Integer> C,HashMap<ArrayList<String>, Integer> L,double min_support) {
|
|
|
|
|
|
|
|
if(min_support==0){
|
|
|
|
|
|
|
|
throw new ServiceException(HttpStatus.ACCEPTED,"最小支持度阀值不能为0");
|
|
|
|
|
|
|
|
}
|
|
|
|
L.clear();
|
|
|
|
L.clear();
|
|
|
|
// 根据项目集生成候选集
|
|
|
|
// 根据项目集生成候选集
|
|
|
|
L.putAll(C);
|
|
|
|
L.putAll(C);
|
|
|
|