# Ticket #648: computeCD_approximate.patch

File computeCD_approximate.patch, 3.3 KB (added by gw.orange@…, 4 years ago)

Izboljsane tabele in dodan grd priblizek za visje vrednosti.

• ## orange/orngStat.py

 return (f, k-1), (im, fdistdof) def compute_CD(avranks, N, alpha="0.05", type="nemenyi"): """Compute critical difference for Nemenyi or Bonferroni-Dunn test for average ranks. :param N: number of tested data sets :param alpha: alpha value for chosen test ("0.01", "0.05" or "0.1") :param type: chosen critical difference test type ("nemenyi" for Nemenyi two tailed test or bonferroni-dunn" for Bonferroni-Dunn test) :return: critical difference value """ if type == "nemenyi": critical difference for Nemenyi two tailed test. if type == "bonferroni-dunn": critical difference for Bonferroni-Dunn test """ d = { ("nemenyi", "0.01"): [ 0, 0, 2.576, 2.913, 3.113, 3.255, 3.364, 3.452, 3.526, 3.590, 3.646, 3.696, 3.741, 3.781, 3.818, 3.853, 3.884, 3.914, 3.941, 3.967, 3.992, 4.015, 4.037, 4.057, 4.077, 4.096, 4.114, 4.132, 4.148, 4.164, 4.179, 4.194, 4.208, 4.222, 4.236, 4.249, 4.261, 4.273, 4.285, 4.296, 4.307, 4.318, 4.329, 4.339, 4.349, 4.359, 4.368, 4.378, 4.387, 4.395, 4.404], ("nemenyi", "0.05"): [ 0, 0, 1.960, 2.344, 2.569, 2.728, 2.850, 2.948, 3.031, 3.102, 3.164, 3.219, 3.268, 3.313, 3.354, 3.391, 3.426, 3.458, 3.489, 3.517, 3.544, 3.569, 3.593, 3.616, 3.637, 3.658, 3.678, 3.696, 3.714, 3.732, 3.749, 3.765, 3.780, 3.795, 3.810, 3.824, 3.837, 3.850, 3.863, 3.876, 3.888, 3.899, 3.911, 3.922, 3.933, 3.943, 3.954, 3.964, 3.973, 3.983, 3.992], ("nemenyi", "0.1"): [ 0, 0, 1.645, 2.052, 2.291, 2.460, 2.589, 2.693, 2.780, 2.855, 2.920, 2.978, 3.030, 3.077, 3.120, 3.159, 3.196, 3.230, 3.261, 3.291, 3.319, 3.346, 3.371, 3.394, 3.417, 3.439, 3.459, 3.479, 3.498, 3.516, 3.533, 3.550, 3.567, 3.582, 3.597, 3.612, 3.626, 3.640, 3.653, 3.666, 3.679, 3.691, 3.703, 3.714, 3.726, 3.737, 3.747, 3.758, 3.768, 3.778, 3.788], ("bonferroni-dunn", "0.01"): [ 0, 0, 2.576], ("bonferroni-dunn", "0.05"): [ 0, 0, 1.960, 2.241, 2.394, 2.498, 2.576, 2.638, 2.690, 2.724, 2.773], ("bonferroni-dunn", "0.1"): [ 0, 0, 1.645, 1.960, 2.128, 2.241, 2.326, 2.394, 2.450, 2.498, 2.539] } q = d[(type, alpha)] k = len(avranks) d = {} if k > len(q): k = q[-1] + (k - len(q)) * 0.01  #XXX: ugly aproximation hack to not crash on higher values d[("nemenyi", "0.05")] = [0, 0, 1.960, 2.343, 2.568, 2.728, 2.850, 2.949, 3.031, 3.102, 3.164 ] d[("nemenyi", "0.1")] = [0, 0, 1.645, 2.052, 2.291, 2.459, 2.589, 2.693, 2.780, 2.855, 2.920 ] d[("bonferroni-dunn", "0.05")] =  [0, 0, 1.960, 2.241, 2.394, 2.498, 2.576, 2.638, 2.690, 2.724, 2.773 ] d[("bonferroni-dunn", "0.1")] = [0, 0, 1.645, 1.960, 2.128, 2.241, 2.326, 2.394, 2.450, 2.498, 2.539 ] q = d[(type, alpha)] cd = q[k]*(k*(k+1)/(6.0*N))**0.5 return cd def graph_ranks(filename, avranks, names, cd=None, cdmethod=None, lowv=None, highv=None, width=6, textspace=1, reverse=False, **kwargs): """