InputType
- The type for the input object in the pair.OutputType
- The type for the output object in the pair.public class DefaultWeightedInputOutputPair<InputType,OutputType> extends DefaultInputOutputPair<InputType,OutputType> implements WeightedInputOutputPair<InputType,OutputType>
WeightedInputOutputPair
interface.
Stores pointers to the input and output plus the weight as a double.Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_WEIGHT
The default weight is 1.0.
|
Constructor and Description |
---|
DefaultWeightedInputOutputPair()
Creates a new
DefaultWeightedInputOutputPair with null as the
input and output and a default weight of 1.0. |
DefaultWeightedInputOutputPair(InputType input,
OutputType output,
double weight)
Creates a new
DefaultWeightedInputOutputPair with the given
input, output, and weight. |
DefaultWeightedInputOutputPair(Pair<? extends InputType,? extends OutputType> pair,
double weight)
Creates a new
DefaultWeightedInputOutputPair with the given
input and output from the given pair plus a weight. |
DefaultWeightedInputOutputPair(WeightedInputOutputPair<? extends InputType,? extends OutputType> other)
Creates a new
DefaultWeightedInputOutputPair that is a shallow
copy of the given WeightedInputOuptutPair . |
Modifier and Type | Method and Description |
---|---|
static <InputType,OutputType> |
create()
Convenience method to create a new, empty
DefaultWeightedInputOutputPair . |
static <InputType,OutputType> |
create(InputType input,
OutputType output,
double weight)
Convenience method to create a new
DefaultWeightedInputOutputPair . |
double |
getWeight()
Gets the weight of the object.
|
static <InputType,OutputType> |
mergeCollections(java.util.Collection<InputType> inputs,
java.util.Collection<OutputType> outputs,
java.util.Collection<? extends java.lang.Number> weights)
Takes two Collections of data and creates a single
ArrayList
|
void |
setWeight(double weight)
Sets the weight for the pair.
|
create, getInput, getOutput, labelCollection, mergeCollections, setInput, setOutput
getFirst, getSecond, toString
clone
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getInput, getOutput
public static final double DEFAULT_WEIGHT
public DefaultWeightedInputOutputPair()
DefaultWeightedInputOutputPair
with null as the
input and output and a default weight of 1.0.public DefaultWeightedInputOutputPair(InputType input, OutputType output, double weight)
DefaultWeightedInputOutputPair
with the given
input, output, and weight.input
- The input.output
- The output.weight
- The weight.public DefaultWeightedInputOutputPair(Pair<? extends InputType,? extends OutputType> pair, double weight)
DefaultWeightedInputOutputPair
with the given
input and output from the given pair plus a weight.pair
- The pair to provide the input and output values.weight
- The weight.public DefaultWeightedInputOutputPair(WeightedInputOutputPair<? extends InputType,? extends OutputType> other)
DefaultWeightedInputOutputPair
that is a shallow
copy of the given WeightedInputOuptutPair
.other
- The other weighted input-output pair to copy the values of.public double getWeight()
Weighted
public void setWeight(double weight)
weight
- Weighting term for the InputOutputPair.public static <InputType,OutputType> DefaultWeightedInputOutputPair<InputType,OutputType> create()
DefaultWeightedInputOutputPair
.InputType
- The type for the input object in the pair.OutputType
- The type for the output object in the pair.DefaultWeightedInputOutputPair
.public static <InputType,OutputType> DefaultWeightedInputOutputPair<InputType,OutputType> create(InputType input, OutputType output, double weight)
DefaultWeightedInputOutputPair
.InputType
- The type for the input object in the pair.OutputType
- The type for the output object in the pair.input
- The input.output
- The output.weight
- The weight.public static <InputType,OutputType> java.util.ArrayList<DefaultWeightedInputOutputPair<InputType,OutputType>> mergeCollections(java.util.Collection<InputType> inputs, java.util.Collection<OutputType> outputs, java.util.Collection<? extends java.lang.Number> weights)
InputType
- The type of the input.OutputType
- The type of the output.inputs
- Collection of the data to transform into the input of the
WeightedInputOutputPair, must have the same size as targetsoutputs
- Collection of the data to transform into the output of the
WeightedInputOutputPair, must have the same size as inputsweights
- Collection of weights, must have the same size as inputs/targets