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; }
@Override public void transformNonZerosEquals( final UnivariateScalarFunction function) { // Default implementation uses an iterator. However, specialized // sub-classes can add optimizations. for (final VectorEntry entry : this) { final double value = entry.getValue(); if (value != 0.0) { entry.setValue(function.evaluate(value)); } } }
@Override public void transformNonZerosEquals( final UnivariateScalarFunction function) { // Default implementation uses an iterator. However, specialized // sub-classes can add optimizations. for (final VectorEntry entry : this) { final double value = entry.getValue(); if (value != 0.0) { entry.setValue(function.evaluate(value)); } } }
@Override public void transformNonZerosEquals( final UnivariateScalarFunction function) { // Default implementation uses an iterator. However, specialized // sub-classes can add optimizations. for (final VectorEntry entry : this) { final double value = entry.getValue(); if (value != 0.0) { entry.setValue(function.evaluate(value)); } } }
@Override public void dotTimesEquals( final Vector other) { for (final VectorEntry entry : this) { entry.setValue( entry.getValue() * other.getElement(entry.getIndex()) ); } }
@Override public void transformNonZerosEquals( final IndexValueTransform function) { // Default implementation uses an iterator. However, specialized // sub-classes can add optimizations. for (final VectorEntry entry : this) { final double value = entry.getValue(); if (value != 0.0) { entry.setValue(function.transform(entry.getIndex(), value)); } } }
@Override public void dotTimesEquals( final Vector other) { for (final VectorEntry entry : this) { entry.setValue( entry.getValue() * other.getElement(entry.getIndex()) ); } }
@Override public void dotTimesEquals( final Vector other) { for (final VectorEntry entry : this) { entry.setValue( entry.getValue() * other.getElement(entry.getIndex()) ); } }
@Override public void transformNonZerosEquals( final IndexValueTransform function) { // Default implementation uses an iterator. However, specialized // sub-classes can add optimizations. for (final VectorEntry entry : this) { final double value = entry.getValue(); if (value != 0.0) { entry.setValue(function.transform(entry.getIndex(), value)); } } }
@Override public void transformNonZerosEquals( final IndexValueTransform function) { // Default implementation uses an iterator. However, specialized // sub-classes can add optimizations. for (final VectorEntry entry : this) { final double value = entry.getValue(); if (value != 0.0) { entry.setValue(function.transform(entry.getIndex(), value)); } } }
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; }
@Override public void dotTimesEquals( final Vector other) { // This is a generic implementation to support interoperability. // Sub-classes should make custom ones for performance. this.assertSameDimensionality(other); for (final VectorEntry entry : this) { entry.setValue(entry.getValue() * other.get(entry.getIndex())); } }
@Override public void dotTimesEquals( final Vector other) { // This is a generic implementation to support interoperability. // Sub-classes should make custom ones for performance. this.assertSameDimensionality(other); for (final VectorEntry entry : this) { entry.setValue(entry.getValue() * other.get(entry.getIndex())); } }
@Override public void dotTimesEquals( final Vector other) { // This is a generic implementation to support interoperability. // Sub-classes should make custom ones for performance. this.assertSameDimensionality(other); for (final VectorEntry entry : this) { entry.setValue(entry.getValue() * other.get(entry.getIndex())); } }
entry.setValue(idf);