@Override public Vector evaluate( final Vector input ) { return this.discriminant.times( input ); }
/** * Returns m times input. * * @param input The vector to multiply by m. * @return m times input. */ @Override public Vector evaluate(Vector input) { return m.times(input); }
@Override public Vector evaluate( final Vector input ) { return this.discriminant.times( input ); }
/** * @param a * @param b * @return checks for the fastest way to do this dot product */ public static Matrix fastdot(Matrix a, Matrix b) { if (a instanceof SparseRowMatrix && b instanceof SparseColumnMatrix) { return fastsparsedot((SparseRowMatrix) a, (SparseColumnMatrix) b); } return a.times(b); }
/** * Computes the mean of the Gaussian, but involves a matrix * inversion and multiplication, so it's expensive. * @return * Mean of the Gaussian. */ public Vector getMean() { return this.covarianceInverse.inverse().times( this.z ); }
/** * Computes the mean of the Gaussian, but involves a matrix * inversion and multiplication, so it's expensive. * @return * Mean of the Gaussian. */ public Vector getMean() { return this.covarianceInverse.inverse().times( this.z ); }
/** * Computes the mean of the Gaussian, but involves a matrix * inversion and multiplication, so it's expensive. * @return * Mean of the Gaussian. */ public Vector getMean() { return this.covarianceInverse.inverse().times( this.z ); }
/** * Computes the mean of the Gaussian, but involves a matrix * inversion and multiplication, so it's expensive. * @return * Mean of the Gaussian. */ public Vector getMean() { return this.covarianceInverse.inverse().times( this.z ); }
/** * Computes the mean of the Gaussian, but involves a matrix * inversion and multiplication, so it's expensive. * @return * Mean of the Gaussian. */ public Vector getMean() { return this.covarianceInverse.inverse().times( this.z ); }
@Override public Matrix predict(Matrix x) { final Matrix mult = this.u.transpose().times(x.transpose()).times(this.w); if(this.biasMode)mult.plusEquals(this.bias); final Vector ydiag = CFMatrixUtils.diag(mult); final Matrix createIdentity = SparseMatrixFactoryMTJ.INSTANCE.createIdentity(1, ydiag.getDimensionality()); createIdentity.setRow(0, ydiag); return createIdentity; } }
public Matrix predict(double[] x) { final Matrix X = prepareMatrix(x); final Matrix hiddenTimes = weightsL1.transpose().times(X); final Matrix hiddenVal = prepareMatrix(gMat.apply(hiddenTimes).getColumn(0)); final Matrix finalTimes = weightsL2.transpose().times(hiddenVal); final Matrix finalVal = gMat.apply(finalTimes); return finalVal; }
public Matrix predict(double[] x) { final Matrix X = prepareMatrix(x); final Matrix hiddenTimes = weightsL1.transpose().times(X); final Matrix hiddenVal = prepareMatrix(gMat.apply(hiddenTimes).getColumn(0)); final Matrix finalTimes = weightsL2.transpose().times(hiddenVal); final Matrix finalVal = gMat.apply(finalTimes); return finalVal; }
@Override public double eval(Matrix W) { Matrix v = (X.times(W).minus(Y)); if(this.bias!=null) v.plus(this.bias); v.dotTimesEquals(v); return v.sumOfRows().sum(); }
public Matrix differentiate( Vector input ) { Matrix dudx = this.getDiscriminant().differentiate( input ); Vector u = this.getDiscriminant().evaluate( input ); Matrix dydu = this.getSquashingFunction().differentiate( u ); return dydu.times( dudx ); }
public Matrix computeParameterGradient( Vector input ) { Matrix gradient = this.getDiscriminant().computeParameterGradient( input ); Vector y = this.getDiscriminant().evaluate( input ); Matrix derivative = this.getSquashingFunction().differentiate( y ); return derivative.times( gradient ); }
public Matrix differentiate( Vector input ) { Matrix dudx = this.getDiscriminant().differentiate( input ); Vector u = this.getDiscriminant().evaluate( input ); Matrix dydu = this.getSquashingFunction().differentiate( u ); return dydu.times( dudx ); }
public Matrix computeParameterGradient( Vector input ) { Matrix gradient = this.getDiscriminant().computeParameterGradient( input ); Vector y = this.getDiscriminant().evaluate( input ); Matrix derivative = this.getSquashingFunction().differentiate( y ); return derivative.times( gradient ); }
public Matrix differentiate( Vector input ) { Matrix dudx = this.getDiscriminant().differentiate( input ); Vector u = this.getDiscriminant().evaluate( input ); Matrix dydu = this.getSquashingFunction().differentiate( u ); return dydu.times( dudx ); }