|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrelational.helper.DataSetHelper
Contains helper methods (e.g. preprocessing)
Constructor Summary | |
DataSetHelper()
|
Method Summary | |
static weka.core.FastVector |
add(weka.core.FastVector v1,
weka.core.FastVector v2)
Merge vectors |
static int[] |
computeDistribution(weka.core.Instances instances)
Computes distribution of instances (regarding the categories) |
static double[] |
computePriors(weka.core.FastVector items,
java.util.HashMap labels,
java.lang.String type)
Computes the prior from the training set |
static double[] |
computePriors(weka.core.FastVector items,
int iLabel,
java.lang.String type)
Computes the prior from the training set (for binary classification) |
static java.util.HashMap |
countNeighborsClassesMultiLabelTest(weka.core.FastVector items,
int klasse,
java.util.HashMap initial,
java.util.HashMap weightsMap,
java.util.HashMap nodes)
Counts the frequency (weighted by their probabilities) of the classes of neighbors in the test set (for binary classification) |
static java.util.HashMap |
countNeighborsClassesMultiLabelTrain(weka.core.FastVector items,
java.util.HashMap initial,
java.util.HashMap weightsMap,
java.util.HashMap nodes,
int labelSize)
Counts the frequency of the classes of neighbors in the train set (for binary classification) |
static java.util.HashMap |
countNeighborsClassesTest(weka.core.FastVector items,
java.util.HashMap initial,
java.util.HashMap weightsMap,
java.util.HashMap nodes,
int labelSize)
Counts the frequency (weighted by their probabilities) of the classes of neighbors in the test set |
static java.util.HashMap |
countNeighborsClassesTrain(weka.core.FastVector items,
java.util.HashMap initial,
java.util.HashMap weightsMap,
java.util.HashMap nodes,
int labelsSize)
Counts the frequency of the classes of neighbors in the train set |
static weka.classifiers.Classifier[] |
loadClassifier(java.lang.String filename,
int numClassifier)
Loads classifier |
static weka.core.FastVector |
loadFastVector(java.lang.String filename)
Loads a fastvector |
static java.util.HashMap |
loadHashmap(java.lang.String filename)
Loads hashmap |
static java.util.Hashtable |
loadHashtable(java.lang.String filename)
Loads hashtable |
static double[][] |
loadMatrix(java.lang.String filename)
Loads matrix |
static java.util.Vector |
loadVector(java.lang.String filename)
Loads a vector |
static void |
main(java.lang.String[] args)
|
static java.util.HashMap |
normalizeWeights(BipartGraph graph,
weka.core.FastVector test,
java.util.HashMap weights)
Normalizes the weights of the graph, so that the values are between 0 and 1 |
static java.util.HashMap |
normalizeWeights(edu.uci.ics.jung.graph.impl.SparseGraph graph,
weka.core.FastVector test,
java.util.HashMap weights)
Normalizes the weights of the graph, so that the values are between 0 and 1 |
static void |
saveClassifier(java.lang.String filename,
weka.classifiers.Classifier[] cl)
serialize a classifier |
static void |
saveHashMap(java.lang.String filename,
java.util.HashMap h)
serialize hashmap |
static void |
saveMatrix(java.lang.String filename,
double[][] m)
serialize matrix |
static void |
saveTrainTest(weka.core.FastVector traintest,
java.lang.String outputPath,
boolean multilabel,
int numFolds,
java.lang.String type)
Write training and test sets into a xml-file |
static void |
saveVector(java.lang.String filename,
weka.core.FastVector items)
serialize vector |
static void |
saveVector(java.lang.String filename,
java.util.Vector items)
serialize vector |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DataSetHelper()
Method Detail |
public static java.util.HashMap countNeighborsClassesTrain(weka.core.FastVector items, java.util.HashMap initial, java.util.HashMap weightsMap, java.util.HashMap nodes, int labelsSize)
items
- - data setinitial
- - initialization of test setweightsMap
- - weights of edgesnodes
- - nodes of the graphlabelsSize
- - number of categories
public static java.util.HashMap countNeighborsClassesTest(weka.core.FastVector items, java.util.HashMap initial, java.util.HashMap weightsMap, java.util.HashMap nodes, int labelSize)
items
- - data setinitial
- - initialization of test setweightsMap
- - weights of edgesnodes
- - nodes of the graph
public static java.util.HashMap countNeighborsClassesMultiLabelTrain(weka.core.FastVector items, java.util.HashMap initial, java.util.HashMap weightsMap, java.util.HashMap nodes, int labelSize)
items
- - data setinitial
- - initialization of test setweightsMap
- - weights of edgesnodes
- - nodes of the graph
public static java.util.HashMap countNeighborsClassesMultiLabelTest(weka.core.FastVector items, int klasse, java.util.HashMap initial, java.util.HashMap weightsMap, java.util.HashMap nodes)
items
- - data setinitial
- - initialization of test setweightsMap
- - weights of edgesnodes
- - nodes of the graph
public static weka.core.FastVector loadFastVector(java.lang.String filename)
filename
-
public static java.util.Vector loadVector(java.lang.String filename)
filename
-
public static weka.classifiers.Classifier[] loadClassifier(java.lang.String filename, int numClassifier)
filename
- numClassifier
- - number of classifiers to be loaded
public static java.util.HashMap loadHashmap(java.lang.String filename)
filename
-
public static double[][] loadMatrix(java.lang.String filename)
filename
-
public static java.util.Hashtable loadHashtable(java.lang.String filename)
filename
-
public static int[] computeDistribution(weka.core.Instances instances)
instances
- - data instances
public static double[] computePriors(weka.core.FastVector items, int iLabel, java.lang.String type)
items
- - train settype
- - indicates the type of problem (heterogenous or homogenous)
public static double[] computePriors(weka.core.FastVector items, java.util.HashMap labels, java.lang.String type)
items
- - train setlabels
- - categoriestype
- - indicates the type of problem (heterogenous or homogenous)
public static void saveTrainTest(weka.core.FastVector traintest, java.lang.String outputPath, boolean multilabel, int numFolds, java.lang.String type) throws java.io.IOException
traintest
- - train and test setoutputPath
- - location where to savemultilabel
- - indicates if have to cope with multilabel problemnumFolds
- - number of folds (cross-validation)type
- - indicates the type of problem (heterogenous or homogenous)
java.io.IOException
public static void saveVector(java.lang.String filename, weka.core.FastVector items)
filename
- items
- vectorpublic static void saveVector(java.lang.String filename, java.util.Vector items)
filename
- items
- vectorpublic static void saveClassifier(java.lang.String filename, weka.classifiers.Classifier[] cl)
filename
- cl
- classifierpublic static void saveHashMap(java.lang.String filename, java.util.HashMap h)
filename
- h
- hashmappublic static void saveMatrix(java.lang.String filename, double[][] m)
filename
- m
- matrixpublic static weka.core.FastVector add(weka.core.FastVector v1, weka.core.FastVector v2)
v1
- vectorv2
- vector
public static java.util.HashMap normalizeWeights(BipartGraph graph, weka.core.FastVector test, java.util.HashMap weights)
graph
- - graph (jung)test
- - test setweights
- - weights of the edges in the graph
public static java.util.HashMap normalizeWeights(edu.uci.ics.jung.graph.impl.SparseGraph graph, weka.core.FastVector test, java.util.HashMap weights)
graph
- - graph (jung)test
- - test setweights
- - weights of the edges in the graph
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |