public class Patterns
extends java.lang.Object
| Constructor and Description |
|---|
Patterns() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<java.lang.Double> |
encode(int label,
int n,
java.util.List<java.lang.Double> target)
Encode a class value into a 1-of-n encoding, i.e., the classical encoding of an output layer for classification.
|
static int |
getMaxIndex(java.util.List<java.util.List<java.lang.Double>> patterns,
int index)
Returns the index of the maximal value in a pattern.
|
static PatternSet |
getSubSet(PatternSet set,
int first,
int last)
Returns a subset of the given pattern set.
|
static void |
join(PatternSet a,
PatternSet b)
Joins a data set to another data set.
|
static void |
mapInputsToInterval(PatternSet set,
double low,
double high,
double min,
double max)
Maps all input values to the given interval.
|
static void |
mapTargetsToInterval(PatternSet set,
double low,
double high,
double min,
double max)
Maps all target values to the given interval.
|
static void |
mapToInterval(PatternSet set,
double low,
double high,
double min,
double max)
Maps all input and target values to the given interval.
|
static void |
multiply(PatternSet set,
int mult)
Multiplies the input vectors in a pattern set such that the input vector has 'mult' times the size.
|
static void |
normalizeInputs(PatternSet set)
Normalizes the input patterns using the euclidean norm, so all input vectors are changed to unit vectors.
|
static void |
shuffle(PatternSet set,
int n)
Reorders the first n patterns in this set randomly.
|
static void |
swap(PatternSet set,
int pos1,
int pos2)
Swaps the two patterns at position pos1 and pos2 of the given set including names, inputs, targets, and outputs.
|
public static void join(PatternSet a, PatternSet b)
a - a pattern setb - another pattern setpublic static PatternSet getSubSet(PatternSet set, int first, int last)
set - a pattern setfirst - the first pattern (included in the subset)last - the last pattern (excluded from the subset)public static void shuffle(PatternSet set, int n)
set - a pattern setn - the number of patterns to be shuffledpublic static void swap(PatternSet set, int pos1, int pos2)
set - a pattern setpos1 - the first positionpos2 - the second positionpublic static void normalizeInputs(PatternSet set)
set - a pattern setpublic static void mapToInterval(PatternSet set, double low, double high, double min, double max)
set - a pattern setlow - the lower interval boundaryhigh - the higher interval boundarymin - the minimal feature valuemax - the maximal feature valuepublic static void mapInputsToInterval(PatternSet set, double low, double high, double min, double max)
set - a pattern setlow - the lower interval boundaryhigh - the higher interval boundarymin - the minimal feature valuemax - the maximal feature valuepublic static void mapTargetsToInterval(PatternSet set, double low, double high, double min, double max)
set - a pattern setlow - the lower interval boundaryhigh - the higher interval boundarymin - the minimal feature valuemax - the maximal feature valuepublic static java.util.List<java.lang.Double> encode(int label,
int n,
java.util.List<java.lang.Double> target)
label - the class labeln - the number of classestarget - the target vector (if null, a new one is created)public static void multiply(PatternSet set, int mult)
set - a pattern setmult - the factor, e.g., 2 doubles the input vectorpublic static int getMaxIndex(java.util.List<java.util.List<java.lang.Double>> patterns,
int index)
patterns - a set of patternsindex - index of pattern