public class GroupMeans
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
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 FormConstructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
GroupMeans |
clone() |
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
|
static int[] |
unique(int[] groups)
Get a unique list of items in the training group
|
public GroupMeans(Jama.Matrix data, int[] group)
data
- matrix of training datagroup
- group indexespublic 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 createpublic static int getGroupIndex(int[] uniqueGroups, int iD)
uniqueGroups
- list of unique groups (sorted)iD
- group ID to findpublic static int[] getGroupIndex(int[] uniqueGroups, int[] iD)
uniqueGroups
- sorted list of unique groupsiD
- list of group id's to find indexes ofpublic 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