使用weka API 对数据进行规范化处理
代码语言:javascript复制DataSource source = null; Instances instances = null; try { source = new DataSource(fileName); instances = source.getDataSet(); instances.setClassIndex(instances.numAttributes()-1); //对数据进行规范化 Normalize norm = new Normalize(); norm.setScale(1.0); norm.setTranslation(0.0); norm.setIgnoreClass(true); norm.setInputFormat(instances); instances = Filter.useFilter(instances, norm); } catch (Exception e) { e.printStackTrace(); } return instances;