Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

ldltools suggested change #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/learnwts/discriminativelearner.h
Original file line number Diff line number Diff line change
Expand Up @@ -1508,10 +1508,12 @@ class DiscriminativeLearner

for (int i = 0; i < clause->getNumPredicates(); i++)
{
const char* predName =
clause->getPredicate(i)->getTemplate()->getName();
if (nonEvidPredNames.contains(predName))
nonEvidPreds++;
if (clause->getPredicate(i)) {
const char* predName =
clause->getPredicate(i)->getTemplate()->getName();
if (nonEvidPredNames.contains(predName))
nonEvidPreds++;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/logic/clause.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class Clause

// Caller should not delete returned Predicate*.
Predicate* getPredicate(const int& idx) const {
if (idx > 0 && idx < getNumPredicates()){
if (idx >= 0 && idx < getNumPredicates()){
return (*predicates_)[idx];
}
else return NULL;
Expand Down
8 changes: 8 additions & 0 deletions tutorial/tutorial-mlns/basics/multinomial-biased.mln
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ Outcome(throw, face!)

// Learn weight for each face
Outcome(t, +f)


// 1 Outcome(t, 1)
// 1 Outcome(t, 2)
// 1 Outcome(t, 3)
// 1 Outcome(t, 4)
// 1 Outcome(t, 5)
// 1 Outcome(t, 6)