public abstract class PSUtils
extends java.lang.Object
P
parameter for pruning and an N
parameter for reintroduction.Constructor and Description |
---|
PSUtils() |
Modifier and Type | Method and Description |
---|---|
static LabelSet[] |
convert(LabelSet[] sparseY,
java.util.HashMap<LabelSet,java.lang.Integer> map)
Given N labelsets 'sparseY', use a count 'map' to
|
static double[] |
convertDistribution(double[] p,
int L,
weka.core.Instances iTemplate)
Deprecated.
|
static double[] |
convertDistribution(double[] p,
int L,
LabelSet[] meta_labels)
Convert Distribution - Given the posterior across combinations, return the distribution across labels.
|
static weka.core.Instance |
convertInstance(weka.core.Instance x,
int L,
weka.core.Instances template)
Convert a multi-label instance into a multi-class instance, according to a template.
|
static java.util.HashMap<LabelSet,java.lang.Integer> |
countCombinationsSparse(weka.core.Instances D,
int L)
CountCombinationsSparse - return a mapping of each distinct label combination and its count.
|
static java.util.HashMap<LabelSet,java.lang.Integer> |
countCombinationsSparseSubset(weka.core.Instances D,
int[] indices)
CountCombinationsSparseSubset - like CountCombinationsSparse, but only interested in 'indices[]' wrt 'D'.
|
static int |
countSubsets(LabelSet ysub,
java.util.Set<LabelSet> Y)
Count Subsets - returns the number of times labelset 'ysub' exists as a subset in 'Y'.
|
static LabelSet[] |
cover(LabelSet y,
java.util.HashMap<LabelSet,java.lang.Integer> map)
Cover - cover 'y' completely (or as best as possible) with sets from 'map'.
|
static java.util.Set<LabelSet> |
cover(LabelSet y,
java.util.SortedSet<LabelSet> S,
java.util.Comparator cmp) |
static LabelSet[] |
getAllSubsets(LabelSet y,
java.util.HashMap<LabelSet,java.lang.Integer> map)
GetAllSubsets - Get all frequent subsets of 'y' according to 'map'.
|
static java.util.SortedSet<LabelSet> |
getSortedSubsets(LabelSet y,
java.util.HashMap<LabelSet,java.lang.Integer> map)
Get Sorted Subsets - get all subsets of 'y' in the set 'set'; sorted according to length, and counts in 'map'.
|
static java.util.SortedSet<LabelSet> |
getSortedSubsets(LabelSet y,
java.util.Set<LabelSet> set,
java.util.Comparator cmp)
Get Sorted Subsets - get all subsets of 'y' in the set 'set'; sorted according to 'cmp'.
|
static java.util.Set<LabelSet> |
getSubsets(LabelSet y,
java.util.Set<LabelSet> set)
Get Subsets - get all subsets of 'y' in the set 'set'.
|
static LabelSet[] |
getTopNSubsets(LabelSet y,
java.util.HashMap<LabelSet,java.lang.Integer> map,
int n)
GetTopNSubsets - Don't cover all (like cover(y,map), rather only the top 'n')
|
static java.util.SortedSet<LabelSet> |
getTopNSubsetsAsSet(LabelSet y,
java.util.HashMap<LabelSet,java.lang.Integer> map,
int n) |
static LabelSet |
getTopSubset(LabelSet y,
java.util.HashMap<LabelSet,java.lang.Integer> map) |
static weka.core.Instances |
LCTransformation(weka.core.Instances D) |
static weka.core.Instances |
LCTransformation(weka.core.Instances D,
int L) |
static java.util.HashMap<LabelSet,java.lang.Integer> |
loadMap(java.lang.String filename)
LoadMap - Load the HashMap stored in 'filename'.
|
static LabelSet[] |
makeLabelSetMap(weka.core.Instances T) |
static weka.core.Instance[] |
PSTransformation(weka.core.Instance x,
int L,
java.util.HashMap<LabelSet,java.lang.Integer> map,
int n) |
static weka.core.Instances |
PSTransformation(weka.core.Instances D,
int P,
int N) |
static weka.core.Instances |
PSTransformation(weka.core.Instances D,
int L,
int p,
int n) |
static weka.core.Instances |
PSTransformationOLD(weka.core.Instances D,
int L,
int P,
int N)
Deprecated.
|
static double[] |
recombination_t(double[] p,
int L,
weka.core.Instances iTemplate)
Convert Distribution - Given the posterior across combinations, return the distribution across labels.
|
static double[] |
recombination_t(double[] p,
int L,
LabelSet[] map) |
static double[] |
recombination(double[] p,
int L,
LabelSet[] map)
Convert Distribution - Given the posterior across combinations, return the distribution across labels.
|
static void |
saveMap(java.lang.String filename,
java.util.HashMap<LabelSet,java.lang.Integer> map)
SaveMap - Save the HashMap 'map' to the file 'filename'.
|
static int |
sumCounts(java.util.HashMap<LabelSet,java.lang.Integer> map)
Sum Counts - sum all the values in 'map'.
|
public static int sumCounts(java.util.HashMap<LabelSet,java.lang.Integer> map)
public static int countSubsets(LabelSet ysub, java.util.Set<LabelSet> Y)
public static java.util.Set<LabelSet> getSubsets(LabelSet y, java.util.Set<LabelSet> set)
public static java.util.SortedSet<LabelSet> getSortedSubsets(LabelSet y, java.util.Set<LabelSet> set, java.util.Comparator cmp)
public static java.util.SortedSet<LabelSet> getSortedSubsets(LabelSet y, java.util.HashMap<LabelSet,java.lang.Integer> map)
public static LabelSet[] cover(LabelSet y, java.util.HashMap<LabelSet,java.lang.Integer> map)
y
- a LabelSet, e.g., [0,2,7]map
- a map of LabelSets to counts e.g., {[0,2,7]:39,...}public static java.util.Set<LabelSet> cover(LabelSet y, java.util.SortedSet<LabelSet> S, java.util.Comparator cmp)
public static LabelSet[] getAllSubsets(LabelSet y, java.util.HashMap<LabelSet,java.lang.Integer> map)
y
- a labelset, e.g., [0,2,7]map
- a map of labelsets to counts e.g., {[0,2]:39, [2,7]:5, [2,9]:24...}public static LabelSet[] getTopNSubsets(LabelSet y, java.util.HashMap<LabelSet,java.lang.Integer> map, int n)
y
- a labelset, e.g., [0,2,7]map
- a map of labelsets to counts e.g., {[0,2]:39, [2,7]:5, [2,9]:24...}n
- the number of sets to takepublic static java.util.SortedSet<LabelSet> getTopNSubsetsAsSet(LabelSet y, java.util.HashMap<LabelSet,java.lang.Integer> map, int n)
public static LabelSet getTopSubset(LabelSet y, java.util.HashMap<LabelSet,java.lang.Integer> map)
public static java.util.HashMap<LabelSet,java.lang.Integer> countCombinationsSparseSubset(weka.core.Instances D, int[] indices)
D
- datasetindices
- indices we are interested inpublic static final java.util.HashMap<LabelSet,java.lang.Integer> countCombinationsSparse(weka.core.Instances D, int L)
D
- datasetL
- number of labels@Deprecated public static double[] convertDistribution(double[] p, int L, weka.core.Instances iTemplate)
p
- the posterior of the super classes (combinations), e.g., P([1,3],[2]) = [1,0]L
- the number of labelsrecombination(double[],int,LabelSet[])
public static double[] convertDistribution(double[] p, int L, LabelSet[] meta_labels)
p
- the posterior of the super classes (combinations), e.g., P([1,3],[2]) = [0.3,0.7]L
- the number of labels, e.g., L = 3meta_labels
- typical mapping, e.g., [13] to [1,3]public static final LabelSet[] makeLabelSetMap(weka.core.Instances T)
public static final double[] recombination(double[] p, int L, LabelSet[] map)
p
- the posterior of the super classes (combinations), e.g., P([1,3],[2]) = [1,0]L
- the number of labelspublic static final double[] recombination_t(double[] p, int L, weka.core.Instances iTemplate)
p
- the posterior of the super classes (combinations), e.g., P([1,3],[2]) = [0.3,0.7]L
- the number of labelspublic static final double[] recombination_t(double[] p, int L, LabelSet[] map)
public static weka.core.Instance convertInstance(weka.core.Instance x, int L, weka.core.Instances template)
public static weka.core.Instances LCTransformation(weka.core.Instances D)
public static weka.core.Instances LCTransformation(weka.core.Instances D, int L)
public static weka.core.Instances PSTransformation(weka.core.Instances D, int P, int N)
public static weka.core.Instances PSTransformation(weka.core.Instances D, int L, int p, int n)
@Deprecated public static weka.core.Instances PSTransformationOLD(weka.core.Instances D, int L, int P, int N)
public static weka.core.Instance[] PSTransformation(weka.core.Instance x, int L, java.util.HashMap<LabelSet,java.lang.Integer> map, int n)
public static final LabelSet[] convert(LabelSet[] sparseY, java.util.HashMap<LabelSet,java.lang.Integer> map)
public static final void saveMap(java.lang.String filename, java.util.HashMap<LabelSet,java.lang.Integer> map) throws java.lang.Exception
java.lang.Exception
public static java.util.HashMap<LabelSet,java.lang.Integer> loadMap(java.lang.String filename) throws java.lang.Exception
java.lang.Exception