/** * Bring each element to the power d * * @param degree * @param d * @return the input */ public static <T extends Vector> T powInplace(T degree, double d) { for (final VectorEntry ent : degree) { degree.setElement(ent.getIndex(), Math.pow(ent.getValue(), d)); } return degree; }
/** * Sets the entry value to the first underlying vector. * * @param value Entry value to the first underlying vector. */ public void setFirstValue( double value) { this.getFirstVector().setElement(this.getIndex(), value); }
/** * Sets the entry value for the second underlying vector. * * @param value Entry value for the second underlying vector. */ public void setSecondValue( double value) { this.getSecondVector().setElement(this.getIndex(), value); } }
@Override public Vector convertToVector() { final int dim = this.getInputDimensionality() + 1; Vector p = VectorFactory.getDefault().createVector(dim); for( int i = 0; i < dim-1; i++ ) { p.setElement(i, this.weightVector.getElement(i) ); } p.setElement(dim-1, this.bias); return p; }
/** * Sets the entry value for the second underlying vector. * * @param value Entry value for the second underlying vector. */ public void setSecondValue( double value) { this.getSecondVector().setElement(this.getIndex(), value); } }
@Override public Vector convertToVector() { final int dim = this.getInputDimensionality() + 1; Vector p = VectorFactory.getDefault().createVector(dim); for( int i = 0; i < dim-1; i++ ) { p.setElement(i, this.weightVector.getElement(i) ); } p.setElement(dim-1, this.bias); return p; }
/** * Sets the entry value to the first underlying vector. * * @param value Entry value to the first underlying vector. */ public void setFirstValue( double value) { this.getFirstVector().setElement(this.getIndex(), value); }
/** * Sets the entry value to the first underlying vector. * * @param value Entry value to the first underlying vector. */ public void setFirstValue( double value) { this.getFirstVector().setElement(this.getIndex(), value); }
/** * Sets the entry value for the second underlying vector. * * @param value Entry value for the second underlying vector. */ public void setSecondValue( double value) { this.getSecondVector().setElement(this.getIndex(), value); } }
@Override public Vector convertToVector() { final int dim = this.getInputDimensionality() + 1; Vector p = VectorFactory.getDefault().createVector(dim); for( int i = 0; i < dim-1; i++ ) { p.setElement(i, this.weightVector.getElement(i) ); } p.setElement(dim-1, this.bias); return p; }
/** * 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; }
/** * 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; }
/** * 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; }
public Vector getRow( int rowIndex ) { int N = this.getDimensionality(); Vector row = SparseVectorFactoryMTJ.getDefault().createVector( N ); row.setElement( rowIndex, this.getElement( rowIndex, rowIndex ) ); return row; }
public Vector getColumn( int columnIndex ) { int M = this.getDimensionality(); Vector column = SparseVectorFactoryMTJ.getDefault().createVector( M ); column.setElement( columnIndex, this.getElement( columnIndex, columnIndex ) ); return column; }
public Vector getColumn( int columnIndex ) { int M = this.getDimensionality(); Vector column = SparseVectorFactoryMTJ.getDefault().createVector( M ); column.setElement( columnIndex, this.getElement( columnIndex, columnIndex ) ); return column; }
public Vector getRow( int rowIndex ) { int N = this.getDimensionality(); Vector row = SparseVectorFactoryMTJ.getDefault().createVector( N ); row.setElement( rowIndex, this.getElement( rowIndex, rowIndex ) ); return row; }
public Vector getColumn( int columnIndex ) { int M = this.getDimensionality(); Vector column = SparseVectorFactoryMTJ.getDefault().createVector( M ); column.setElement( columnIndex, this.getElement( columnIndex, columnIndex ) ); return column; }
public Vector getRow( int rowIndex ) { int N = this.getDimensionality(); Vector row = SparseVectorFactoryMTJ.getDefault().createVector( N ); row.setElement( rowIndex, this.getElement( rowIndex, rowIndex ) ); return row; }
public Vector evaluate( InputType input ) { Vector output = VectorFactory.getDefault().createVector( this.getOutputDimensionality() ); int i = 0; for (Evaluator<? super InputType, Double> f : this.getBasisFunctions()) { output.setElement( i, f.evaluate( input ) ); i++; } return output; }