/** * 歸一化處理 * * @author hao.wei */ @Service public class NormalizeBizImpl implements NormalizeBiz { private static final Logger logger = LoggerFactory.getLogger(NormalizeBizImpl.class); @Override public Instances normalizeHandle(Instances instances, String[] options) { //對數據進行歸一化 Instances newInstances = null; try { logger.info("歸一化begin,時間[{}]",new Date()); Normalize norm = new Normalize(); if (null != options) { // 能夠指定數據結果集範圍,不傳爲[0,1] // String[] options = { "-S", "2.0", "-T", "-1.0" }; norm.setOptions(options); } norm.setInputFormat(instances); //歸一化關鍵步驟 newInstances = Filter.useFilter(instances, norm); logger.info("歸一化end,時間[{}]",new Date()); } catch (Exception e) { e.printStackTrace(); } return newInstances; } }