Пример #1
0
np.savetxt("datasets//predictions//VGG19_" + ver + "_predictions.csv",
           pred,
           fmt='%1.18f',
           delimiter=',')


def round_nearest(x, a):
    return np.round(x / a) * a


round_pred = round_nearest(pred, 0.05)
#Check the mse or tau-b score
###Write code here to evaluate the classifier
#The predprob function comes directly from the challenge organizers
pred_prob = predprob(cellularity, pred)
print("Prediction probability score: " + str(pred_prob))
tau_b, p_value = stats.kendalltau(pred[valind], cellularity[valind])
np.savetxt("SPIE_truth_val.csv", cellularity, fmt='%1.18f', delimiter=',')

#Plot
plt.scatter(cellularity[valind], pred[valind])
plt.xlabel("Ground truth")
plt.ylabel("Model prediction")
plt.savefig("datasets//predictions//VGG19_" + ver + "_val_graph.png", dpi=150)
plt.show()

##Make nice results table
#plain = pd.DataFrame()
#plain['slide'] = image_slide
#plain['image'] = image_region
Пример #2
0
    spearArray = []
    msqArray = []
    predprobArray = []
    for j in range(1, 5):
        pred1 = np.array(
            pd.read_csv(
                pathPrefix +
                "OneDrive - TU Eindhoven\\Vakken\\2018-2019\\Kwart 4\\BEP\\datasets\\predictions\\"
                + name + "_" + str(j) + "_predictions.csv",
                header=None))
        pred = []
        for i, val in enumerate(pred1):
            pred.append(val[0])
        pred = np.array(pred)

        pred_prob = predprob(cellularity[testind], pred[testind])
        print("Prediction probability score for {0}_{2}: {1}".format(
            name, pred_prob, j))
        tau_b, p_value_tau_b = stats.kendalltau(pred[testind],
                                                cellularity[testind])
        spearman_correlation, p_value_spcor = stats.spearmanr(
            pred[testind], cellularity[testind])
        msq = mean_squared_error(
            cellularity[testind],
            pred[testind])  #Determine standard deviation as well
        print("Tau: {0}\nSpearman Correlation: {1}\nMean Squared Error: {2}".
              format(tau_b, spearman_correlation, msq))

        tauArray.append(tau_b)
        spearArray.append(spearman_correlation)
        msqArray.append(msq)