weka學習(四)標準化

@Service
public class StandardizeDealBizImpl implements StandardizeDealBiz {

    private static final Logger LOGGER = LoggerFactory.getLogger(FeatureSelectBizImpl.class);

    @Override
    public Instances standardizeDeal(Instances data) {

        LOGGER.info("[standardizeDeal]:標準化處理開始");
        Instances newData = null;
        try {
            if (data.classIndex() == -1) {
                data.setClassIndex(data.numAttributes() - 1);
            }

            Standardize filter = new Standardize();
            filter.setInputFormat(data);

            newData = Filter.useFilter(data, filter);

        } catch (BizException bizE) {
            LOGGER.error("標準化處理出現業務異常,錯誤緣由:", bizE);
        } catch (Exception e) {
            LOGGER.error("標準化處理出現系統異常,錯誤緣由:", e);
        }

        return newData;
    }

}
相關文章
相關標籤/搜索