Table of Contents

Module: roc compClust/score/roc.py

Written By: Christopher Hart

This module provides a general mechinism for calculating ROC-like analysis on lists.

Imported modules   
import MLab
import Numeric
from compClust.mlx import views, labelings
from compClust.util import DistanceMetrics, listOps
Functions   
clusterROC
clusteringROC
interclusterROC
rocCurve
  clusterROC 
clusterROC (
        dataset,
        labeling,
        label,
        distanceMetric=DistanceMetrics.EuclideanDistance,
        )

returns the ROCarea, xcoords, ycoords for a ROC cuve given a dataset, labeling and a label from that labeling, return an ROC curve and area. DistanceMetric must be of the functional form:

[list of distances] = distanceMetric(vector, array)

Implimentations of several distance metrics can be found in compClust.util.DistanceMetrics

  clusteringROC 
clusteringROC (
        dataset,
        labeling,
        distanceMetric=DistanceMetrics.EuclideanDistance,
        )

given a dataset and a labeling return a dictionary with ROC statistics for each cluster in the daaset.

  interclusterROC 
interclusterROC (
        dataset,
        labeling1,
        label1,
        labeling2,
        label2,
        distanceMetric=DistanceMetrics.EuclideanDistance,
        )

Given a dataset and a label from labeling1 and label from labeling2 calculate the ROC curve between the two sets bound to labe1 and label2

  rocCurve 
rocCurve (
        orderedList,
        set1,
        set2,
        )

returns 2 lists: the X and Y coordanates for creating an ROC curve on the input data.

given an orderedList which contains items from set1 and set2, generate an ROC curve plotting list1 vs list2

The area contained under this curve is easily calculated using MLab.trapz

example:

orderedList = [1,1,0,0,1,1,0,1,0,0,0,1,0] set1 = [1] set2 = [0]

([0,1,2,2,3,4,],[0,0,0,])rocCurve(orderedList, set1, set2)


Table of Contents

This document was automatically generated on Wed Aug 27 14:25:10 2003 by HappyDoc version 2.1