Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delphi modeling 1 #499

Merged
merged 53 commits into from
Oct 19, 2021
Merged
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
c20de3d
Allowed to ground some nodes of the cag with external functions.
May 10, 2021
8f1b4ee
Added code to distinguish between dependent and independent nodes of the
May 25, 2021
1b594bf
Modeling root nodes separately.
May 28, 2021
6d72733
A script to analyze and visualize rain data
Jun 7, 2021
96f6870
Experimenting with using partition median and relative change between
Jun 14, 2021
29fa9c0
Tidying up the head node modeling code
Jun 15, 2021
5649dde
More tidying up head node modeling code.
Jun 16, 2021
6cf939d
more tyding up head node modeling code
Jun 16, 2021
05bf812
more tyding up head node modeling code
Jun 16, 2021
352d732
fixed a logical bug
Jun 16, 2021
e3a1986
Added another graph
Jun 22, 2021
e549984
The head node model that was demoed for 2021 June embed.
Jun 22, 2021
10cf87d
Updated the head node modeling code with a guard to prevent a segment…
Jun 22, 2021
3da99de
Updated the code so that:
Jun 23, 2021
dc9cbb6
Integrated head node modeling component with Causemose
Jul 30, 2021
843b7e4
Pached an old (could be obsolete) method to fix a segmentation fault …
Jul 30, 2021
39bd25f
Accumulating log likelihoods
Jul 31, 2021
15858e9
MAP Sample
Aug 2, 2021
553ec61
Fixed a place that gave a segmentation fault due to faulty logic
Aug 3, 2021
e7dcdaa
Fixed an initialization bug
Aug 3, 2021
8a3e2dc
MAP Estimate (#492)
manujinda Aug 4, 2021
2c84eb5
Fixed a bug
Aug 10, 2021
c07eeae
Delphi modeling 1 dev (#493)
manujinda Aug 10, 2021
5c0ab70
Generating synthetic CAGs
Aug 19, 2021
b1a0e2e
Cleanup
Aug 23, 2021
c70f374
More cleaning
Aug 23, 2021
8cecf28
Created a class to perform timing
Aug 25, 2021
6a7ab55
Fixed CMakeLists.txt
Aug 25, 2021
65b0910
Changed a file name
Aug 25, 2021
dcd0f92
A basic macro profiler completed.
Aug 30, 2021
f5724d6
Added some progress messages to the timer.
Aug 30, 2021
2290f0b
Added proper error checking for opening delphi.db
Sep 1, 2021
4beb2fd
Improved the newly created delphi.db open method to accept the database
Sep 1, 2021
54b2bf7
Improved the Delphi macro timing program to accept command line options.
Sep 9, 2021
b5919a7
Removed inclusion of dbg.h in main source files.
Sep 9, 2021
9a0fa36
Fixed the help option in timer.
Sep 9, 2021
43c7700
The june embed jupytre notebook got opened and some version number go…
Sep 24, 2021
51f44b2
Seasonal curve from a Fourier series
Sep 24, 2021
efb1c08
Commented out some unused synthetic data generating methods.
Oct 7, 2021
f6fea8b
Deleted commented code related to synthetic data generation.
Oct 7, 2021
3462a2b
Delphi modeling 1 dev (#496)
manujinda Oct 7, 2021
d05a596
Added a stub to export a create model json file.
Oct 9, 2021
b68f8fd
Updated the debugger.py script to test synthetic CAG generation.
Oct 10, 2021
caf8b38
Updated the seasonal_fourier.py script
Oct 10, 2021
a8b003d
Changing terminology
Oct 10, 2021
a01e097
Some refactoring
Oct 10, 2021
7d0dde6
Merge branch 'delphi_modeling_1_dev' of github.com:ml4ai/delphi into …
Oct 10, 2021
d67cc9f
Removed a duplicate copy of timer.cpp in scripts folder
Oct 10, 2021
e2239b2
Added two scripts to perform some regression testing:
Oct 13, 2021
6457b6a
Merge branch 'delphi_modeling_1_dev' of github.com:ml4ai/delphi into …
Oct 13, 2021
b783508
Added mean and standard deviation of the snapshot differences to the
Oct 13, 2021
b3e1038
Merge branch 'delphi_modeling_1_dev' of github.com:ml4ai/delphi into …
Oct 13, 2021
6e408cd
Delphi modeling 1 dev (#498)
manujinda Oct 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated the head node modeling code with a guard to prevent a segment…
…ation fault happening on old test code
Manujinda Wathugala committed Jun 22, 2021
commit 10cf87d67850c9d2214129ff5811ee6259daf68a
80 changes: 43 additions & 37 deletions lib/independent_nodes.cpp
Original file line number Diff line number Diff line change
@@ -46,67 +46,73 @@ void AnalysisGraph::generate_head_node_latent_sequence(int node_id,
bool sample,
int seq_no) {
Node &n = (*this)[node_id];
this->generated_latent_sequence = vector<double>(num_timesteps);
this->generated_latent_sequence = vector<double>(num_timesteps, 0);

if (n.model.compare("center") == 0) {
// dbg("center");
if (!n.centers.empty()) {
if (n.model.compare("center") == 0) {
for (int ts = 0; ts < num_timesteps; ts++) {
int partition = ts % n.period;
this->generated_latent_sequence[ts] = n.centers[partition];
int partition = ts % n.period;
this->generated_latent_sequence[ts] = n.centers[partition];

apply_constraint_at(ts, node_id);
apply_constraint_at(ts, node_id);
}
} else if (n.model.compare("absolute_change") == 0) {
// dbg("absolute_change");
}
else if (n.model.compare("absolute_change") == 0) {
// dbg("absolute_change");
this->generated_latent_sequence[0] = n.centers[0];
for (int ts = 0; ts < num_timesteps - 1; ts++) {
int partition = ts % n.period;
this->generated_latent_sequence[ts + 1] =
this->generated_latent_sequence[ts] + n.changes[partition + 1];
int partition = ts % n.period;
this->generated_latent_sequence[ts + 1] =
this->generated_latent_sequence[ts] + n.changes[partition + 1];

apply_constraint_at(ts + 1, node_id);
apply_constraint_at(ts + 1, node_id);
}
} else if (n.model.compare("relative_change") == 0) {
// dbg("relative_change");
}
else if (n.model.compare("relative_change") == 0) {
// dbg("relative_change");
this->generated_latent_sequence[0] = n.centers[0];
for (int ts = 0; ts < num_timesteps - 1; ts++) {
int partition = ts % n.period;
this->generated_latent_sequence[ts + 1] =
this->generated_latent_sequence[ts] +
n.changes[partition + 1] * (this->generated_latent_sequence[ts] + 1);
int partition = ts % n.period;
this->generated_latent_sequence[ts + 1] =
this->generated_latent_sequence[ts] +
n.changes[partition + 1] *
(this->generated_latent_sequence[ts] + 1);

apply_constraint_at(ts + 1, node_id);
apply_constraint_at(ts + 1, node_id);
}
}
}

if (sample) {
if (sample) {
for (int ts = 0; ts < num_timesteps; ts++) {
int partition = ts % n.period;
this->generated_latent_sequence[ts] +=
n.spreads[partition] * norm_dist(this->rand_num_generator);
}
} else {
int partition = ts % n.period;
this->generated_latent_sequence[ts] +=
n.spreads[partition] * norm_dist(this->rand_num_generator);
}
}
else {
int sections = 5; // an odd number
int half_sections = (sections - 1) / 2;
int turn = seq_no % sections;
for (int ts = 0; ts < num_timesteps; ts++) {
int partition = ts % n.period;
this->generated_latent_sequence[ts] += (turn - half_sections) * n.spreads[partition];
this->generated_latent_sequence[ts] +=
(turn - half_sections) * n.spreads[partition];
apply_constraint_at(ts, node_id);
}
}
}

if (n.has_max) {
for (int ts = 0; ts < num_timesteps; ts++) {
if (this->generated_latent_sequence[ts] > n.max_val) {
this->generated_latent_sequence[ts] = n.max_val;
if (n.has_max) {
for (int ts = 0; ts < num_timesteps; ts++) {
if (this->generated_latent_sequence[ts] > n.max_val) {
this->generated_latent_sequence[ts] = n.max_val;
}
}
}
}
if (n.has_min) {
for (int ts = 0; ts < num_timesteps; ts++) {
if (this->generated_latent_sequence[ts] < n.min_val) {
this->generated_latent_sequence[ts] = n.min_val;
if (n.has_min) {
for (int ts = 0; ts < num_timesteps; ts++) {
if (this->generated_latent_sequence[ts] < n.min_val) {
this->generated_latent_sequence[ts] = n.min_val;
}
}
}
}