@Reference(type=Article, author={"Frank Moosmann","Eric Nowak","Fr{\'e}d{\'e}ric Jurie"}, title="Randomized Clustering Forests for Image Classification", year="2008", journal="IEEE PAMI", url="http://dx.doi.org/10.1109/TPAMI.2007.70822") public class IntRandomForest extends Object implements SpatialClusters<int[]>, SpatialClusterer<IntRandomForest,int[]>, HardAssigner<int[],float[],IntFloatPair>
In this implementation the training phase is used to identify the limits of
the data (for which a very small subset may be provided). Once this is known
N decision trees are constructed each with M decisions (see
RandomDecisionTree). In the clustering phase each feature projected
is assigned a letter for each decision tree.
CLUSTER_HEADER| Constructor and Description |
|---|
IntRandomForest()
Makes a default random forest with 32 trees each with 32 decisions.
|
IntRandomForest(int nTrees,
int nDecisions)
Makes a random forest with nTrees each with nDecisions.
|
| Modifier and Type | Method and Description |
|---|---|
String |
asciiHeader() |
int |
assign(int[] data)
Uses the
assignWord(int[]) function to construct the word
representing this data point. |
int[] |
assign(int[][] data)
Assign data to a cluster.
|
IntFloatPair |
assignDistance(int[] data)
Assign a single point to a cluster.
|
void |
assignDistance(int[][] data,
int[] indices,
float[] distances)
Assign data to clusters.
|
org.openimaj.ml.clustering.rforest.IntRandomForest.Word[] |
assignLetters(int[][] data)
Push each data point provided to a set of letters, i.e.
|
org.openimaj.ml.clustering.rforest.IntRandomForest.Word |
assignWord(int[] data)
Push a single data point to a set of letters, return the letters as word.
|
byte[] |
binaryHeader() |
IntRandomForest |
cluster(DataSource<int[]> data)
Perform clustering with data from a data source.
|
IntRandomForest |
cluster(int[][] data)
Perform clustering on the given data.
|
HardAssigner<int[],?,?> |
defaultHardAssigner()
Get the default hard assigner for this clusterer.
|
boolean |
equals(Object r) |
int |
getNDecisions() |
int |
getNTrees() |
List<RandomDecisionTree> |
getTrees() |
int |
numClusters()
Get the number of clusters.
|
int |
numDimensions()
Get the data dimensionality
|
int[][] |
performClustering(int[][] data) |
void |
readASCII(Scanner br) |
void |
readBinary(DataInput dis) |
void |
setMinMax(int[] min,
int[] max)
The maximum and minimum values for the various dimentions against which
random decisions will be based.
|
void |
setRandomSeed(int random) |
int |
size()
The number of centroids or unique ids that can be generated.
|
void |
writeASCII(PrintWriter writer) |
void |
writeBinary(DataOutput o) |
public IntRandomForest()
public IntRandomForest(int nTrees, int nDecisions)
nTrees - number of treesnDecisions - number of decisions per treepublic void setMinMax(int[] min, int[] max)
min - max - public IntRandomForest cluster(int[][] data)
SpatialClusterercluster in interface SpatialClusterer<IntRandomForest,int[]>data - the data.public IntRandomForest cluster(DataSource<int[]> data)
SpatialClustererDataSource
could potentially be backed by disk rather in memory.cluster in interface SpatialClusterer<IntRandomForest,int[]>data - the data.public int numClusters()
SpatialClustersnumClusters in interface SpatialClusters<int[]>public int numDimensions()
SpatialClustersnumDimensions in interface Assigner<int[]>numDimensions in interface SpatialClusters<int[]>public int[] assign(int[][] data)
HardAssignerassign in interface HardAssigner<int[],float[],IntFloatPair>data - the data.public org.openimaj.ml.clustering.rforest.IntRandomForest.Word[] assignLetters(int[][] data)
data - public org.openimaj.ml.clustering.rforest.IntRandomForest.Word assignWord(int[] data)
data - to be projectedpublic int assign(int[] data)
assignWord(int[]) function to construct the word
representing this data point. If this exact word has been seen before
(i.e. these letters in this order) the same int is used. If not, a new
int is assigned for this word.assign in interface HardAssigner<int[],float[],IntFloatPair>data - a data point to be clustered to a wordpublic int getNTrees()
public int getNDecisions()
public List<RandomDecisionTree> getTrees()
public String asciiHeader()
asciiHeader in interface ReadableASCIIasciiHeader in interface WriteableASCIIpublic byte[] binaryHeader()
binaryHeader in interface ReadableBinarybinaryHeader in interface WriteableBinarypublic void readASCII(Scanner br) throws IOException
readASCII in interface ReadableASCIIIOExceptionpublic void readBinary(DataInput dis) throws IOException
readBinary in interface ReadableBinaryIOExceptionpublic void writeASCII(PrintWriter writer) throws IOException
writeASCII in interface WriteableASCIIIOExceptionpublic void writeBinary(DataOutput o) throws IOException
writeBinary in interface WriteableBinaryIOExceptionpublic void setRandomSeed(int random)
random - the seed of the java Random instance used by the
decision treespublic void assignDistance(int[][] data, int[] indices, float[] distances)
HardAssignerassignDistance in interface HardAssigner<int[],float[],IntFloatPair>data - the data.indices - the cluster index for each data point.distances - the distance to the closest cluster for each data point.public IntFloatPair assignDistance(int[] data)
HardAssignerassignDistance in interface HardAssigner<int[],float[],IntFloatPair>data - point to assign.public HardAssigner<int[],?,?> defaultHardAssigner()
SpatialClustersdefaultHardAssigner in interface SpatialClusters<int[]>public int size()
HardAssignersize in interface HardAssigner<int[],float[],IntFloatPair>public int[][] performClustering(int[][] data)
performClustering in interface Clusterer<int[][]>