Search in sources :

Example 1 with FrequencesIndex

use of algorithms.isomorphism.chains.ChainLearning.FrequencesIndex in project Smiles2Monomers by yoann-dufresne.

the class ChainLearningTests method generateSize1Test.

@Test
public void generateSize1Test() {
    // Computing
    ChainLearning learning = new ChainLearning(this.learningBase);
    learning.setMarkovianSize(1);
    learning.learn(this.families);
    FrequencesIndex frequences = learning.getFrequence();
    // Verification
    for (String pattern : frequences.keySet()) {
        if (!this.size1Frequencies.containsKey(pattern) || this.size1Frequencies.get(pattern) != frequences.get(pattern))
            fail(pattern + " : " + frequences.get(pattern));
    }
    Assert.assertTrue(frequences.size() == 6);
}
Also used : FrequencesIndex(algorithms.isomorphism.chains.ChainLearning.FrequencesIndex) ChainLearning(algorithms.isomorphism.chains.ChainLearning) Test(org.junit.Test)

Example 2 with FrequencesIndex

use of algorithms.isomorphism.chains.ChainLearning.FrequencesIndex in project Smiles2Monomers by yoann-dufresne.

the class ChainLearningTests method generateSize3Test.

@Test
public void generateSize3Test() {
    // Computing
    ChainLearning learning = new ChainLearning(this.learningBase);
    learning.setMarkovianSize(3);
    learning.learn(this.families);
    FrequencesIndex frequences = learning.getFrequence();
    ChainsIndex chains = learning.getAllChains();
    // Verification
    for (String pattern : chains.keySet()) {
        Chain chain = chains.get(pattern);
        if (chain.getSize() != 3)
            continue;
        if (!this.size3Frequencies.containsKey(pattern) || this.size3Frequencies.get(pattern) != frequences.get(pattern) || !this.size3Blocs.get(pattern).equals(chain.getSerial())) {
            System.out.println(pattern);
            System.out.println(chain.getSerial());
            fail(pattern + " : " + frequences.get(pattern) + " -> " + this.size3Blocs.get(pattern));
        }
    }
    Assert.assertTrue(frequences.size() == 19);
}
Also used : Chain(algorithms.isomorphism.chains.Chain) FrequencesIndex(algorithms.isomorphism.chains.ChainLearning.FrequencesIndex) ChainLearning(algorithms.isomorphism.chains.ChainLearning) ChainsIndex(algorithms.isomorphism.chains.ChainLearning.ChainsIndex) Test(org.junit.Test)

Aggregations

ChainLearning (algorithms.isomorphism.chains.ChainLearning)2 FrequencesIndex (algorithms.isomorphism.chains.ChainLearning.FrequencesIndex)2 Test (org.junit.Test)2 Chain (algorithms.isomorphism.chains.Chain)1 ChainsIndex (algorithms.isomorphism.chains.ChainLearning.ChainsIndex)1