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);
}
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);
}
Aggregations