Changeset 7548:53bb913ed71a in orange


Ignore:
Timestamp:
02/04/11 22:06:03 (3 years ago)
Author:
mocnik <mocnik@…>
Branch:
default
Convert:
4a155e9bf9d76d3d718931e995459e576b6d00b6
Message:

Modifying documentation for Orange.evaluation.scoring module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/evaluation/scoring.py

    r7501 r7548  
    173173   examples. The classifier is obviously quite biased to vans. 
    174174    
    175 .. method:: sens(confm)  
    176 .. method:: spec(confm) 
    177 .. method:: PPV(confm) 
    178 .. method:: NPV(confm) 
    179 .. method:: precision(confm) 
    180 .. method:: recall(confm) 
    181 .. method:: F2(confm) 
    182 .. method:: Falpha(confm, alpha=2.0) 
    183 .. method:: MCC(conf) 
     175   .. method:: sens(confm)  
     176   .. method:: spec(confm) 
     177   .. method:: PPV(confm) 
     178   .. method:: NPV(confm) 
     179   .. method:: precision(confm) 
     180   .. method:: recall(confm) 
     181   .. method:: F2(confm) 
     182   .. method:: Falpha(confm, alpha=2.0) 
     183   .. method:: MCC(conf) 
    184184 
    185185   With the confusion matrix defined in terms of positive and negative 
     
    205205   Falpha [(1+alpha)*precision*recall / (alpha*precision + recall)]. 
    206206   The `Matthews correlation coefficient \ 
    207 <http://en.wikipedia.org/wiki/Matthews_correlation_coefficient Matthews>`_ 
     207<http://en.wikipedia.org/wiki/Matthews_correlation_coefficient>`_ 
    208208   in essence a correlation coefficient between 
    209209   the observed and predicted binary classifications; it returns a value 
     
    358358========== 
    359359 
    360 General measure of quality 
     360General Measure of Quality 
    361361========================== 
    362362 
     
    442442 
    443443def gettotweight(res): 
     444    """Sum all the weights""" 
    444445    totweight = reduce(lambda x, y: x+y.weight, res.results, 0) 
    445446    if totweight==0.0: 
     
    448449 
    449450def gettotsize(res): 
     451    """ Get number of result instances """ 
    450452    if len(res.results): 
    451453        return len(res.results) 
     
    469471 
    470472def classProbabilitiesFromRes(res, **argkw): 
     473    """Calculate class probabilities""" 
    471474    probs = [0.0] * len(res.classValues) 
    472475    if argkw.get("unweighted", 0) or not res.weights: 
     
    858861def BSS(res, **argkw): 
    859862    return [1-x/2 for x in apply(BrierScore, (res, ), argkw)] 
    860  
    861 ##def _KL_div(actualClass, predicted): 
    862 ##     
    863 ##def KL(res, **argkw): 
    864 ##    KLs = [0.0]*res.numberOfLearners 
    865 ## 
    866 ##    if argkw.get("unweighted", 0) or not res.weights: 
    867 ##        for tex in res.results: 
    868 ##            KLs = map(lambda res, predicted: res+KL(tex.actualClass, predicted), KLs, tex.probabilities) 
    869 ##        totweight = gettotsize(res) 
    870 ##    else: 
    871 ##        for tex in res.results: 
    872 ##            ## TEGA SE NISI! 
    873 ##            CAs = map(lambda res, cls: res+(cls==tex.actualClass and tex.weight), CAs, tex.classes) 
    874 ##        totweight = gettotweight(res) 
    875 ## 
    876 ##    return [x/totweight for x in CAs] 
    877  
    878      
    879 ##def KL_se(res, **argkw): 
    880 ##    # Kullback-Leibler divergence 
    881 ##    if res.numberOfIterations==1: 
    882 ##        if argkw.get("unweighted", 0) or not res.weights: 
    883 ##            totweight = gettotsize(res) 
    884 ##        else: 
    885 ##            totweight = gettotweight(res) 
    886 ##        return [(x, x*(1-x)/math.sqrt(totweight)) for x in apply(CA, (res,), argkw)] 
    887 ##    else: 
    888 ##        KLsByFold = [[0.0]*res.numberOfIterations for i in range(res.numberOfLearners)] 
    889 ##        foldN = [0.0]*res.numberOfIterations 
    890 ## 
    891 ##        if argkw.get("unweighted", 0) or not res.weights: 
    892 ##            for tex in res.results: 
    893 ##                for lrn in range(res.numberOfLearners): 
    894 ##                    CAsByFold[lrn][tex.iterationNumber] +=  
    895 ##                foldN[tex.iterationNumber] += 1 
    896 ##        else: 
    897 ##            for tex in res.results: 
    898 ##                for lrn in range(res.numberOfLearners): 
    899 ##                    CAsByFold[lrn][tex.iterationNumber] +=  
    900 ##                foldN[tex.iterationNumber] += tex.weight 
    901 ## 
    902 ##        newFolds = [] 
    903 ##        for lrn in range(res.numberOfLearners): 
    904 ##            newF = [] 
    905 ##            for fold in range(res.numberOfIterations): 
    906 ##                if foldN[fold]>0.0: 
    907 ##                        newF.append(CAsByFold[lrn][fold]/foldN[fold]) 
    908 ##            newFolds.append(newF) 
    909 ## 
    910 ##        checkNonZero(len(newFolds)) 
    911 ##        return [(statc.mean(cas), statc.sterr(cas)) for cas in newFolds] 
    912 ## 
    913863 
    914864def IS_ex(Pc, P): 
Note: See TracChangeset for help on using the changeset viewer.