数字营销实训算法第6-2轮修改

master
@t2652009480 7 months ago
parent e9d543a0b1
commit 36ad57b0dc

@ -342,8 +342,14 @@ public class StuDigitalMarketingModelServiceImpl implements StuDigitalMarketingM
}else { }else {
//查询导入的表数据 //查询导入的表数据
List<String> stringList=new ArrayList<>();
List<String> stringList=uploadExcelUserMapper.selectByString(userId,tableName); stringList=uploadExcelUserMapper.selectByString(userId,tableName);
//查询默认数据
if(stringList.isEmpty()){
stringList=uploadExcelUserMapper.selectByString("999999999",tableName);
}
for (String s : stringList) { for (String s : stringList) {
@ -401,7 +407,13 @@ public class StuDigitalMarketingModelServiceImpl implements StuDigitalMarketingM
String userId = analyzeDataDTO.getUserId(); String userId = analyzeDataDTO.getUserId();
String tableName = analyzeDataDTO.getTableName(); String tableName = analyzeDataDTO.getTableName();
List<Map<String,Object>> attributes = stuTableNameMapper.selectBuildTable(fieldList,table,userId,tableName); List<Map<String,Object>> attributes=new ArrayList<>();
attributes = stuTableNameMapper.selectBuildTable(fieldList,table,userId,tableName);
if(attributes.isEmpty()){
attributes = stuTableNameMapper.selectBuildTable(fieldList,table,"999999999",tableName);
}
for (int i = 0; i < attributes.size(); i++) { for (int i = 0; i < attributes.size(); i++) {

@ -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);

Loading…
Cancel
Save