Selaa lähdekoodia

feat: 添加随机森林的模型配置,保存rfModel;(todo: 细化model_type表数据,现阶段数据仅供测试使用)
feat: 自动执行插入data.sql

191250028 3 vuotta sitten
vanhempi
commit
a2712d774c

+ 1 - 0
java_compile/src/main/java/com/example/services/ModelService.java

@@ -298,6 +298,7 @@ public class ModelService {
                     HashMap<String,String> rfResult = rfClassification.dtResult(rfModel, modelId);
 
                     rsl = updateResOfModel(modelId,rfResult,rfModel);
+                    utils.storeModel(rfModel,modelId);
                     break;
                 case "GBDT":
                     /*

+ 3 - 0
java_compile/src/main/resources/application.properties

@@ -15,6 +15,9 @@ spring.datasource.username=root
 spring.datasource.password=123456
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 
+spring.datasource.data=classpath:data.sql
+spring.datasource.initialization-mode=always
+
 spring.jpa.hibernate.ddl-auto=update
 spring.jpa.show-sql=true
 

+ 6 - 0
java_compile/src/main/resources/data.sql

@@ -0,0 +1,6 @@
+
+delete from `model_type` where id > 0;
+
+INSERT INTO `model_type` VALUES (1,'{\"MaxIter\":10,\"RegParam\":0.5,\"ElasticNetParam\":0.8}','des','detail_des','LogisticRegression','LogisticRegression');
+
+INSERT INTO `model_type` VALUES (3,'{\"Category\":2,\"TrainingDataSetOccupy\":0.6}','des','detail_des','RandomForest','RandomForest');