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

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

public class Models.BayesModel
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.BayesModel()
           
 
Method Summary
 void computeDefaultNewWorkerConfusion()
          Compute default worker confusion map
 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
 double getLapAlpha()
          Get Laplacian alpha smoothing parameter
 double getLapBeta()
          Get Laplacian beta smoothing parameter
 Map<TypeR,Map<TypeR,Double>> getNewWorkerConfusion()
          Get default worker confusion map
 TreeSet<TypeR> getResponseCategories()
          Get valid response categories
 Map<TypeQ,TypeR> getTuneGT()
          Get ground truth question response pairs from the tune partition
 Map<TypeWID,Map<TypeR,Map<TypeR,Double>>> getWorkerConfustionMaps()
          Get worker confusion maps
 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 hasCombinedEstLabels()
          Checks if results are computed
 boolean hasGoldStandard()
          Checks if gold standard is used by the algorithm (supervised)
 boolean hasLapAlpha()
          Check is Laplacian alpha smoothing parameter is loaded
 boolean hasLapBeta()
          Check is Laplacian beta smoothing parameter is loaded
 boolean hasNewWorkerConfusion()
          Check presence of confusion map default for new workers
 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 hasWorkerConfusionMaps()
          Check for presence of worker confusion maps
 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 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 setLapAlpha(double lapAlpha)
          Set Laplacian alpha smoothing parameter
 void setLapBeta(double lapBeta)
          Set Laplacian beta smoothing parameter
 void setNewWorkerConfusion(HashMap<TypeR,Map<TypeR,Double>> newWorkerConfusionMap)
          Set default worker confusion map
 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 setWorkerConfusionMaps(Map<TypeWID,Map<TypeR,Map<TypeR,Double>>> workerConfusionMaps)
          Set worker confusion maps
 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
 void updateWorkerConfusionMaps(Map<TypeWID,Map<TypeR,Map<TypeR,Double>>> workerConfusionMaps)
          Update worker confusion maps
 
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.BayesModel

public Models.BayesModel()
Method Detail

hasWorkerConfusionMaps

public boolean hasWorkerConfusionMaps()
Check for presence of worker confusion maps

Returns:
true if worker confusion maps are present

getWorkerConfustionMaps

public Map<TypeWID,Map<TypeR,Map<TypeR,Double>>> getWorkerConfustionMaps()
Get worker confusion maps

Returns:
worker confusion maps -- Map from workers to confusion maps

setWorkerConfusionMaps

public void setWorkerConfusionMaps(Map<TypeWID,Map<TypeR,Map<TypeR,Double>>> workerConfusionMaps)
Set worker confusion maps

Parameters:
workerConfusionMaps - is Map from workers to confusion maps

updateWorkerConfusionMaps

public void updateWorkerConfusionMaps(Map<TypeWID,Map<TypeR,Map<TypeR,Double>>> workerConfusionMaps)
Update worker confusion maps

Parameters:
workerConfusionMaps - is Map form workers to confusion maps

hasLapAlpha

public boolean hasLapAlpha()
Check is Laplacian alpha smoothing parameter is loaded

Returns:
true if the Laplacian aplha smoothing parameter is loaded

getLapAlpha

public double getLapAlpha()
Get Laplacian alpha smoothing parameter

Returns:
double holding Laplacian alpha smoothing parameter

setLapAlpha

public void setLapAlpha(double lapAlpha)
Set Laplacian alpha smoothing parameter

Parameters:
lapAlpha - is a double holding Laplacian alpha smoothing parameter

hasLapBeta

public boolean hasLapBeta()
Check is Laplacian beta smoothing parameter is loaded

Returns:
true if the Laplacian beta smoothing parameter is loaded

getLapBeta

public double getLapBeta()
Get Laplacian beta smoothing parameter

Returns:
double holding Laplacian beta smoothing parameter

setLapBeta

public void setLapBeta(double lapBeta)
Set Laplacian beta smoothing parameter

Parameters:
lapBeta - is a double holding Laplacian beta smoothing parameter

hasNewWorkerConfusion

public boolean hasNewWorkerConfusion()
Check presence of confusion map default for new workers

Returns:
true if a default confusion map is loaded

getNewWorkerConfusion

public Map<TypeR,Map<TypeR,Double>> getNewWorkerConfusion()
Get default worker confusion map

Returns:
a Map from responses to confusion maps

setNewWorkerConfusion

public void setNewWorkerConfusion(HashMap<TypeR,Map<TypeR,Double>> newWorkerConfusionMap)
Set default worker confusion map

Parameters:
newWorkerConfusionMap - is a Map from responses to confusion maps

computeDefaultNewWorkerConfusion

public void computeDefaultNewWorkerConfusion()
Compute default worker confusion map


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.