use of jgnash.bayes.BayesClassifier in project jgnash by ccavanaugh.
the class BayesImportClassifier method generateClassifier.
private static BayesClassifier<Account> generateClassifier(List<Transaction> transactions, final Account baseAccount) {
final BayesClassifier<Account> classifier = new BayesClassifier<>(baseAccount);
for (final Transaction t : transactions) {
final Set<Account> accountSet = t.getAccounts();
accountSet.remove(baseAccount);
for (final Account account : accountSet) {
if (!t.getPayee().isEmpty()) {
classifier.train(t.getPayee(), account);
}
if (!t.getMemo().isEmpty()) {
classifier.train(t.getMemo(), account);
}
}
}
return classifier;
}
Aggregations