瀏覽代碼

1- 测试。

bijl 5 年之前
父節點
當前提交
4d00be9d32

+ 1 - 1
algorithm/src/main/java/org/algorithm/core/neural/dataset/NNDataSet.java

@@ -96,7 +96,7 @@ public abstract class NNDataSet {
             diagnosis = nameAndValue.getName();
             for (String featureName : this.FEATURE_NAME_STORE) {
                 relatedDiagnoses = this.RELATED_DIAGNOSIS_DICT.get(featureName);
-                if (relatedDiagnoses != null && relatedDiagnoses.get(diagnosis) == 1) {
+                if (relatedDiagnoses != null && relatedDiagnoses.get(diagnosis) != null) {
                     result.put(nameAndValue.getName(), nameAndValue.getValue());
                     cnt += 1;
                 }

+ 3 - 2
algorithm/src/main/java/org/algorithm/core/neural/dataset/NNDataSetImpl.java

@@ -126,9 +126,10 @@ public class NNDataSetImpl extends NNDataSet {
         while (entries.hasNext()) {
             Entry<String, Map<String, String>> entry = entries.next();
             featureName = entry.getKey();
-            if (this.RE_SPLIT_WORD_DICT.get(featureName) != null) {
+            if (this.FEATURE_DICT.get(featureName) == null  // 特征字典中没有然后再分词
+                    && this.RE_SPLIT_WORD_DICT.get(featureName) != null) {
                 entries.remove();  // 移除该词项
-                splitWords = this.RE_SPLIT_WORD_DICT.get(featureName).split("_");
+                splitWords = this.RE_SPLIT_WORD_DICT.get(featureName).split(",");
                 for (String word : splitWords) {  // 添加细分词项
                     featureValues = new HashMap<>();
                     featureValues.put("negative", "有"); // 设置为阳性词

+ 5 - 4
algorithm/src/main/java/org/algorithm/test/TensorflowExcutorTest.java

@@ -1,5 +1,6 @@
 package org.algorithm.test;
 
+import org.algorithm.core.neural.DiagnosisPredictExecutor;
 import org.algorithm.core.neural.SymptomPredictExecutor;
 import org.algorithm.util.Utils;
 
@@ -13,9 +14,9 @@ public class TensorflowExcutorTest {
         
         //TODO:change VitalPredictExcutor to test different executors
 //        VitalPredictExecutor excutor = new VitalPredictExecutor();
-        SymptomPredictExecutor excutor = new SymptomPredictExecutor();
+//        SymptomPredictExecutor excutor = new SymptomPredictExecutor();
 //        LisPredictExecutor excutor = new LisPredictExecutor();
-//        DiagnosisPredictExecutor excutor = new DiagnosisPredictExecutor();
+        DiagnosisPredictExecutor excutor = new DiagnosisPredictExecutor();
 //        PacsPredictExecutor excutor = new PacsPredictExecutor();
 //        DiagnosisToLisExecutor excutor = new DiagnosisToLisExecutor();
 //        DiagnosisToPacsExecutor excutor = new DiagnosisToPacsExecutor();
@@ -75,7 +76,7 @@ public class TensorflowExcutorTest {
         featureValues.put("age", "34");
         featureValues.put("negative", "有");
         featureValues.put("sn", "0");
-        aMap.put("踝关节疼痛", featureValues);
+        aMap.put("左上腹持续性刀割样疼痛", featureValues);
 //        aMap.put("心悸", featureValues);
 //        aMap.put("气急", featureValues);
 //        aMap.put("头痛", featureValues);
@@ -87,7 +88,7 @@ public class TensorflowExcutorTest {
 //        for (Entry<String, Float> entry : result.entrySet()) {
 //            System.out.println(entry.getKey() + " : " + entry.getValue());
 //        }
-//        System.out.println(result);
+        System.out.println(result);
         Utils.top_k(10, result);
 
     }