Ticket #648: computeCD_approximate.patch

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

Izboljsane tabele in dodan grd priblizek za visje vrednosti.

  • orange/orngStat.py

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