|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectclassifier.GroupMeans
public class GroupMeans
Many classification functions need the mean values of each parameter from a group of training data.
This class provides a set of functions which will get the means by group, and also return larger matrixes of the mean values repeated by a grouping index or repeated for a single group which can be used in classifier training and classifier application
Matrix,
Serialized Form| Field Summary | |
|---|---|
private Jama.Matrix |
groupMeans
|
private int[] |
groupSize
|
private static long |
serialVersionUID
|
private int[] |
uniqueGroups
|
| Constructor Summary | |
|---|---|
GroupMeans(Jama.Matrix data,
int[] group)
Constructor works out the number of unique groups in group and then constructs a smaller matrix of means of each parameter by group. |
|
| Method Summary | |
|---|---|
GroupMeans |
clone()
|
private int |
getGroupIndex(int iD)
The group parameter passed to the constructor can contain grouping values which may not start at 0 and may not be continuous. |
private int[] |
getGroupIndex(int[] iD)
As getGroupIndex(iD) but for arrays. |
static int |
getGroupIndex(int[] uniqueGroups,
int iD)
Gets the index of a group id (these will often be the same !) |
static int[] |
getGroupIndex(int[] uniqueGroups,
int[] iD)
Gets the index of a group id (these will often be the same !) |
Jama.Matrix |
getGroupMeans()
|
Jama.Matrix |
getGroupMeans(int[] groups)
Create a matrix of means, repeated multiple times (e.g. |
Jama.Matrix |
getGroupMeans(int group,
int n)
Create a matrix of means for a single group. |
int[] |
getGroupSize()
|
int |
getNumGroups()
|
int[] |
getUniqueGroups()
Get list of unique groups in the data |
private void |
makeGroupMeans(Jama.Matrix data,
int[] group)
Takes the raw training data, works out what gorups are present in group and works out the means for each group. |
static int[] |
unique(int[] groups)
Get a unique list of items in the training group |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private Jama.Matrix groupMeans
private int[] uniqueGroups
private int[] groupSize
| Constructor Detail |
|---|
public GroupMeans(Jama.Matrix data,
int[] group)
data - matrix of training datagroup - group indexes| Method Detail |
|---|
public Jama.Matrix getGroupMeans()
public int[] getUniqueGroups()
public int[] getGroupSize()
public int getNumGroups()
public Jama.Matrix getGroupMeans(int[] groups)
groups - grouping to apply. Must contain only the
same entries as in the group parameter passed to the constructor.
public Jama.Matrix getGroupMeans(int group,
int n)
group - index of groupn - number of rows of data to create
private void makeGroupMeans(Jama.Matrix data,
int[] group)
data - training data Matrixgroup - grouping variableprivate int getGroupIndex(int iD)
Therefore, when constructing new means matrixes, it is necessary to use the index of each group parameter to get the right values out of the groupMeans matrix.
iD - group parameter
public static int getGroupIndex(int[] uniqueGroups,
int iD)
uniqueGroups - list of unique groups (sorted)iD - group ID to find
private int[] getGroupIndex(int[] iD)
The group parameter passed to the constructor can contain grouping values which may not start at 0 and may not be continuous.
Therefore, when constructing new means matrixes, it is necessary to use the index of each group parameter to get the right values out of the groupMeans matrix.
iD - group parameter
public static int[] getGroupIndex(int[] uniqueGroups,
int[] iD)
uniqueGroups - sorted list of unique groupsiD - list of group id's to find indexes of
public static int[] unique(int[] groups)
e.g. if group was {1, 9, 3, 1, 4, 9, 4} then the return value would be {1, 3, 4, 9}
groups - group data which will contain many instances of few different values.
public GroupMeans clone()
clone in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||