3-weka.filters.unsup
2023-01-31 01:01:25
使用weka api 对数据进行规范化处理
- 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;
相关文章