/** * Copies the values from the given doubles into a Vector * @param values Values to copy * @return Vector with same dimension and values as "values" */ public VectorType copyValues( double... values ) { return this.copyArray( values ); }
/** * Copies the values from the given doubles into a Vector * @param values Values to copy * @return Vector with same dimension and values as "values" */ public VectorType copyValues( double... values ) { return this.copyArray( values ); }
/** * Copies the values from the given doubles into a Vector * @param values Values to copy * @return Vector with same dimension and values as "values" */ public VectorType copyValues( double... values ) { return this.copyArray( values ); }
/** * Creates a new instance of MovingAverageFilter * @param coefficients * Coefficients of the moving-average filter. Element 0 is applied to the * most-recent input, Element 1 is applied to the second-most-recent, * and so forth. */ public MovingAverageFilter( double ... coefficients ) { this( VectorFactory.getDefault().copyArray( coefficients ) ); }
/** * Creates a new instance of MovingAverageFilter * @param coefficients * Coefficients of the moving-average filter. Element 0 is applied to the * most-recent input, Element 1 is applied to the second-most-recent, * and so forth. */ public MovingAverageFilter( double ... coefficients ) { this( VectorFactory.getDefault().copyArray( coefficients ) ); }
/** * Creates a new instance of MovingAverageFilter * @param coefficients * Coefficients of the moving-average filter. Element 0 is applied to the * most-recent input, Element 1 is applied to the second-most-recent, * and so forth. */ public MovingAverageFilter( double ... coefficients ) { this( VectorFactory.getDefault().copyArray( coefficients ) ); }
/** * Creates a new instance of AutoRegressiveMovingAverageFilter * @param autoRegressiveCoefficients * Coefficients of the autoregressive filter. Element 0 is applied to the * most-recent output, Element 1 is applied to the second-most-recent, * and so forth. The dimensionality of the Vector is the order of the * filter. * @param movingAverageCoefficients * Coefficients of the moving-average filter. Element 0 is applied to the * most-recent input, Element 1 is applied to the second-most-recent, * and so forth. The dimensionality of the Vector is the order of the * filter. */ public AutoRegressiveMovingAverageFilter( double[] autoRegressiveCoefficients, double[] movingAverageCoefficients ) { this( VectorFactory.getDefault().copyArray( autoRegressiveCoefficients ), VectorFactory.getDefault().copyArray( movingAverageCoefficients ) ); }
@Override public Vector convertToVector() { return VectorFactory.getDefault().copyArray(this.getPriorWeights()); }
@Override public Vector convertToVector() { return VectorFactory.getDefault().copyArray(this.getPriorWeights()); }
@Override public Vector convertToVector() { return VectorFactory.getDefault().copyArray(this.getPriorWeights()); }
@Override public T predict(double[] data) { return model.evaluate(VectorFactory.getDefault().copyArray(data)); }
private Vector convert(FeatureVector feature) { return VectorFactory.getDenseDefault().copyArray(feature.asDoubleVector()); } }
@Override public Vector evaluate( Vector input ) { return VectorFactory.getDefault().copyArray( this.getGaussianMixture().computeRandomVariableProbabilities( input ) ); }
@Override public Vector evaluate( Vector input ) { return VectorFactory.getDefault().copyArray( this.getGaussianMixture().computeRandomVariableProbabilities( input ) ); }
@Override public Vector evaluate( Vector input ) { return VectorFactory.getDefault().copyArray( this.getGaussianMixture().computeRandomVariableProbabilities( input ) ); }
@Override public boolean estimate(List<? extends IndependentPair<double[], T>> data) { final List<InputOutputPair<Vector, T>> cfdata = new ArrayList<InputOutputPair<Vector, T>>(); for (final IndependentPair<double[], T> d : data) { final InputOutputPair<Vector, T> iop = new DefaultInputOutputPair<Vector, T>(VectorFactory.getDefault() .copyArray(d.firstObject()), d.secondObject()); cfdata.add(iop); } model = learner.learn(cfdata); return true; }
@Override public List<ScoredAnnotation<ANNOTATION>> annotate(OBJECT object) { final FeatureVector feature = extractor.extractFeature(object); final Vector vec = VectorFactory.getDefault().copyArray(feature.asDoubleVector()); return mode.getAnnotations(categorizer, vec); } }
private static Collection<? extends InputOutputPair<? extends gov.sandia.cognition.math.matrix.Vector, Boolean>> createData() { final List<InputOutputPair<gov.sandia.cognition.math.matrix.Vector, Boolean>> ret = new ArrayList<InputOutputPair<gov.sandia.cognition.math.matrix.Vector, Boolean>>(); final LinearPerceptronDataGenerator dg = dataGen(); for (int i = 0; i < TOTAL_DATA_ITEMS; i++) { final IndependentPair<double[], PerceptronClass> pointClass = dg.generate(); final double[] pc = pointClass.firstObject(); final PerceptronClass pcc = pointClass.secondObject(); final boolean bool = pcc.equals(PerceptronClass.TRUE); final gov.sandia.cognition.math.matrix.Vector vec = VectorFactory.getDenseDefault().copyArray(pc); final InputOutputPair<gov.sandia.cognition.math.matrix.Vector, Boolean> item = DefaultInputOutputPair.create( vec, bool); ret.add(item); } System.out.println("Data created"); return ret; }
private static Collection<? extends InputOutputPair<? extends gov.sandia.cognition.math.matrix.Vector, Boolean>> createData() { final List<InputOutputPair<gov.sandia.cognition.math.matrix.Vector, Boolean>> ret = new ArrayList<InputOutputPair<gov.sandia.cognition.math.matrix.Vector, Boolean>>(); final LinearPerceptronDataGenerator dg = dataGen(); for (int i = 0; i < TOTAL_DATA_ITEMS; i++) { final IndependentPair<double[], PerceptronClass> pointClass = dg.generate(); final double[] pc = pointClass.firstObject(); final PerceptronClass pcc = pointClass.secondObject(); final boolean bool = pcc.equals(PerceptronClass.TRUE); final gov.sandia.cognition.math.matrix.Vector vec = VectorFactory.getDenseDefault().copyArray(pc); final InputOutputPair<gov.sandia.cognition.math.matrix.Vector, Boolean> item = DefaultInputOutputPair.create( vec, bool); ret.add(item); } System.out.println("Data created"); return ret; }
@Override public void train(Annotated<OBJECT, ANNOTATION> annotated) { final FeatureVector feature = extractor.extractFeature(annotated.getObject()); final Vector vec = VectorFactory.getDefault().copyArray(feature.asDoubleVector()); for (final ANNOTATION ann : annotated.getAnnotations()) { learner.update(categorizer, new DefaultInputOutputPair<Vector, ANNOTATION>(vec, ann)); } }