Exemple #1
0
                                    y_target: np.transpose([test_label_inst]), keep_prob:1.0})
            test_loss_all.append(cur_test_loss)

    except tf.errors.OutOfRangeError:
        func.print_time()
        print('Done testing -- epoch limit reached')
    finally:
        coord.request_stop()

    coord.join(threads)

    # calculate auc
    test_pred_score_re = func.list_flatten(test_pred_score_all)
    test_label_re = func.list_flatten(test_label_all)
    test_auc, _, _ = func.cal_auc(test_pred_score_re, test_label_re)
    test_rmse = func.cal_rmse(test_pred_score_re, test_label_re)
    test_loss = np.mean(test_loss_all)

    # rounding
    test_auc = np.round(test_auc, 4)
    test_rmse = np.round(test_rmse, 4)
    test_loss = np.round(test_loss, 5)
    train_loss_list = [np.round(xx, 4) for xx in train_loss_list]
    val_auc_list = [np.round(xx, 4) for xx in val_auc_list]

    print('test_auc = ', test_auc)
    print('test_rmse =', test_rmse)
    print('test_loss =', test_loss)
    print('train_loss_list =', train_loss_list)
    print('val_auc_list =', val_auc_list)
Exemple #2
0
                                        y_target_2: test_label_inst_2, keep_prob:1.0})
                test_loss_all_2.append(cur_test_loss_2)

        except tf.errors.OutOfRangeError:
            func.print_time()
            print('Done testing 2 -- epoch limit reached')
        finally:
            coord.request_stop()
        coord.join(threads)

        #################################
        # calculate auc
        test_pred_score_re_1 = func.list_flatten(test_pred_score_all_1)
        test_label_re_1 = func.list_flatten(test_label_all_1)
        test_auc_1, _, _ = func.cal_auc(test_pred_score_re_1, test_label_re_1)
        test_rmse_1 = func.cal_rmse(test_pred_score_re_1, test_label_re_1)
        test_loss_1 = np.mean(test_loss_all_1)

        test_pred_score_re_2 = func.list_flatten(test_pred_score_all_2)
        test_label_re_2 = func.list_flatten(test_label_all_2)
        test_auc_2, _, _ = func.cal_auc(test_pred_score_re_2, test_label_re_2)
        test_rmse_2 = func.cal_rmse(test_pred_score_re_2, test_label_re_2)
        test_loss_2 = np.mean(test_loss_all_2)

        # rounding
        test_auc_1 = np.round(test_auc_1, 4)
        test_rmse_1 = np.round(test_rmse_1, 4)
        test_loss_1 = np.round(test_loss_1, 5)

        test_auc_2 = np.round(test_auc_2, 4)
        test_rmse_2 = np.round(test_rmse_2, 4)