This repository was archived by the owner on Nov 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Support continuous ingest of message data and parallel metric computation. #30
Open
manthey
wants to merge
11
commits into
master
Choose a base branch
from
continuous-ingest
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…tion. So far, this will ingest instagram as pulled from elasticsearch (such as that supplied with the July data), and twitter in either GNIP or firehose JSON (as supplied with the July data). It will not work on the original instagram data that Roni pulled fro parquet files and saved as CSV. It should be easy to extent it to that format (though it has less data for comments and likes, so won't be as rich). Links are create from mentions, comments (instagram only), likes (instagram only), and replies (twitter only). Because of the comments and likes, Instagram refers to a vastly larger network of entities than twitter. It also has fewer messages per entity. The Instagram network is sparser than the Twitter network. Ingest and metric computation is fully parallelizable - multiple ingests can run concurrently. Each metric can be computed in a separate process. A possibly useful extension would be to subdivide the entity space so that a single metric can be parallelized with multiple processes as well. I've implemented four metrics so far. I have not yet implemented the metric based linking between twitter and instagram. The implemented metrics are: 1hop - This is quick to compute, as I maintain a list of neighbors within the entity records. If the entity is updated, it will be recomputed. The stored value is the number of 1-hop neighbors EXCLUSIVE of the root entity itself. 2hop - This requires visiting all the 1-hop neighbors. Since we don't know which of those neighbors has been updated, any entity update requires that we recheck all 2-hop values. I store both the number of 2-hop-only neighbors and the number of 2-hop and 1-hop neighbors. These counts never include the root entity itself. substring - This does a longest substring match between ALL entities, keeping the top-k for each service and subset. The substring calculation has been refactored to be about twice as fast as Curt's original implementation. When an entity is added or updated, only the modified entities need to be rechecked to maintain the top-k lists. This is still slow on a large collection. levenshtein - This computes the levenshtein metric between ALL entities, just like substring. It is even slower than substring matching. The substring and levenshtein metrics would be helped by more CPU resources, but would be helped even more by excluding entities from the candidate match. For instance, if the substring match is 0 (or below some other threshold), we could skip computing the levenshtein metric.
Calculate entity-spanning metrics faster by buffering queries and by only fetching relevant fields.
Add clear and recalc options to invalidate metrics that I have updated. Expand substring and levenshtein metrics to handle name and fullname and the combination of the two.
…ntities not in the database.
Fixed a bug in generating full name metrics.
|
Nice @manthey. It would be great to make a README with some of this info in it, and/or set up a Sphinx RTD site for this and include the nice function documentation you have in the code. |
Sped up processing susbtring and levenshtein metrics. Reduce the memory footprint. Comparisons are now more technically correct, as strings are normalized (Unicode can be written several ways; this makes it consistent).
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So far, this will ingest instagram as pulled from elasticsearch (such as that supplied with the July data), and twitter in either GNIP or firehose JSON (as supplied with the July data). It will not work on the original instagram data that Roni pulled fro parquet files and saved as CSV. It should be easy to extent it to that format (though it has less data for comments and likes, so won't be as rich).
Links are create from mentions, comments (instagram only), likes (instagram only), and replies (twitter only). Because of the comments and likes, Instagram refers to a vastly larger network of entities than twitter. It also has fewer messages per entity. The Instagram network is sparser than the Twitter network.
Ingest and metric computation is fully parallelizable - multiple ingests can run concurrently. Each metric can be computed in a separate process. A possibly useful extension would be to subdivide the entity space so that a single metric can be parallelized with multiple processes as well.
I've implemented four metrics so far. I have not yet implemented the metric based linking between twitter and instagram.
The implemented metrics are:
1hop - This is quick to compute, as I maintain a list of neighbors within the entity records. If the entity is updated, it will be recomputed. The stored value is the number of 1-hop neighbors EXCLUSIVE of the root entity itself.
2hop - This requires visiting all the 1-hop neighbors. Since we don't know which of those neighbors has been updated, any entity update requires that we recheck all 2-hop values. I store both the number of 2-hop-only neighbors and the number of 2-hop and 1-hop neighbors. These counts never include the root entity itself.
substring - This does a longest substring match between ALL entities, keeping the top-k for each service and subset. The substring calculation has been refactored to be about twice as fast as Curt's original implementation. When an entity is added or updated, only the modified entities need to be rechecked to maintain the top-k lists. This is still slow on a large collection.
levenshtein - This computes the levenshtein metric between ALL entities, just like substring. It is even slower than substring matching.
The substring and levenshtein metrics would be helped by more CPU resources, but would be helped even more by excluding entities from the candidate match. For instance, if the substring match is 0 (or below some other threshold), we could skip computing the levenshtein metric.