We made a Docker image that provides the running environment, you can pull from the Docker:
> docker pull xiaohan2012/active_cascade_reconstruction
Then, you can enter the container's shell environment:
> cd active_cascade_reconstruction
> ./start_docker.sh
# (now, you are in docker container)
To test the code,
> cd /code/active_cascade_reconstruction
> pytest test*.py
- query selection algorithms
query_selection.py
: random, pagerank, entropy, prediction_errortree_stat.py
: query score calculation for entropy and prediction_error,sample_pool.py
: steiner tree sampling part (including incrementally sample update upon queries)
- estimating infection probability
inference.py
: also calls functions intree_stat.py
make_graph_weighted.py
: dump graph with edge weightssimulate_cascades.py
: simulate cascades and dump to filesgenerate_queries.py
: [batch] produce queries and dump to filesquery_one_round.py
: [single] produce queries and dump to file
infer_from_queries.py
: [in batch] infer the infection probabilities from queriesinfer_one_round.py
: [single]
query_process_illustration.py
: visualize different query strategies
./scripts/gen_cascade.sh
: generate the cascades./scripts/run.sh
: generate queries and infer the infection proability./scripts/eval_plot.sh
: performance evaluation and plotting
- edit the configuration file under
exp_configs/
python3 runner.py --name {name_of_the_config_file_editted_before}
- the sbatch file path will be printed as
${path_of_sbatch_file}
- the sbatch file path will be printed as
sbatch ${path_of_sbatch_file}
to submit the job- the result will be saved to postgres DB
- optionally, you can view the result in the database
sample_size_effect_plot.py
: inference performance by effect of sample size using different sampling methodscompare_query_methods_plot.py
: comparing different query strategies
use ./singularity/exec.sh ${cmd_to_exec}
to execute the command in the singularity container
possibly deprecated
- use
make_graph_weighted.py
to add weights and use the resulting graph to simulate cascade - use
preprocess_graph.py
to apply global normalization and edge reversing
gen_cascades_with_varying_size.sh
gen_cascades_with_varying_obs_fraction.sh
UPDATE Mar 8
for IC, cascade size depends on the edge probability. so setting cascade size needs to be done by trying different edge probabilities
to achieve so, do the following
- generate the weighted graph using
make_weighted_graph.py
- generate cascade using
./scripts/gen_cascade_weighted.sh
- check the cascade size using
print_cascade_sizes.py
- modify the edge weights and go back to 1
- once you are fine with the size, edit and run
./scripts/mv_graph_and_cascade.sh
run.sh
: run the query selection as well as inference partquery_cascades_with_varying_size.sh
query_cascades_with_varying_obs_fraction.sh
query_weighted_graph.sh
: on weighted graph
note on the directories:
outputs/queries-weighted
: for the weighted graph- it contain queries using unweighted sampling, then the subdirectory has name
{entropy, prediction_error}-unweighted
- it contain queries using unweighted sampling, then the subdirectory has name
outputs/queries
: for the unweighted graph
infer_weighted_cascade.sh
: on weighted graphinfer_cascades_with_varying_size.sh
: TBDinfer_cascades_with_varying_obs_fraction.sh
: TBD
note on the directories:
outputs/inf_probas-weighted
: inference using weighted samplingoutputs/inf_probas-unweighted
: inference using unweighted sampling
scripts/query_{dataset}.sh
: generate queries for${dataset}
scripts/infer_{dataset}.sh
: make inference on infections for${dataset}
compare_running_time.py
: script to compare running time for different query methodsprint_cascade_sizes.py
: print simulated cascade statistics