use of algorithms.isomorphism.chains.ChainLearning.ChainsIndex in project Smiles2Monomers by yoann-dufresne.
the class ChainLearningTests method generateGreedyTest.
/**/
@Test
public void generateGreedyTest() {
// Computing
ChainLearning learning = new ChainLearning(this.learningBase);
learning.setMarkovianSize(3);
learning.learn(this.families);
ChainsIndex chains = learning.getFinalChains();
// Verification
for (String idx : chains.keySet()) {
Chain chain = chains.get(idx);
if (!this.greedyPatterns.containsKey(idx) || !this.greedyPatterns.get(idx).equals(chain.getSerial()))
fail(idx + " not found");
/**/
}
Assert.assertTrue(chains.size() == 3);
}
use of algorithms.isomorphism.chains.ChainLearning.ChainsIndex in project Smiles2Monomers by yoann-dufresne.
the class ChainLearningTests method generateMarkov6Test.
/**/
@Test
public void generateMarkov6Test() {
// Computing
ChainLearning learning = new ChainLearning(this.learningBase);
learning.setMarkovianSize(6);
learning.learn(this.families);
ChainsIndex chains = learning.getFinalChains();
// Verification
for (String pattern : chains.keySet()) {
Chain chain = chains.get(pattern);
if (!this.markovPatterns.containsKey(pattern) || !this.markovPatterns.get(pattern).equals(chain.getSerial()))
fail(pattern + " not found");
/**/
}
Assert.assertTrue(chains.size() == 3);
}
use of algorithms.isomorphism.chains.ChainLearning.ChainsIndex 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