(self, data_instances)
return predict_res
Predict OneVsRest model
        Parameters:
        ----------
        data_instances: Table of instances
        predict_param: PredictParam of classifier

        Returns:
        ----------
        predict_res: Table, if has predict_res, it includes ground true label, predict probably and predict label
Predict OneVsRest model
        Parameters:
        ----------
        data_instances: Table of instances
        predict_param: PredictParam of classifier
Predict OneVsRest model Parameters : ---------- data_instances : Table of instances predict_param : PredictParam of classifier
def predict(self, data_instances):
        """
        Predict OneVsRest model
        Parameters:
        ----------
        data_instances: Table of instances
        predict_param: PredictParam of classifier

        Returns:
        ----------
        predict_res: Table, if has predict_res, it includes ground true label, predict probably and predict label
        """
        LOGGER.info("Start one_vs_all predict procedure.")
        predict_res_list = []
        for i, model in enumerate(self.models):
            current_flow_id = model.flowid
            model.set_flowid(".".join([current_flow_id, "model_" + str(i)]))

            LOGGER.info("Start to predict with model:{}".format(i))
            # model.set_flowid("predict_" + str(i))
            single_predict_res = model.predict(data_instances)
            predict_res_list.append(single_predict_res)

        prob = self._comprehensive_result(predict_res_list)
        if prob:
            f = functools.partial(self.__get_multi_class_res, classes=list(self.classes))
            multi_classes_res = prob.mapValues(f)
            predict_res = data_instances.join(multi_classes_res, lambda d, m: [d.label, m[0], m[1], m[2]])

            def _transfer(instance, pred_res):
                return Instance(features=pred_res, inst_id=instance.inst_id)

            predict_res = data_instances.join(predict_res, _transfer)
        else:
            predict_res = None
        #
        # LOGGER.info("finish OneVsRest Predict, return predict results.")

        return predict_res
def predict ( self , data_instances ) : LOGGER . info ( "Start one_vs_all predict procedure." ) predict_res_list = [ ] for i , model in enumerate ( self . models ) : current_flow_id = model . flowid model . set_flowid ( "." . join ( [ current_flow_id , "model_" + str ( i ) ] ) ) LOGGER . info ( "Start to predict with model:{}" . format ( i ) ) # model.set_flowid("predict_" + str(i)) single_predict_res = model . predict ( data_instances ) predict_res_list . append ( single_predict_res ) prob = self . _comprehensive_result ( predict_res_list ) if prob : f = functools . partial ( self . __get_multi_class_res , classes = list ( self . classes ) ) multi_classes_res = prob . mapValues ( f ) predict_res = data_instances . join ( multi_classes_res , lambda d , m : [ d . label , m [ 0 ] , m [ 1 ] , m [ 2 ] ] ) def _transfer ( instance , pred_res ) : return Instance ( features = pred_res , inst_id = instance . inst_id ) predict_res = data_instances . join ( predict_res , _transfer ) else : predict_res = None # # LOGGER.info("finish OneVsRest Predict, return predict results.") return predict_res