public abstract class PSUtils extends 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,
HashMap<LabelSet,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 HashMap<LabelSet,Integer> |
countCombinationsSparse(weka.core.Instances D,
int L)
CountCombinationsSparse - return a mapping of each distinct label combination and its count.
|
static HashMap<LabelSet,Integer> |
countCombinationsSparseSubset(weka.core.Instances D,
int[] indices)
CountCombinationsSparseSubset - like CountCombinationsSparse, but only interested in 'indices[]' wrt 'D'.
|
static int |
countSubsets(LabelSet ysub,
Set<LabelSet> Y)
Count Subsets - returns the number of times labelset 'ysub' exists as a subset in 'Y'.
|
static LabelSet[] |
cover(LabelSet y,
HashMap<LabelSet,Integer> map)
Cover - cover 'y' completely (or as best as possible) with sets from 'map'.
|
static Set<LabelSet> |
cover(LabelSet y,
SortedSet<LabelSet> S,
Comparator cmp) |
static LabelSet[] |
getAllSubsets(LabelSet y,
HashMap<LabelSet,Integer> map)
GetAllSubsets - Get all frequent subsets of 'y' according to 'map'.
|
static SortedSet<LabelSet> |
getSortedSubsets(LabelSet y,
HashMap<LabelSet,Integer> map)
Get Sorted Subsets - get all subsets of 'y' in the set 'set'; sorted according to length, and counts in 'map'.
|
static SortedSet<LabelSet> |
getSortedSubsets(LabelSet y,
Set<LabelSet> set,
Comparator cmp)
Get Sorted Subsets - get all subsets of 'y' in the set 'set'; sorted according to 'cmp'.
|
static Set<LabelSet> |
getSubsets(LabelSet y,
Set<LabelSet> set)
Get Subsets - get all subsets of 'y' in the set 'set'.
|
static LabelSet[] |
getTopNSubsets(LabelSet y,
HashMap<LabelSet,Integer> map,
int n)
GetTopNSubsets - Don't cover all (like cover(y,map), rather only the top 'n')
|
static SortedSet<LabelSet> |
getTopNSubsetsAsSet(LabelSet y,
HashMap<LabelSet,Integer> map,
int n) |
static LabelSet |
getTopSubset(LabelSet y,
HashMap<LabelSet,Integer> map) |
static weka.core.Instances |
LCTransformation(weka.core.Instances D) |
static weka.core.Instances |
LCTransformation(weka.core.Instances D,
int L) |
static HashMap<LabelSet,Integer> |
loadMap(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,
HashMap<LabelSet,Integer> map,
int n,
weka.core.Instances iTemplate)
Transform one instance into multi-class representations (an array of possibly multiple single-label instances).
|
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 |
PSTransformation(weka.core.Instances D,
int L,
String cname,
int p,
int n)
Transform instances into a multi-class representation.
|
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(String filename,
HashMap<LabelSet,Integer> map)
SaveMap - Save the HashMap 'map' to the file 'filename'.
|
static weka.core.Instances |
SLTransformation(weka.core.Instances D,
int L,
String cname,
int p,
int n)
Transform instances into a multi-class representation.
|
static int |
sumCounts(HashMap<LabelSet,Integer> map)
Sum Counts - sum all the values in 'map'.
|
public static int sumCounts(HashMap<LabelSet,Integer> map)
public static int countSubsets(LabelSet ysub, Set<LabelSet> Y)
public static Set<LabelSet> getSubsets(LabelSet y, Set<LabelSet> set)
public static SortedSet<LabelSet> getSortedSubsets(LabelSet y, Set<LabelSet> set, Comparator cmp)
public static SortedSet<LabelSet> getSortedSubsets(LabelSet y, HashMap<LabelSet,Integer> map)
public static LabelSet[] cover(LabelSet y, HashMap<LabelSet,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 LabelSet[] getAllSubsets(LabelSet y, HashMap<LabelSet,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, HashMap<LabelSet,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 SortedSet<LabelSet> getTopNSubsetsAsSet(LabelSet y, HashMap<LabelSet,Integer> map, int n)
public static HashMap<LabelSet,Integer> countCombinationsSparseSubset(weka.core.Instances D, int[] indices)
D
- datasetindices
- indices we are interested inpublic static final HashMap<LabelSet,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)
public static weka.core.Instances PSTransformation(weka.core.Instances D, int L, String cname, int p, int n)
D
- original datasetL
- number of labels in the original datasetcname
- class name for the new dataset (may want to encode the list of indices here for RAkEL-like methods)p
- pruning valuen
- restoration valuepublic static weka.core.Instance[] PSTransformation(weka.core.Instance x, int L, HashMap<LabelSet,Integer> map, int n, weka.core.Instances iTemplate)
x
- instanceL
- number of labels in the instancemap
- a map of labelsets to their frequenciesn
- restoration valuepublic static weka.core.Instances SLTransformation(weka.core.Instances D, int L, String cname, int p, int n)
D
- original datasetL
- number of labels in that datasetcname
- class name for the new dataset (may want to encode the list of indices here for RAkEL-like methods)p
- pruning valuen
- restoration valuepublic static final LabelSet[] convert(LabelSet[] sparseY, HashMap<LabelSet,Integer> map)
public static final void saveMap(String filename, HashMap<LabelSet,Integer> map) throws Exception
Exception
Copyright © 2017. All Rights Reserved.