ipeirotis.gal.scripts
Class DawidSkene

java.lang.Object
  extended by ipeirotis.gal.scripts.DawidSkene

public class DawidSkene
extends java.lang.Object


Field Summary
(package private)  java.util.HashMap<java.lang.String,java.lang.Integer> annotators
           
(package private)  java.util.HashMap<java.lang.Integer,java.lang.Double> annotators_cost_adjusted
           
(package private)  java.util.HashMap<java.lang.Integer,java.lang.Double> annotators_cost_minimized
           
(package private)  java.util.HashMap<java.lang.Integer,java.lang.Double> annotators_cost_naive
           
(package private)  java.util.HashMap<java.lang.Integer,java.lang.String> annotators_names
           
(package private)  java.util.HashMap<java.lang.String,java.lang.Integer> classes
           
(package private)  java.util.HashMap<java.lang.Integer,java.lang.String> classes_names
           
(package private)  java.util.HashMap<java.lang.String,java.lang.Integer> contributions
           
(package private)  int[] correct
           
(package private)  double[][] cost
           
(package private)  int I
           
(package private)  int J
           
(package private)  int K
           
(package private)  int[][] label
           
(package private)  java.util.HashMap<java.lang.String,java.lang.Integer> objects
           
(package private)  java.util.HashMap<java.lang.Integer,java.lang.String> objects_names
           
(package private)  double[][][] pi
           
(package private)  double[] prior
           
(package private)  double[][] T
           
(package private)  double[] Tcount
           
(package private)  double[][] Tdenom
           
 
Constructor Summary
DawidSkene(java.util.Vector<ipeirotis.gal.scripts.Labeling> labels, java.util.Vector<ipeirotis.gal.scripts.Labeling> correct_labels, java.util.Vector<ipeirotis.gal.scripts.Labeling> classification_cost)
           
 
Method Summary
 void estimate(int iterations)
           
 double getAnnotatorCostAdjusted(int k)
          Estimates the cost for annotator k after adjusting class estimates using the error rates of the annotator
 double getAnnotatorCostMinimized(int k)
          Estimates the cost for annotator k after adjusting class estimates using the error rates of the annotator
 double getAnnotatorCostNaive(int k)
          Estimates the cost for annotator k without attempting corrections of labels
 java.util.HashMap<java.lang.Integer,java.lang.Double> getAnnotatorsCost()
           
 java.util.HashMap<java.lang.Integer,java.lang.String> getAnnotatorsName()
           
private  int getMajorityClass(int oid)
           
 java.util.HashMap<java.lang.String,java.lang.String> getMajorityVote()
           
private  double getMinSoftLabelCost(double[] p)
          Gets as input a "soft label" (i.e., a distribution of probabilities over classes) and returns the expected cost of this soft label.
private  double getMinSpammerCost()
          Returns the cost of a "spammer" worker, who assigns completely random labels.
 double[] getObjectClassProbabilities(int oid, int lid)
           
private  double getSoftLabelCost(double[] p)
          Gets as input a "soft label" (i.e., a distribution of probabilities over classes) and returns the expected cost of this soft label.
private  double getSpammerCost()
          Returns the cost of a "spammer" worker, who assigns completely random labels.
private  void initializeCosts()
           
private  void initializeErrorRates()
           
private  void initializeObjectClassProbabilities()
           
private  void initializePriors()
           
static java.util.Vector<ipeirotis.gal.scripts.Labeling> loadLabels(java.lang.String[] lines)
           
static void main(java.lang.String[] args)
           
 java.lang.String printAllWorkerScores()
           
 java.lang.String printAnnotatorCostsSummary()
           
 java.lang.String printDiffVote(java.util.HashMap<java.lang.String,java.lang.String> prior_voting, java.util.HashMap<java.lang.String,java.lang.String> posterior_voting)
           
 java.lang.String printObjectClassProbabilities(double entropy_threshold)
          Prints the objects that have probability distributions with entropy higher than the given threshold
 java.lang.String printPriors()
           
 java.lang.String printVote()
           
 java.lang.String printWorkerScore(int workerid)
           
 void updateAnnotatorCosts()
           
 void updateAnnotatorErrorRates()
           
 void updateObjectClassProbabilities()
           
 void updatePriors()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

annotators

java.util.HashMap<java.lang.String,java.lang.Integer> annotators

contributions

java.util.HashMap<java.lang.String,java.lang.Integer> contributions

objects

java.util.HashMap<java.lang.String,java.lang.Integer> objects

classes

java.util.HashMap<java.lang.String,java.lang.Integer> classes

annotators_names

java.util.HashMap<java.lang.Integer,java.lang.String> annotators_names

objects_names

java.util.HashMap<java.lang.Integer,java.lang.String> objects_names

classes_names

java.util.HashMap<java.lang.Integer,java.lang.String> classes_names

annotators_cost_naive

java.util.HashMap<java.lang.Integer,java.lang.Double> annotators_cost_naive

annotators_cost_adjusted

java.util.HashMap<java.lang.Integer,java.lang.Double> annotators_cost_adjusted

annotators_cost_minimized

java.util.HashMap<java.lang.Integer,java.lang.Double> annotators_cost_minimized

I

int I

J

int J

K

int K

label

int[][] label

correct

int[] correct

pi

double[][][] pi

cost

double[][] cost

prior

double[] prior

T

double[][] T

Tdenom

double[][] Tdenom

Tcount

double[] Tcount
Constructor Detail

DawidSkene

public DawidSkene(java.util.Vector<ipeirotis.gal.scripts.Labeling> labels,
                  java.util.Vector<ipeirotis.gal.scripts.Labeling> correct_labels,
                  java.util.Vector<ipeirotis.gal.scripts.Labeling> classification_cost)
Method Detail

main

public static void main(java.lang.String[] args)

printDiffVote

public java.lang.String printDiffVote(java.util.HashMap<java.lang.String,java.lang.String> prior_voting,
                                      java.util.HashMap<java.lang.String,java.lang.String> posterior_voting)

printVote

public java.lang.String printVote()

loadLabels

public static java.util.Vector<ipeirotis.gal.scripts.Labeling> loadLabels(java.lang.String[] lines)

initializeCosts

private void initializeCosts()

updateAnnotatorCosts

public void updateAnnotatorCosts()

getAnnotatorCostNaive

public double getAnnotatorCostNaive(int k)
Estimates the cost for annotator k without attempting corrections of labels

Parameters:
k -
Returns:
The expected cost of misclassifications of annotator k

getAnnotatorCostMinimized

public double getAnnotatorCostMinimized(int k)
Estimates the cost for annotator k after adjusting class estimates using the error rates of the annotator

Parameters:
k -
Returns:
The expected cost of misclassifications of annotator k

getAnnotatorCostAdjusted

public double getAnnotatorCostAdjusted(int k)
Estimates the cost for annotator k after adjusting class estimates using the error rates of the annotator

Parameters:
k -
Returns:
The expected cost of misclassifications of annotator k

getSoftLabelCost

private double getSoftLabelCost(double[] p)
Gets as input a "soft label" (i.e., a distribution of probabilities over classes) and returns the expected cost of this soft label.

Parameters:
p -
Returns:
The expected cost of this soft label

getMinSoftLabelCost

private double getMinSoftLabelCost(double[] p)
Gets as input a "soft label" (i.e., a distribution of probabilities over classes) and returns the expected cost of this soft label.

Parameters:
p -
Returns:
The expected cost of this soft label

getSpammerCost

private double getSpammerCost()
Returns the cost of a "spammer" worker, who assigns completely random labels.

Returns:
The expected cost of a spammer worker

getMinSpammerCost

private double getMinSpammerCost()
Returns the cost of a "spammer" worker, who assigns completely random labels.

Returns:
The expected cost of a spammer worker

estimate

public void estimate(int iterations)

initializeErrorRates

private void initializeErrorRates()

initializeObjectClassProbabilities

private void initializeObjectClassProbabilities()

initializePriors

private void initializePriors()

printAnnotatorCostsSummary

public java.lang.String printAnnotatorCostsSummary()

printAllWorkerScores

public java.lang.String printAllWorkerScores()

printWorkerScore

public java.lang.String printWorkerScore(int workerid)

printObjectClassProbabilities

public java.lang.String printObjectClassProbabilities(double entropy_threshold)
Prints the objects that have probability distributions with entropy higher than the given threshold

Parameters:
entropy_threshold -

printPriors

public java.lang.String printPriors()

updateAnnotatorErrorRates

public void updateAnnotatorErrorRates()

updateObjectClassProbabilities

public void updateObjectClassProbabilities()

getObjectClassProbabilities

public double[] getObjectClassProbabilities(int oid,
                                            int lid)

updatePriors

public void updatePriors()

getMajorityClass

private int getMajorityClass(int oid)

getMajorityVote

public java.util.HashMap<java.lang.String,java.lang.String> getMajorityVote()

getAnnotatorsName

public java.util.HashMap<java.lang.Integer,java.lang.String> getAnnotatorsName()

getAnnotatorsCost

public java.util.HashMap<java.lang.Integer,java.lang.Double> getAnnotatorsCost()