|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.square.qa.utilities.constructs.GeneralUtils
public class GeneralUtils
Nested Class Summary | |
---|---|
static class |
GeneralUtils.nFoldSet
|
Constructor Summary | |
---|---|
GeneralUtils()
|
Method Summary | |
---|---|
static void |
computeMetrics(org.jblas.DoubleMatrix resultVector,
Metrics metrics,
Pair<org.jblas.DoubleMatrix,org.jblas.DoubleMatrix> groundTruth,
Pair<org.jblas.DoubleMatrix,org.jblas.DoubleMatrix>... gold)
|
static void |
fillNFoldClass(Set<String> responseCategories)
Update NFold class with mapping from workers, questions and categories to Integer |
static Pair<Double,Double> |
getBetaParam(double mean,
double variance)
Get the parameters of a Beta distribution for input mean and variance |
static GeneralUtilsParameterized<String,String,String> |
getParamUtils()
Get parameterized utils object |
static Set<String> |
getQuestions(Map<String,workersDataStruct<String,String>> workersMap)
Extract questions from workers map |
static void |
loadNFoldSet(File loadDir)
Load n fold sets from files |
static void |
printAll(File dir)
Print NFold data to files |
static void |
printStatistics(Map<String,workersDataStruct<String,String>> workersMap,
File... outDir)
Print data statistics |
static void |
setNFoldSets(int n)
Compute n folds from data 5 fold -> 20% => n = 5 80% => n = -5 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GeneralUtils()
Method Detail |
---|
public static GeneralUtilsParameterized<String,String,String> getParamUtils()
public static Pair<Double,Double> getBetaParam(double mean, double variance)
mean
- is double holding mean of the desired Beta distributionvariance
- is a double holding the variance of the desired Beta distribution
public static Set<String> getQuestions(Map<String,workersDataStruct<String,String>> workersMap)
workersMap
- is a Map from workers (String) to an object holding worker questions and responses (Strings)
public static void computeMetrics(org.jblas.DoubleMatrix resultVector, Metrics metrics, Pair<org.jblas.DoubleMatrix,org.jblas.DoubleMatrix> groundTruth, Pair<org.jblas.DoubleMatrix,org.jblas.DoubleMatrix>... gold)
resultVector
- metrics
- is a Metrics object to hold computed metricsgroundTruth
- is a Pair of DoubleMatrix and DoubleMatrix holding questions and responsesgold
- is the supervised/semi-supervised data to be excluded from metrics computationpublic static void fillNFoldClass(Set<String> responseCategories)
responseCategories
- is a Set of String holding response categoriespublic static void setNFoldSets(int n)
n
- is an int (positive till 50% use symmetrically negative for higher folds)public static void printAll(File dir) throws IOException
dir
- is a File holding the print path for files
IOException
public static void printStatistics(Map<String,workersDataStruct<String,String>> workersMap, File... outDir) throws FileNotFoundException
workersMap
- workersMap is a Map from workers to an object holding questions and responsesoutDir
- outDir of type File is the output directory to print files
FileNotFoundException
public static void loadNFoldSet(File loadDir) throws IOException
loadDir
- is a File holding path of the n fold files
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |