Skip to content

Commit

Permalink
Merge pull request #110 from sashafrey/master
Browse files Browse the repository at this point in the history
#109 and ThetaMatrix.item_title
  • Loading branch information
bigartm committed Jan 26, 2015
2 parents 59f141f + 5b9fda5 commit 8416560
Show file tree
Hide file tree
Showing 20 changed files with 529 additions and 231 deletions.
7 changes: 6 additions & 1 deletion docs/ref/messages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,7 @@ Represents a theta matrix.
repeated FloatArray item_weights = 3;
repeated string topic_name = 4;
optional int32 topics_count = 5;
repeated string item_title = 6;
}

.. attribute:: ThetaMatrix.model_name
Expand All @@ -1482,7 +1483,7 @@ Represents a theta matrix.

.. attribute:: ThetaMatrix.item_id

A set of item IDs.
A set of item IDs corresponding to :attr:`Item.id` values.

.. attribute:: ThetaMatrix.item_weights

Expand All @@ -1500,6 +1501,10 @@ Represents a theta matrix.
A value that describes the number of topics in the topic model.
This value will match :attr:`ModelConfig.topics_count` value, defined in the model config.

.. attribute:: ThetaMatrix.item_id

A set of item titles, corresponding to :attr:`Item.title` values.

.. _CollectionParserConfig:

CollectionParserConfig
Expand Down
2 changes: 2 additions & 0 deletions src/artm/core/helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ bool BatchHelpers::PopulateThetaMatrixFromCacheEntry(
}

theta_matrix->set_topics_count(topic_indices.size());
bool has_title = (cache.item_title_size() == cache.item_id_size());
for (int item_index = 0; item_index < cache.item_id_size(); ++item_index) {
const artm::FloatArray& item_theta = cache.theta(item_index);
if (all_topics) {
Expand All @@ -290,6 +291,7 @@ bool BatchHelpers::PopulateThetaMatrixFromCacheEntry(
}

theta_matrix->add_item_id(cache.item_id(item_index));
if (has_title) theta_matrix->add_item_title(cache.item_title(item_index));
}

return true;
Expand Down
199 changes: 124 additions & 75 deletions src/artm/core/internals.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8416560

Please sign in to comment.