Skip to content

Commit

Permalink
Merge branch '070924-srvasude-pre-commit-config' of https://github.co…
Browse files Browse the repository at this point in the history
…m/probcomp/hierarchical-irm into 070924-srvasude-pre-commit-config
  • Loading branch information
srvasude committed Jul 9, 2024
2 parents d454c61 + 6207158 commit 0a9c8ca
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cxx/distributions/crp_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(test_simple) {
BOOST_TEST(crp.logp(1) == log(2. / (crp.alpha + crp.N)), tt::tolerance(1e-6));
BOOST_TEST(crp.logp(0) == log(1. / (crp.alpha + crp.N)), tt::tolerance(1e-6));
BOOST_TEST(crp.logp(3) == log(3. / (crp.alpha + crp.N)), tt::tolerance(1e-6));

// This should be log(alpha ^ 3 * 0! * 2! * 1! * 0! / (6!)) = -log(360)
BOOST_CHECK_CLOSE(crp.logp_score(), -log(360.), 1e-6);
}
Expand Down
2 changes: 1 addition & 1 deletion cxx/domain_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ BOOST_AUTO_TEST_CASE(test_domain) {
int ca = d.get_cluster_assignment(apple);
BOOST_TEST(ca == 5);
BOOST_TEST(cb == 12);
}
}
1 change: 0 additions & 1 deletion cxx/hirm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,3 @@ HIRM::~HIRM() {
delete irm;
}
}

4 changes: 2 additions & 2 deletions cxx/relation.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Relation {
typedef T ValueType;

virtual void incorporate(std::mt19937* prng, const T_items& items, ValueType value) = 0;

virtual void unincorporate(const T_items& items) = 0;

virtual double logp(const T_items& items, ValueType value, std::mt19937* prng) = 0;
Expand All @@ -38,7 +38,7 @@ class Relation {
int table, std::mt19937* prng) = 0;

virtual void transition_cluster_hparams(std::mt19937* prng, int num_theta_steps) = 0;

// Accessor/convenience methods, mostly for subclass members that can't be accessed through the base class.
virtual const std::vector<Domain*>& get_domains() const = 0;

Expand Down
2 changes: 1 addition & 1 deletion cxx/util_distribution_variant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ EmissionVariant cluster_prior_from_spec(const EmissionSpec& spec,
default:
assert(false && "Unsupported emission enum value.");
}
}
}
7 changes: 3 additions & 4 deletions examples/datasets/README_DATASETS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Data analyzed by
Data analyzed by

Kemp, C., Tenenbaum, J. B., Griffiths, T. L., Yamada, T. & Ueda, N. (2006).
Learning systems of concepts with an infinite relational model. AAAI 2006
Expand All @@ -12,9 +12,9 @@ http://charleskemp.com/papers/KempTGYU06.pdf
3) alyawarradata: kinship terms collected by Denham.
atts: kinship sections for each person
datass: kinship sections (one of n coding)
features: column 4 is gender, column 5 is age, column 9 is kinship section.
features: column 4 is gender, column 5 is age, column 9 is kinship section.

The other features are described by Denham at
The other features are described by Denham at

https://www.kinsources.net/kidarep/dataset-49-alyawarra-1971-au01.xhtml

Expand All @@ -29,4 +29,3 @@ http://charleskemp.com/papers/KempTGYU06.pdf
Nations project (Rummel). We've thresholded each continuous
variable at its mean and used one-of-n coding for the
categorical variables.

1 change: 0 additions & 1 deletion examples/two_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,3 @@
# from hirm.util_math import log_normalize
# p1, p2 = np.exp(log_normalize([score, score1 + score2]))
# print((p1, p2))

0 comments on commit 0a9c8ca

Please sign in to comment.