org.square.qa.utilities.constructs
Class Models.MajorityModel

java.lang.Object
  extended by org.square.qa.utilities.constructs.Models.MajorityModel
All Implemented Interfaces:
AlgorithmInterface<TypeWID,TypeQ,TypeR>
Enclosing class:
Models<TypeWID,TypeQ,TypeR>

public class Models.MajorityModel
extends Object


Field Summary
protected  Map<TypeQ,Pair<TypeR,Map<TypeR,Double>>> combinedEstLabels
           
protected  Map<TypeQ,TypeR> goldStandard
           
protected  TreeSet<TypeR> responseCategories
           
protected  Map<TypeQ,TypeR> tuneGT
           
protected  Map<TypeWID,workersDataStruct<TypeQ,TypeR>> workersMap
           
protected  Map<TypeWID,workersDataStruct<TypeQ,TypeR>> workersMapGold
           
protected  Map<TypeWID,workersDataStruct<TypeQ,TypeR>> workersMapTune
           
 
Constructor Summary
Models.MajorityModel()
           
 
Method Summary
 Map<TypeR,Double> getClassPriors()
          Get class priors
 Map<TypeQ,Pair<TypeR,Map<TypeR,Double>>> getCombinedEstLabels()
          Get computed/partially-computed results
 Map<TypeQ,TypeR> getGoldStandard()
          Get ground truth question response pairs from the gold partition
 TreeSet<TypeR> getResponseCategories()
          Get valid response categories
 Map<TypeQ,TypeR> getTuneGT()
          Get ground truth question response pairs from the tune partition
 Map<TypeWID,workersDataStruct<TypeQ,TypeR>> getWorkersMap()
          Get all responses stored for each worker
 Map<TypeWID,workersDataStruct<TypeQ,TypeR>> getWorkersMapGold()
          Get worker responses from the Gold partition
 Map<TypeWID,workersDataStruct<TypeQ,TypeR>> getWorkersMapTune()
          Get worker responses from the Tune partition
 boolean hasClassPriors()
          Check for presence of class priors
 boolean hasCombinedEstLabels()
          Checks if results are computed
 boolean hasGoldStandard()
          Checks if gold standard is used by the algorithm (supervised)
 boolean hasResponseCategories()
          Checks for presence of response categories
 boolean hasTuneGT()
          Checks if ground truth for tune partition is used by the algorithm (lightly-supervised)
 boolean hasWorkersMap()
          Checks for presence of worker responses from the evaluation partition
 boolean hasWorkersMapGold()
          Checks for presence of worker responses from the gold partition
 boolean hasWorkersMapTune()
          Checks for presence of worker responses from the tune partition
 void setClassPriors(double... classPriors)
          Set class priors
 void setClassPriors(Map<TypeR,Double> classPriors)
          Set class priors
 void setCombinedEstLabels(Map<TypeQ,Pair<TypeR,Map<TypeR,Double>>> combinedEstLabels)
          Load computed/partially-computed results
 void setGoldStandard(Map<TypeQ,TypeR> goldStandard)
          Set ground truth question response pairs from the gold partition
 void setResponseCategories(TreeSet<TypeR> responseCategories)
          Set response categories
 void setTuneGT(Map<TypeQ,TypeR> tuneGT)
          Set ground truth question response pairs from the tune partition
 void setWorkersMap(Map<TypeWID,workersDataStruct<TypeQ,TypeR>> workersMap)
          Set responses to questions for each worker
 void setWorkersMapGold(Map<TypeWID,workersDataStruct<TypeQ,TypeR>> workersMapGold)
          Set worker responses from the Gold partition
 void setWorkersMapTune(Map<TypeWID,workersDataStruct<TypeQ,TypeR>> workersMapTune)
          Set worker responses from the Tune partition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

workersMap

protected Map<TypeWID,workersDataStruct<TypeQ,TypeR>> workersMap

responseCategories

protected TreeSet<TypeR> responseCategories

workersMapTune

protected Map<TypeWID,workersDataStruct<TypeQ,TypeR>> workersMapTune

workersMapGold

protected Map<TypeWID,workersDataStruct<TypeQ,TypeR>> workersMapGold

tuneGT

protected Map<TypeQ,TypeR> tuneGT

goldStandard

protected Map<TypeQ,TypeR> goldStandard

combinedEstLabels

protected Map<TypeQ,Pair<TypeR,Map<TypeR,Double>>> combinedEstLabels
Constructor Detail

Models.MajorityModel

public Models.MajorityModel()
Method Detail

setClassPriors

public void setClassPriors(Map<TypeR,Double> classPriors)
Set class priors

Parameters:
classPriors - is a Map from class categories to doubles

setClassPriors

public void setClassPriors(double... classPriors)
Set class priors

Parameters:
classPriors - is an array of doubles

getClassPriors

public Map<TypeR,Double> getClassPriors()
Get class priors

Returns:
class priors as a Map from class categories to doubles

hasClassPriors

public boolean hasClassPriors()
Check for presence of class priors

Returns:
true if class priors are present

getWorkersMap

public Map<TypeWID,workersDataStruct<TypeQ,TypeR>> getWorkersMap()
Description copied from interface: AlgorithmInterface
Get all responses stored for each worker

Specified by:
getWorkersMap in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
a Map from Worker ID to a worker object holding questions and responses

setWorkersMap

public void setWorkersMap(Map<TypeWID,workersDataStruct<TypeQ,TypeR>> workersMap)
Description copied from interface: AlgorithmInterface
Set responses to questions for each worker

Specified by:
setWorkersMap in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Parameters:
workersMap - is a Map from Worker ID to a worker object holding questions and responses

getResponseCategories

public TreeSet<TypeR> getResponseCategories()
Description copied from interface: AlgorithmInterface
Get valid response categories

Specified by:
getResponseCategories in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
is a sorted set of response categories

setResponseCategories

public void setResponseCategories(TreeSet<TypeR> responseCategories)
Description copied from interface: AlgorithmInterface
Set response categories

Specified by:
setResponseCategories in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Parameters:
responseCategories - is a TreeSet of TypeR

getWorkersMapTune

public Map<TypeWID,workersDataStruct<TypeQ,TypeR>> getWorkersMapTune()
Description copied from interface: AlgorithmInterface
Get worker responses from the Tune partition

Specified by:
getWorkersMapTune in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
a Map from workers to objects containing worker questions and responses

setWorkersMapTune

public void setWorkersMapTune(Map<TypeWID,workersDataStruct<TypeQ,TypeR>> workersMapTune)
Description copied from interface: AlgorithmInterface
Set worker responses from the Tune partition

Specified by:
setWorkersMapTune in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Parameters:
workersMapTune - is a Map from workers to objects containing worker questions and responses

getWorkersMapGold

public Map<TypeWID,workersDataStruct<TypeQ,TypeR>> getWorkersMapGold()
Description copied from interface: AlgorithmInterface
Get worker responses from the Gold partition

Specified by:
getWorkersMapGold in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
a Map from workers to objects containing worker questions and responses

setWorkersMapGold

public void setWorkersMapGold(Map<TypeWID,workersDataStruct<TypeQ,TypeR>> workersMapGold)
Description copied from interface: AlgorithmInterface
Set worker responses from the Gold partition

Specified by:
setWorkersMapGold in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Parameters:
workersMapGold - is a Map from workers to objects containing worker questions and responses

getTuneGT

public Map<TypeQ,TypeR> getTuneGT()
Description copied from interface: AlgorithmInterface
Get ground truth question response pairs from the tune partition

Specified by:
getTuneGT in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
is a Map from questions to responses

setTuneGT

public void setTuneGT(Map<TypeQ,TypeR> tuneGT)
Description copied from interface: AlgorithmInterface
Set ground truth question response pairs from the tune partition

Specified by:
setTuneGT in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Parameters:
tuneGT - is a Map from questions to responses

getGoldStandard

public Map<TypeQ,TypeR> getGoldStandard()
Description copied from interface: AlgorithmInterface
Get ground truth question response pairs from the gold partition

Specified by:
getGoldStandard in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
is a Map from questions to responses

setGoldStandard

public void setGoldStandard(Map<TypeQ,TypeR> goldStandard)
Description copied from interface: AlgorithmInterface
Set ground truth question response pairs from the gold partition

Specified by:
setGoldStandard in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Parameters:
goldStandard - is a Map from questions to responses

hasWorkersMap

public boolean hasWorkersMap()
Description copied from interface: AlgorithmInterface
Checks for presence of worker responses from the evaluation partition

Specified by:
hasWorkersMap in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
true if workers responses are loaded

hasWorkersMapTune

public boolean hasWorkersMapTune()
Description copied from interface: AlgorithmInterface
Checks for presence of worker responses from the tune partition

Specified by:
hasWorkersMapTune in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
true if workers responses are loaded

hasWorkersMapGold

public boolean hasWorkersMapGold()
Description copied from interface: AlgorithmInterface
Checks for presence of worker responses from the gold partition

Specified by:
hasWorkersMapGold in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
true if workers responses are loaded

hasResponseCategories

public boolean hasResponseCategories()
Description copied from interface: AlgorithmInterface
Checks for presence of response categories

Specified by:
hasResponseCategories in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
true if response categories are loaded

hasGoldStandard

public boolean hasGoldStandard()
Description copied from interface: AlgorithmInterface
Checks if gold standard is used by the algorithm (supervised)

Specified by:
hasGoldStandard in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
true if gold standard is available

hasTuneGT

public boolean hasTuneGT()
Description copied from interface: AlgorithmInterface
Checks if ground truth for tune partition is used by the algorithm (lightly-supervised)

Specified by:
hasTuneGT in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
true if ground truth for tune partition is available

getCombinedEstLabels

public Map<TypeQ,Pair<TypeR,Map<TypeR,Double>>> getCombinedEstLabels()
Description copied from interface: AlgorithmInterface
Get computed/partially-computed results

Specified by:
getCombinedEstLabels in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
a Map from questions to Pair of predicted response and response probabilities

hasCombinedEstLabels

public boolean hasCombinedEstLabels()
Description copied from interface: AlgorithmInterface
Checks if results are computed

Specified by:
hasCombinedEstLabels in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Returns:
true if results have been computed

setCombinedEstLabels

public void setCombinedEstLabels(Map<TypeQ,Pair<TypeR,Map<TypeR,Double>>> combinedEstLabels)
Description copied from interface: AlgorithmInterface
Load computed/partially-computed results

Specified by:
setCombinedEstLabels in interface AlgorithmInterface<TypeWID,TypeQ,TypeR>
Parameters:
combinedEstLabels - is a Map from questions to Pair of predicted response and response probabilities


Copyright © 2013. All Rights Reserved.