public Vector computeLocalWeights( final Vector counts) { // Since the counts are positive, the 1-norm of them is their sum. final Vector result = this.vectorFactory.copyVector(counts); final double countSum = counts.norm1(); if (countSum != 0.0) { result.scaleEquals(1.0 / countSum); } return result; }
public Vector computeLocalWeights( final Vector counts) { // Since the counts are positive, the 1-norm of them is their sum. final Vector result = this.vectorFactory.copyVector(counts); final double countSum = counts.norm1(); if (countSum != 0.0) { result.scaleEquals(1.0 / countSum); } return result; }
public Vector computeLocalWeights( final Vector counts) { // Since the counts are positive, the 1-norm of them is their sum. final Vector result = this.vectorFactory.copyVector(counts); final double countSum = counts.norm1(); if (countSum != 0.0) { result.scaleEquals(1.0 / countSum); } return result; }
public Vector computeLocalWeights( final Vector counts) { // Create the vector to store the result. final Vector result = this.getVectorFactory().copyVector(counts); // Compute the local weight, which just turns the vector into a binary // form. for (VectorEntry entry : result) { final double value = entry.getValue(); if (value != 0.0) { entry.setValue(1.0); } } return result; }
public Vector computeLocalWeights( final Vector counts) { // Create the vector to store the result. final Vector result = this.getVectorFactory().copyVector(counts); // Compute the local weight, which just turns the vector into a binary // form. for (VectorEntry entry : result) { final double value = entry.getValue(); if (value != 0.0) { entry.setValue(1.0); } } return result; }
public Vector computeLocalWeights( final Vector counts) { // Create the vector to store the result. final Vector result = this.getVectorFactory().copyVector(counts); // Compute the local weight, which just turns the vector into a binary // form. for (VectorEntry entry : result) { final double value = entry.getValue(); if (value != 0.0) { entry.setValue(1.0); } } return result; }
public Vector computeLocalWeights( final Vector counts) { // Create the vector to hold the result. final Vector result = this.getVectorFactory().copyVector(counts); // Compute the local weight, which is log(1 + count) for each term. for (VectorEntry entry : result) { final double value = entry.getValue(); if (value > 0.0) { entry.setValue(Math.log(1.0 + value)); } else if (value != 0.0) { entry.setValue(0.0); } } return result; }
public Vector computeLocalWeights( final Vector counts) { // Create the vector to hold the result. final Vector result = this.getVectorFactory().copyVector(counts); // Compute the local weight, which is log(1 + count) for each term. for (VectorEntry entry : result) { final double value = entry.getValue(); if (value > 0.0) { entry.setValue(Math.log(1.0 + value)); } else if (value != 0.0) { entry.setValue(0.0); } } return result; }
public Vector computeLocalWeights( final Vector counts) { // Create the vector to hold the result. final Vector result = this.getVectorFactory().copyVector(counts); // Compute the local weight, which is log(1 + count) for each term. for (VectorEntry entry : result) { final double value = entry.getValue(); if (value > 0.0) { entry.setValue(Math.log(1.0 + value)); } else if (value != 0.0) { entry.setValue(0.0); } } return result; }
this.getVectorFactory().copyVector(this.termDocumentFrequencies);
this.getVectorFactory().copyVector(this.termDocumentFrequencies);
this.getVectorFactory().copyVector(this.termDocumentFrequencies);
@Override protected void initialize( final LinearBinaryCategorizer target, final Vector input, final boolean actualCategory) { final double norm = input.norm2(); if (norm != 0.0) { final Vector weights = this.getVectorFactory().copyVector(input); final double actual = actualCategory ? +1.0 : -1.0; weights.scaleEquals(actual / input.norm2()); target.setWeights(weights); } }
@Override protected void initialize( final LinearBinaryCategorizer target, final Vector input, final boolean actualCategory) { final double norm = input.norm2(); if (norm != 0.0) { final Vector weights = this.getVectorFactory().copyVector(input); final double actual = actualCategory ? +1.0 : -1.0; weights.scaleEquals(actual / input.norm2()); target.setWeights(weights); } }
@Override protected void initialize( final LinearBinaryCategorizer target, final Vector input, final boolean actualCategory) { final double norm = input.norm2(); if (norm != 0.0) { final Vector weights = this.getVectorFactory().copyVector(input); final double actual = actualCategory ? +1.0 : -1.0; weights.scaleEquals(actual / input.norm2()); target.setWeights(weights); } }
weights = this.getVectorFactory().copyVector(input); weights.scaleEquals(actual / inputNorm); target.setWeights(weights);
weights = this.getVectorFactory().copyVector(input); weights.scaleEquals(actual / inputNorm); target.setWeights(weights);
weights = this.getVectorFactory().copyVector(input); weights.scaleEquals(actual / inputNorm); target.setWeights(weights);
weights = this.getVectorFactory().copyVector(input); for (int i = 0; i < dimensionality; i++)
weights = this.getVectorFactory().copyVector(input); weights.scaleEquals(actual / inputNorm); target.setWeights(weights);