/** * Creates a new {@code OnlinePassiveAggressivePerceptron}. */ public OnlinePassiveAggressivePerceptron() { this(VectorFactory.getDefault()); }
/** * Creates a new {@code AbstractSoftMargin} with the given * aggressiveness. * * @param aggressiveness * The aggressiveness. Must be positive. */ public AbstractSoftMargin( final double aggressiveness) { this(aggressiveness, VectorFactory.getDefault()); }
/** * Creates a new {@code AggressiveRelaxedOnlineMaximumMarginAlgorithm}. */ public AggressiveRelaxedOnlineMaximumMarginAlgorithm() { this(VectorFactory.getDefault()); }
/** * Creates a new {@code DefaultVectorFactoryContainer}. */ public DefaultVectorFactoryContainer() { this(VectorFactory.getDefault()); }
/** * 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 ) ); }
@Override public Vector convertToVector() { return VectorFactory.getDefault().copyArray(this.getPriorWeights()); }
/** * Converts the index to select into a vector (of length 1). * * @return * A 1-dimensional vector containing the index. */ @Override public Vector convertToVector() { return VectorFactory.getDefault().createVector(1, this.getIndex()); }
@Override public Vector convertToVector() { return VectorFactory.getDefault().copyValues(this.getThreshold()); }
/** * Returns the value of the exponent * @return * Exponent of this polynomial */ @Override public Vector convertToVector() { return VectorFactory.getDefault().copyValues( this.getExponent() ); }
@Override public Vector convertToVector() { return VectorFactory.getDefault().copyValues( this.getPoint() ); }
/** * Creates a new instance of MultivariateDiscriminantWithBias. * * @param discriminant internal matrix to premultiply input vectors by. */ public MultivariateDiscriminantWithBias( final Matrix discriminant ) { this( discriminant, VectorFactory.getDefault().createVector(discriminant.getNumRows()) ); }
/** * Returns the parameter of the chi-square PDF * @return * 1-dimensional Vector containing the degrees of freedom */ @Override public Vector convertToVector() { return VectorFactory.getDefault().copyValues( this.getDegreesOfFreedom() ); }
@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; }
/** * Converts this function into its parameters, which consists of the * threshold value * @return one-element Vector consisting of the threshold value */ public Vector convertToVector() { Vector parameters = VectorFactory.getDefault().createVector(1); parameters.setElement(0, this.getThreshold()); return parameters; }
@Override public Vector convertToVector() { return VectorFactory.getDefault().copyValues( this.getN(), this.getP() ); }
/** * Gets the parameters of the distribution * @return * 2-dimensional Vector with (shape scale) */ @Override public Vector convertToVector() { return VectorFactory.getDefault().copyValues( this.getShape(), this.getScale() ); }
/** * Gets the parameters of the distribution * @return * 2-dimensional Vector with [alpha beta] */ @Override public Vector convertToVector() { return VectorFactory.getDefault().copyValues( this.getAlpha(), this.getBeta() ); }
@Override public Vector convertToVector() { return VectorFactory.getDefault().copyValues( this.getMean(), this.getScale() ); }
@Override public boolean estimate(List<? extends IndependentPair<Double, T>> data) { final VectorNaiveBayesCategorizer.BatchGaussianLearner<T> learner = new VectorNaiveBayesCategorizer.BatchGaussianLearner<T>(); 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() .createVector1D(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); } }