org.nd4j.linalg.util.MathUtils Java Examples

The following examples show how to use org.nd4j.linalg.util.MathUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileSplit.java    From DataVec with Apache License 2.0 5 votes vote down vote up
@Override
public void reset() {
    if (randomize) {
        //Shuffle the iteration order
        MathUtils.shuffleArray(iterationOrder, random);
    }
}
 
Example #2
Source File: MapFileSequenceRecordReader.java    From DataVec with Apache License 2.0 5 votes vote down vote up
@Override
public void reset() {
    position = 0;
    if (order != null) {
        MathUtils.shuffleArray(order, rng);
    }
}
 
Example #3
Source File: MapFileRecordReader.java    From DataVec with Apache License 2.0 5 votes vote down vote up
@Override
public void reset() {
    position = 0;
    if (order != null) {
        MathUtils.shuffleArray(order, rng);
    }
}
 
Example #4
Source File: DataSet.java    From nd4j with Apache License 2.0 5 votes vote down vote up
@Override
public void roundToTheNearest(int roundTo) {
    for (int i = 0; i < getFeatures().length(); i++) {
        double curr = (double) getFeatures().getScalar(i).element();
        getFeatures().put(i, Nd4j.scalar(MathUtils.roundDouble(curr, roundTo)));
    }
}
 
Example #5
Source File: VasttextVocabCache.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public double tfidf(String word, double frequency) {
    return MathUtils.tfidf(MathUtils.tf((int) frequency), MathUtils.idf(numDocs, idf(word)));
}
 
Example #6
Source File: VasttextDictionary.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
public double tfidf(String word, double frequency) {
    return MathUtils.tfidf(MathUtils.tf((int) frequency), MathUtils.idf(numDocs, idf(word)));
}
 
Example #7
Source File: DefaultVocabCache.java    From DataVec with Apache License 2.0 4 votes vote down vote up
@Override
public double tfidf(String word, double frequency) {
    return MathUtils.tfidf(MathUtils.tf((int) frequency), MathUtils.idf(numDocs, idf(word)));
}