Coder Social home page Coder Social logo

jayeshchoudhari / hmhp Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 2.0 2.48 MB

Hidden Markov Hawkes Process - Model for Analyzing Topical Transitions in text based cascades in Social Networks.

C++ 85.67% Python 13.58% Shell 0.61% Makefile 0.14%
hawkes-process generative-model point-process gibbs-sampling mcmc-sampler

hmhp's Introduction

HMHP

Hidden Markov Hawkes Process is probabilistic model proposed in Discovering Topical Interactions in Text-based Cascades using Hidden Markov Hawkes Processes

Executing HMHP model code (inside HMHPModel folder)

The cpp file hmhp_EstAll_GroupedWuv.cpp is the code for the HMHP model. To run the model, the input files required are:

  • events file
  • documents file
  • followers map
  • indegree and outdegree file for each node
  • candidate parents for each event and a file containing exponential time difference value for each candidate parent for each event (this can be precomputed from the events file and followers map):

To compile the code:

make

To execute the code, argv[1] = BURN-IN, argv[2] = Total No. Of Iterations, argv[3] = path to input files, and argv[4] = path to output files. Code can be executed as follows:

./mainHMHP 200 301 inputFilesOurModel.txt outputFilesOurModel.txt

As we record the inferred parent and topic assignments only at every 10th iteration after the BURN-IN period, the total number of iterations must be greater than 10 and greater than BURN-IN period.

The code outputs various files as follows:

  • parent assignment (recorded at every 10th iteration after BURN-IN)
  • topic assignment (recorded at every 10th iteration after BURN-IN)
  • avg parent assignment (probability of candidate parent event)
  • grouped wuv values

After the execution of the above code and once all the files are in place, one can execute the script evaluateHMHP.sh

The file format for the input files is as follows:

  1. Events File: Each line of events file describes an event with 5 space separated values as follows:
event_time user_node parent_event_id topic_id level_info
  1. Documents File: i-th line has a document corresponding to i-th event in the events file. Each document is set of space separated (int) word-ids.

  2. Followers Map: Each line of the followers map is as follows (all the values are space separated):

NumOfFollowers userId followerId-1 followerId-2 ... followerId-M
  1. Indegree and Outdegree Files: Each line of the both the files has two space separated values:
out/in-degree userId
  1. Candidate Parents File: Each line contains the information of the candidate parent events for each event. Each line has space separated values as follows:
NumOfCandParents EventId CandParentId_1 CandParentId_2 ... CandParentId_100 
  1. Candidate Parents Exponential Time-difference file: Each line contains the information of the exponential time difference between the candidate current event and the candidate parent event. Each line has space separated values as follows:
NumOfCandParents EventId ExpTimeDiffWithCandParentId_1 ExpTimeDiffWithCandParentId_2 ... ExpTimeDiffWithCandParentId_100

To get the candidate parent files, run the code "getStoreTopKCandParents.cpp". The program takes the events file as input and outputs two files -- one for the candidate parents and other is the exponential time difference file. The program can be run as follows:

g++ -std=c++11 -Wall -O2 -g -o getTop100CandParents  getStoreTopKCandParents.cpp

./getTop100CandParents pathToEventsFile pathToCandidateParentFile pathToCandidateParentExpTimeDiffFile

hmhp's People

Contributors

jayeshchoudhari avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ahmedsakrr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.