def fit(self): order_diff_days = self.orderPd[ (self.orderPd['diff_days'] > 0) & (self.orderPd['diff_days'] <= self.dd_threshold)] # weights_eq = pd.Series(np.ones(len(jump_boost.bd_list))/len(jump_boost.bd_list), index=[bd.name for bd in jump_boost.bd_list]) weights_above = pd.Series(np.ones(len(self.bd_list)) / len(self.bd_list), index=[bd.name for bd in self.bd_list]) order_diff_days.apply(self._boost_dummies_weights, axis=1, args=(self.above, self.above, weights_above)) self.weights_above = weights_above / weights_above.sum() ZLog.info('weights_above') ZLog.info(self.weights_above) ZLog.newline() weights_below = pd.Series(np.ones(len(self.bd_list)) / len(self.bd_list), index=[bd.name for bd in self.bd_list]) order_diff_days.apply(self._boost_dummies_weights, axis=1, args=(self.below, self.below, weights_below)) weights_below = weights_below + weights_below.mean() self.weights_below = weights_below / weights_below.sum() ZLog.info('weights_below') ZLog.info(self.weights_below) ZLog.newline() weights_both = pd.Series(np.ones(len(self.bd_list)) / len(self.bd_list), index=[bd.name for bd in self.bd_list]) order_diff_days.apply(self._boost_dummies_weights, axis=1, args=(self.above, self.below, weights_both)) self.weights_both = weights_both / weights_both.sum() ZLog.info('weights_both') ZLog.info(self.weights_both)
def feature_selection(self, **kwargs): x, y = kwargs['x'], kwargs['y'] fiter = self.get_fiter() selector = RFE(fiter) selector.fit(x, y) ZLog.info('RFE selection') ZLog.info( pd.DataFrame( { 'support': selector.support_, 'ranking': selector.ranking_ }, index=self.df.columns[1:])) selector = RFECV(fiter, cv=3, scoring='mean_squared_error') selector.fit(x, y) ZLog.newline() ZLog.info('RFECV selection') ZLog.info( pd.DataFrame( { 'support': selector.support_, 'ranking': selector.ranking_ }, index=self.df.columns[1:]))
def feature_selection(self, **kwargs): x, y = kwargs['x'], kwargs['y'] fiter = self.get_fiter() selector = RFE(fiter) selector.fit(x, y) ZLog.info('RFE selection') ZLog.info(pd.DataFrame({'support': selector.support_, 'ranking': selector.ranking_}, index=self.df.columns[1:])) selector = RFECV(fiter, cv=3, scoring='mean_squared_error') selector.fit(x, y) ZLog.newline() ZLog.info('RFECV selection') ZLog.info(pd.DataFrame({'support': selector.support_, 'ranking': selector.ranking_}, index=self.df.columns[1:]))
def fit(self): order_diff_days = self.orderPd[(self.orderPd['diff_days'] > 0) & ( self.orderPd['diff_days'] <= self.dd_threshold)] # weights_eq = pd.Series(np.ones(len(jump_boost.bd_list))/len(jump_boost.bd_list), index=[bd.name for bd in jump_boost.bd_list]) weights_above = pd.Series(np.ones(len(self.bd_list)) / len(self.bd_list), index=[bd.name for bd in self.bd_list]) order_diff_days.apply(self._boost_dummies_weights, axis=1, args=(self.above, self.above, weights_above)) self.weights_above = weights_above / weights_above.sum() ZLog.info('weights_above') ZLog.info(self.weights_above) ZLog.newline() weights_below = pd.Series(np.ones(len(self.bd_list)) / len(self.bd_list), index=[bd.name for bd in self.bd_list]) order_diff_days.apply(self._boost_dummies_weights, axis=1, args=(self.below, self.below, weights_below)) weights_below = weights_below + weights_below.mean() self.weights_below = weights_below / weights_below.sum() ZLog.info('weights_below') ZLog.info(self.weights_below) ZLog.newline() weights_both = pd.Series(np.ones(len(self.bd_list)) / len(self.bd_list), index=[bd.name for bd in self.bd_list]) order_diff_days.apply(self._boost_dummies_weights, axis=1, args=(self.above, self.below, weights_both)) self.weights_both = weights_both / weights_both.sum() ZLog.info('weights_both') ZLog.info(self.weights_both)
def recall_score(self): order_diff_days = self.orderPd[ (self.orderPd['diff_days'] > 0) & (self.orderPd['diff_days'] <= self.dd_threshold)] below_Line = self.below * 0.9 predict_both = order_diff_days.apply(self._boost_dummies_predict, axis=1, args=(self.weights_both, below_Line,)) predict_above = order_diff_days.apply(self._boost_dummies_predict, axis=1, args=(self.weights_above, below_Line,)) predict_below = order_diff_days.apply(self._boost_dummies_predict, axis=1, args=(self.weights_below, below_Line,)) order_diff_days['predict_above'] = predict_above order_diff_days['predict_below'] = predict_below order_diff_days['predict_both'] = predict_both # predict_plus = np.array([predict_both, predict_above, predict_below]).T.sum(axis=1) # order_diff_days['predict'] = np.where(predict_plus <= 0, 0, 1) # predict_loss_pd_plus = order_diff_days[predict_plus <= 0] # ZLog.info(predict_loss_pd_plus.shape) # ZLog.info(metrics.accuracy_score(predict_loss_pd_plus['result'], predict_loss_pd_plus['predict'])) predict_loss_pd = order_diff_days[order_diff_days['predict_both'] == 0] ZLog.info('predict_both') ZLog.info(predict_loss_pd.shape) ZLog.info(metrics.accuracy_score(predict_loss_pd['result'], predict_loss_pd['predict_both'])) ZLog.newline() predict_loss_pd = order_diff_days[order_diff_days['predict_below'] == 0] ZLog.info('predict_below') ZLog.info(predict_loss_pd.shape) ZLog.info(metrics.accuracy_score(predict_loss_pd['result'], predict_loss_pd['predict_below'])) ZLog.newline() predict_loss_pd = order_diff_days[order_diff_days['predict_above'] == 0] ZLog.info('predict_above') ZLog.info(predict_loss_pd.shape) ZLog.info(metrics.accuracy_score(predict_loss_pd['result'], predict_loss_pd['predict_above'])) ZLog.newline() return order_diff_days
def verify_process(est_cls, judge_cls, make_x_func, make_order_func, order_pd, only_jd=False, first_local=False, tn_threshold=800): """ :param est_cls: :param judge_cls: :param make_x_func: :param make_order_func: :param order_pd: :param only_jd: 使用以序列化的只进行judge :param first_local: 优先使用本地分类器 :param tn_threshold: :return: """ if not only_jd: _, _, _, _, _, _ = est_cls.dump_process(judge_cls, order_pd, tn_threshold, True, first_local=first_local) def apply_judge(order, p_make_x_func): x = p_make_x_func(order) """ 离散不使用隐因子 """ d_ret = est_cls.do_predict_process(judge_cls, True, False, False, **x) """ 连续不使用隐因子 """ v_ret = est_cls.do_predict_process(judge_cls, False, False, False, **x) """ 离散使用隐因子 """ dm_ret = est_cls.do_predict_process(judge_cls, True, True, False, **x) """ 连续使用隐因子 """ vm_ret = est_cls.do_predict_process(judge_cls, False, True, False, **x) """ 离散使用pca """ dp_ret = est_cls.do_predict_process(judge_cls, True, False, True, **x) """ 连续使用pca """ vp_ret = est_cls.do_predict_process(judge_cls, False, False, True, **x) return d_ret, v_ret, dm_ret, vm_ret, dp_ret, vp_ret order_has_ret = make_order_func(order_pd) jd_ret = order_pd.apply(apply_judge, axis=1, args=(make_x_func, )) order_has_ret['d_ret'] = [1 if ret[0] else 0 for ret in jd_ret] order_has_ret['v_ret'] = [1 if ret[1] else 0 for ret in jd_ret] order_has_ret['dm_ret'] = [1 if ret[2] else 0 for ret in jd_ret] order_has_ret['vm_ret'] = [1 if ret[3] else 0 for ret in jd_ret] order_has_ret['dp_ret'] = [1 if ret[4] else 0 for ret in jd_ret] order_has_ret['vp_ret'] = [1 if ret[5] else 0 for ret in jd_ret] v_ret_result = metrics.accuracy_score( order_has_ret[order_has_ret['v_ret'] == 0]['result'], order_has_ret[order_has_ret['v_ret'] == 0]['v_ret']) ZLog.info('v_ret_result: ' + str(v_ret_result)) d_ret_result = metrics.accuracy_score( order_has_ret[order_has_ret['d_ret'] == 0]['result'], order_has_ret[order_has_ret['d_ret'] == 0]['d_ret']) ZLog.info('d_ret_result: ' + str(d_ret_result)) dp_ret_result = metrics.accuracy_score( order_has_ret[order_has_ret['dp_ret'] == 0]['result'], order_has_ret[order_has_ret['dp_ret'] == 0]['dp_ret']) ZLog.info('dp_ret_result: ' + str(dp_ret_result)) vp_ret_result = metrics.accuracy_score( order_has_ret[order_has_ret['vp_ret'] == 0]['result'], order_has_ret[order_has_ret['vp_ret'] == 0]['vp_ret']) ZLog.info('vp_ret_result: ' + str(vp_ret_result)) dm_ret_result = metrics.accuracy_score( order_has_ret[order_has_ret['dm_ret'] == 0]['result'], order_has_ret[order_has_ret['dm_ret'] == 0]['dm_ret']) ZLog.info('dm_ret_result: ' + str(dm_ret_result)) vm_ret_result = metrics.accuracy_score( order_has_ret[order_has_ret['vm_ret'] == 0]['result'], order_has_ret[order_has_ret['vm_ret'] == 0]['vm_ret']) ZLog.info('vm_ret_result: ' + str(vm_ret_result)) ZLog.newline(fill_cnt=58) v_ret_result_all = metrics.accuracy_score(order_has_ret['result'], order_has_ret['v_ret']) ZLog.info('v_ret_result_all: ' + str(v_ret_result_all)) d_ret_result_all = metrics.accuracy_score(order_has_ret['result'], order_has_ret['d_ret']) ZLog.info('d_ret_result_all: ' + str(d_ret_result_all)) dp_ret_result_all = metrics.accuracy_score(order_has_ret['result'], order_has_ret['dp_ret']) ZLog.info('dp_ret_result_all: ' + str(dp_ret_result_all)) vp_ret_result_all = metrics.accuracy_score(order_has_ret['result'], order_has_ret['vp_ret']) ZLog.info('vp_ret_result_all: ' + str(vp_ret_result_all)) dm_ret_result_all = metrics.accuracy_score(order_has_ret['result'], order_has_ret['dm_ret']) ZLog.info('dm_ret_result_all: ' + str(dm_ret_result_all)) vm_ret_result_all = metrics.accuracy_score(order_has_ret['result'], order_has_ret['vm_ret']) ZLog.info('vm_ret_result_all: ' + str(vm_ret_result_all)) ZLog.newline(fill_cnt=58) order_has_ret['vdmret'] = order_has_ret['d_ret'] + order_has_ret[ 'v_ret'] + order_has_ret['dp_ret'] + order_has_ret['vp_ret'] order_has_ret['vdmret'].value_counts().plot(kind='barh') plt.title('vdmret barh') plt.show() ((order_has_ret['vdmret'] == 1) & (order_has_ret['v_ret'] == 1)).value_counts().plot(kind='bar') plt.title('v_ret == 1') plt.show() ((order_has_ret['vdmret'] == 1) & (order_has_ret['d_ret'] == 1)).value_counts().plot(kind='bar') plt.title('d_ret == 1') plt.show() ((order_has_ret['vdmret'] == 1) & (order_has_ret['vm_ret'] == 1)).value_counts().plot(kind='bar') plt.title('vm_ret == 1') plt.show() ((order_has_ret['vdmret'] == 1) & (order_has_ret['dm_ret'] == 1)).value_counts().plot(kind='bar') plt.title('dm_ret == 1') plt.show() ((order_has_ret['vdmret'] == 1) & (order_has_ret['dp_ret'] == 1)).value_counts().plot(kind='bar') plt.title('dp_ret == 1') plt.show() ((order_has_ret['vdmret'] == 1) & (order_has_ret['vp_ret'] == 1)).value_counts().plot(kind='bar') plt.title('vp_ret == 1') plt.show() final_result = metrics.accuracy_score( order_has_ret[order_has_ret['vdmret'] == 0]['result'], order_has_ret[order_has_ret['vdmret'] == 0]['vdmret']) ZLog.info('final_result: ' + str(final_result)) order_has_ret['vdmret_one'] = np.where(order_has_ret['vdmret'] == 1, 0, 1) final_one_result = metrics.accuracy_score( order_has_ret[order_has_ret['vdmret_one'] == 0]['result'], order_has_ret[order_has_ret['vdmret_one'] == 0]['vdmret_one']) ZLog.info('final_one_result: ' + str(final_one_result)) order_has_ret['vdmret_two'] = np.where(order_has_ret['vdmret'] == 2, 0, 1) final_two_result = metrics.accuracy_score( order_has_ret[order_has_ret['vdmret_two'] == 0]['result'], order_has_ret[order_has_ret['vdmret_two'] == 0]['vdmret_two']) ZLog.info('final_two_result: ' + str(final_two_result)) order_has_ret['vdmret_three'] = np.where(order_has_ret['vdmret'] == 3, 0, 1) final_three_result = metrics.accuracy_score( order_has_ret[order_has_ret['vdmret_three'] == 0]['result'], order_has_ret[order_has_ret['vdmret_three'] == 0]['vdmret_three']) ZLog.info('final_three_result: ' + str(final_three_result)) order_has_ret['vdmret_four'] = np.where(order_has_ret['vdmret'] == 4, 0, 1) final_four_result = metrics.accuracy_score( order_has_ret[order_has_ret['vdmret_four'] == 0]['result'], order_has_ret[order_has_ret['vdmret_four'] == 0]['vdmret_four']) ZLog.info('final_four_result: ' + str(final_four_result)) return jd_ret, order_has_ret
def verify_process(est_cls, judge_cls, make_x_func, make_order_func, order_pd, only_jd=False, first_local=False, tn_threshold=800): """ :param est_cls: :param judge_cls: :param make_x_func: :param make_order_func: :param order_pd: :param only_jd: 使用以序列化的只进行judge :param first_local: 优先使用本地分类器 :param tn_threshold: :return: """ if not only_jd: _, _, _, _, _, _ = est_cls.dump_process(judge_cls, order_pd, tn_threshold, True, first_local=first_local) def apply_judge(order, p_make_x_func): x = p_make_x_func(order) """ 离散不使用隐因子 """ d_ret = est_cls.do_predict_process(judge_cls, True, False, False, **x) """ 连续不使用隐因子 """ v_ret = est_cls.do_predict_process(judge_cls, False, False, False, **x) """ 离散使用隐因子 """ dm_ret = est_cls.do_predict_process(judge_cls, True, True, False, **x) """ 连续使用隐因子 """ vm_ret = est_cls.do_predict_process(judge_cls, False, True, False, **x) """ 离散使用pca """ dp_ret = est_cls.do_predict_process(judge_cls, True, False, True, **x) """ 连续使用pca """ vp_ret = est_cls.do_predict_process(judge_cls, False, False, True, **x) return d_ret, v_ret, dm_ret, vm_ret, dp_ret, vp_ret order_has_ret = make_order_func(order_pd) jd_ret = order_pd.apply(apply_judge, axis=1, args=(make_x_func,)) order_has_ret['d_ret'] = [1 if ret[0] else 0 for ret in jd_ret] order_has_ret['v_ret'] = [1 if ret[1] else 0 for ret in jd_ret] order_has_ret['dm_ret'] = [1 if ret[2] else 0 for ret in jd_ret] order_has_ret['vm_ret'] = [1 if ret[3] else 0 for ret in jd_ret] order_has_ret['dp_ret'] = [1 if ret[4] else 0 for ret in jd_ret] order_has_ret['vp_ret'] = [1 if ret[5] else 0 for ret in jd_ret] v_ret_result = metrics.accuracy_score(order_has_ret[order_has_ret['v_ret'] == 0]['result'], order_has_ret[order_has_ret['v_ret'] == 0]['v_ret']) ZLog.info('v_ret_result: ' + str(v_ret_result)) d_ret_result = metrics.accuracy_score(order_has_ret[order_has_ret['d_ret'] == 0]['result'], order_has_ret[order_has_ret['d_ret'] == 0]['d_ret']) ZLog.info('d_ret_result: ' + str(d_ret_result)) dp_ret_result = metrics.accuracy_score(order_has_ret[order_has_ret['dp_ret'] == 0]['result'], order_has_ret[order_has_ret['dp_ret'] == 0]['dp_ret']) ZLog.info('dp_ret_result: ' + str(dp_ret_result)) vp_ret_result = metrics.accuracy_score(order_has_ret[order_has_ret['vp_ret'] == 0]['result'], order_has_ret[order_has_ret['vp_ret'] == 0]['vp_ret']) ZLog.info('vp_ret_result: ' + str(vp_ret_result)) dm_ret_result = metrics.accuracy_score(order_has_ret[order_has_ret['dm_ret'] == 0]['result'], order_has_ret[order_has_ret['dm_ret'] == 0]['dm_ret']) ZLog.info('dm_ret_result: ' + str(dm_ret_result)) vm_ret_result = metrics.accuracy_score(order_has_ret[order_has_ret['vm_ret'] == 0]['result'], order_has_ret[order_has_ret['vm_ret'] == 0]['vm_ret']) ZLog.info('vm_ret_result: ' + str(vm_ret_result)) ZLog.newline(fill_cnt=58) v_ret_result_all = metrics.accuracy_score(order_has_ret['result'], order_has_ret['v_ret']) ZLog.info('v_ret_result_all: ' + str(v_ret_result_all)) d_ret_result_all = metrics.accuracy_score(order_has_ret['result'], order_has_ret['d_ret']) ZLog.info('d_ret_result_all: ' + str(d_ret_result_all)) dp_ret_result_all = metrics.accuracy_score(order_has_ret['result'], order_has_ret['dp_ret']) ZLog.info('dp_ret_result_all: ' + str(dp_ret_result_all)) vp_ret_result_all = metrics.accuracy_score(order_has_ret['result'], order_has_ret['vp_ret']) ZLog.info('vp_ret_result_all: ' + str(vp_ret_result_all)) dm_ret_result_all = metrics.accuracy_score(order_has_ret['result'], order_has_ret['dm_ret']) ZLog.info('dm_ret_result_all: ' + str(dm_ret_result_all)) vm_ret_result_all = metrics.accuracy_score(order_has_ret['result'], order_has_ret['vm_ret']) ZLog.info('vm_ret_result_all: ' + str(vm_ret_result_all)) ZLog.newline(fill_cnt=58) order_has_ret['vdmret'] = order_has_ret['d_ret'] + order_has_ret['v_ret'] + order_has_ret['dp_ret'] + order_has_ret[ 'vp_ret'] order_has_ret['vdmret'].value_counts().plot(kind='barh') plt.title('vdmret barh') plt.show() ((order_has_ret['vdmret'] == 1) & (order_has_ret['v_ret'] == 1)).value_counts().plot(kind='bar') plt.title('v_ret == 1') plt.show() ((order_has_ret['vdmret'] == 1) & (order_has_ret['d_ret'] == 1)).value_counts().plot(kind='bar') plt.title('d_ret == 1') plt.show() ((order_has_ret['vdmret'] == 1) & (order_has_ret['vm_ret'] == 1)).value_counts().plot(kind='bar') plt.title('vm_ret == 1') plt.show() ((order_has_ret['vdmret'] == 1) & (order_has_ret['dm_ret'] == 1)).value_counts().plot(kind='bar') plt.title('dm_ret == 1') plt.show() ((order_has_ret['vdmret'] == 1) & (order_has_ret['dp_ret'] == 1)).value_counts().plot(kind='bar') plt.title('dp_ret == 1') plt.show() ((order_has_ret['vdmret'] == 1) & (order_has_ret['vp_ret'] == 1)).value_counts().plot(kind='bar') plt.title('vp_ret == 1') plt.show() final_result = metrics.accuracy_score(order_has_ret[order_has_ret['vdmret'] == 0]['result'], order_has_ret[order_has_ret['vdmret'] == 0]['vdmret']) ZLog.info('final_result: ' + str(final_result)) order_has_ret['vdmret_one'] = np.where(order_has_ret['vdmret'] == 1, 0, 1) final_one_result = metrics.accuracy_score(order_has_ret[order_has_ret['vdmret_one'] == 0]['result'], order_has_ret[order_has_ret['vdmret_one'] == 0]['vdmret_one']) ZLog.info('final_one_result: ' + str(final_one_result)) order_has_ret['vdmret_two'] = np.where(order_has_ret['vdmret'] == 2, 0, 1) final_two_result = metrics.accuracy_score(order_has_ret[order_has_ret['vdmret_two'] == 0]['result'], order_has_ret[order_has_ret['vdmret_two'] == 0]['vdmret_two']) ZLog.info('final_two_result: ' + str(final_two_result)) order_has_ret['vdmret_three'] = np.where(order_has_ret['vdmret'] == 3, 0, 1) final_three_result = metrics.accuracy_score(order_has_ret[order_has_ret['vdmret_three'] == 0]['result'], order_has_ret[order_has_ret['vdmret_three'] == 0]['vdmret_three']) ZLog.info('final_three_result: ' + str(final_three_result)) order_has_ret['vdmret_four'] = np.where(order_has_ret['vdmret'] == 4, 0, 1) final_four_result = metrics.accuracy_score(order_has_ret[order_has_ret['vdmret_four'] == 0]['result'], order_has_ret[order_has_ret['vdmret_four'] == 0]['vdmret_four']) ZLog.info('final_four_result: ' + str(final_four_result)) return jd_ret, order_has_ret
def show_process(self, pdf=True, cas=True, css=True, ras=True, ttxy=True, plc=True, pra=True, pcm=True, pvt=True, pmps=True, pmrs=True): ZLog.info(self.fiter.importances_coef_pd()) if pdf: self.fiter.plot_decision_function() if cas: ZLog.newline() ZLog.info('cross_val_accuracy_score') ZLog.info(self.fiter.cross_val_accuracy_score()) if css: ZLog.newline() ZLog.info('cross_val_mean_squared_score') ZLog.info(self.fiter.cross_val_mean_squared_score()) if ras: ZLog.newline() ZLog.info('cross_val_roc_auc_score') ZLog.info(self.fiter.cross_val_roc_auc_score()) if ttxy: ZLog.newline() ZLog.info('train_test_split_xy') self.fiter.train_test_split_xy() if plc: ZLog.newline() ZLog.info('plot_learning_curve') self.fiter.plot_learning_curve() if pra: ZLog.newline() ZLog.info('plot_roc_estimator') self.fiter.plot_roc_estimator() if pcm: ZLog.newline() ZLog.info('plot_confusion_matrices') self.fiter.plot_confusion_matrices() if pvt: ZLog.newline() ZLog.info('plot_visualize_tree') self.fiter.plot_visualize_tree() if pmps: ZLog.newline() ZLog.info('prob_maximum_precision_score') self.fiter.prob_maximum_precision_score() if pmrs: ZLog.newline() ZLog.info('prob_maximum_recall_score') self.fiter.prob_maximum_recall_score()
def recall_score(self): order_diff_days = self.orderPd[(self.orderPd['diff_days'] > 0) & ( self.orderPd['diff_days'] <= self.dd_threshold)] below_Line = self.below * 0.9 predict_both = order_diff_days.apply(self._boost_dummies_predict, axis=1, args=( self.weights_both, below_Line, )) predict_above = order_diff_days.apply(self._boost_dummies_predict, axis=1, args=( self.weights_above, below_Line, )) predict_below = order_diff_days.apply(self._boost_dummies_predict, axis=1, args=( self.weights_below, below_Line, )) order_diff_days['predict_above'] = predict_above order_diff_days['predict_below'] = predict_below order_diff_days['predict_both'] = predict_both # predict_plus = np.array([predict_both, predict_above, predict_below]).T.sum(axis=1) # order_diff_days['predict'] = np.where(predict_plus <= 0, 0, 1) # predict_loss_pd_plus = order_diff_days[predict_plus <= 0] # ZLog.info(predict_loss_pd_plus.shape) # ZLog.info(metrics.accuracy_score(predict_loss_pd_plus['result'], predict_loss_pd_plus['predict'])) predict_loss_pd = order_diff_days[order_diff_days['predict_both'] == 0] ZLog.info('predict_both') ZLog.info(predict_loss_pd.shape) ZLog.info( metrics.accuracy_score(predict_loss_pd['result'], predict_loss_pd['predict_both'])) ZLog.newline() predict_loss_pd = order_diff_days[order_diff_days['predict_below'] == 0] ZLog.info('predict_below') ZLog.info(predict_loss_pd.shape) ZLog.info( metrics.accuracy_score(predict_loss_pd['result'], predict_loss_pd['predict_below'])) ZLog.newline() predict_loss_pd = order_diff_days[order_diff_days['predict_above'] == 0] ZLog.info('predict_above') ZLog.info(predict_loss_pd.shape) ZLog.info( metrics.accuracy_score(predict_loss_pd['result'], predict_loss_pd['predict_above'])) ZLog.newline() return order_diff_days