Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…r#65, HazyResearch/sampler#64

Merge commit '43cfb0301d89a421da911dca2e8f7ff6f528a344'
  • Loading branch information
netj committed Jan 24, 2017
2 parents f8e97ab + 43cfb03 commit 7b82f5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions inference/dimmwitted/src/factor_graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ void FactorGraph::construct_index_part(size_t v_start, size_t v_end,
v.total_truthiness += item.second.truthiness;
}
for (size_t j = 0; j < v.cardinality; ++j) {
// catch spurious values (e.g., due to duplicate tuples from DD)
assert(value_list[j] != Variable::INVALID_VALUE);
values[value_index_base] =
VariableToFactor(value_list[j], truthiness_list[j], 0, 0);
++value_index_base;
Expand Down
5 changes: 2 additions & 3 deletions inference/dimmwitted/src/inference_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ class InferenceResult {
void dump_marginals_in_text(std::ostream &text_output) const;

inline void update_weight(size_t wid, double stepsize, double gradient) {
double diff = stepsize * gradient;
weight_grads[wid] += diff;
weight_grads[wid] += gradient;
double weight = weight_values[wid];
switch (opts.regularization) {
case REG_L2: {
Expand All @@ -80,7 +79,7 @@ class InferenceResult {
default:
std::abort();
}
weight -= diff;
weight -= stepsize * gradient;
weight_values[wid] = weight;
}

Expand Down

0 comments on commit 7b82f5a

Please sign in to comment.