@@ -0,0 +1,2387 @@
+/*%0A * Copyright %5B2013-2015%5D eBay Software Foundation%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *    http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage ml.shifu.shifu.core.converge;%0A%0Aimport java.io.IOException;%0A%0Aimport ml.shifu.shifu.util.Constants;%0A%0Aimport org.apache.commons.lang.StringUtils;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A/**%0A * @author xiaobzheng%0A * Factory class for generating ConvergeJudger instances.%0A */%0Apublic class ConvergeJudgerFactory %7B%0A%0A    private static Logger LOG = LoggerFactory.getLogger(ConvergeJudgerFactory.class);%0A%0A    /**%0A     * @param criteriaStr the criteria string indicates convergence criteria.%0A     * @return Convergence Judger%0A     * @throws IOException%0A     */%0A    AbstractConvergeJudger getJudger(String criteriaStr) throws IOException %7B%0A        //TODO xiaobin: get judger%0A        // tmp return. edit later.%0A        LOG.info(%22Start getting ConvergeJuder instance :%22);%0A%0A        String criteria = StringUtils.trimToEmpty(criteriaStr);%0A        AbstractConvergeJudger judger = null;%0A        if (Constants.TRAIN_ERR_ONLY.equalsIgnoreCase(criteria)) %7B%0A            LOG.info(choiceLogStr(Constants.TRAIN_ERR_ONLY));%0A            judger = new TrainErrOnlyConvergeJudger();%0A        %7D else if (Constants.VALID_ERR_ONLY.equalsIgnoreCase(criteria)) %7B%0A            LOG.info(choiceLogStr(Constants.VALID_ERR_ONLY));%0A            judger = new ValidErrOnlyConvergeJudger();%0A        %7D else if (Constants.TRAIN_VALID_AVG_ERR.equalsIgnoreCase(criteria)) %7B%0A            LOG.info(choiceLogStr(Constants.TRAIN_VALID_AVG_ERR));%0A            judger = new TrainValidAvgErrConvergeJudger();%0A        %7D else %7B%0A            throw new RuntimeException(%22Training Option for convergence criteria is not Valid : %22 + criteria);%0A        %7D%0A        return judger;%0A    %7D%0A    %0A    private String choiceLogStr(String criteriaStr) %7B%0A        return %22Choose convergence criteria : %22 + criteriaStr;%0A    %7D%0A%7D%0A

add factory for generating convergence judger instance.