package org.algorithm.test;

import org.algorithm.core.neural.dataset.NNDataSet;
import org.algorithm.core.neural.dataset.NNDataSetImplNonParallel;

import java.util.HashMap;
import java.util.Map;

;

/**
 * 测试门诊数据集
 * @Author: bijl
 * @Date: 2018年7月26日-下午1:58:41
 * @Description:
 */
public class NNDataSetImplNonPatallelTest {
    
    public static void main(String[] args) {
        
        //TODO:change modelAndVersion to test different models
        String modelAndVersion = "diagnosisPredict.version";
        
        NNDataSet dataSet = new NNDataSetImplNonParallel(modelAndVersion);
        
        Map<String, Map<String, String>> aMap = new HashMap<>();
        
        Map<String, String> featureValues = new HashMap<>();
        
        featureValues.put("partbody", "左肺上叶");
        featureValues.put("property", "压榨样");
        featureValues.put("duration", "0");
        featureValues.put("sex", "M");
        featureValues.put("age", "34");
        featureValues.put("negative", "有");
        featureValues.put("sn", "0");
        aMap.put("踝关节疼痛", featureValues);
        
        float[] featureVector = dataSet.toFeatureVector(aMap);
        
//        System.out.println(dataSet.getFEATURE_DICT());
        float sum = 0;
        for (int i=0; i<featureVector.length;i++)
            sum += featureVector[i];
        
        System.out.println(sum);
        
        int index = 0;
        
        // 打印不为0的数据（即有效的数字）
        while (index < featureVector.length) {
            if (featureVector[index] != 0.0f) {
               System.out.println(featureVector[index]);
               System.out.println(featureVector[index+1]);
               System.out.println(featureVector[index+2]);
               System.out.println(featureVector[index+3]);
               System.out.println("...........................................");
               
               index += 4;
            }
            else
                index += 1;
            
        }
    }

}
