about summary refs log tree commit diff
path: root/info_files
diff options
context:
space:
mode:
authorziejd22019-01-31 23:10:52 -0600
committerziejd22019-01-31 23:10:52 -0600
commita7d529b3192e5b4261d1c63372a4fbfd8c45327b (patch)
tree76f58c821801209735af0ee48c15508055189186 /info_files
parent2d45f744e35b91c70a2db5f8ae6701e76d2a9b80 (diff)
downloadBNW-a7d529b3192e5b4261d1c63372a4fbfd8c45327b.tar.gz
Added info_files folder
Diffstat (limited to 'info_files')
-rw-r--r--info_files/BNW_data_flow.txt166
-rw-r--r--info_files/BNW_file_overview.txt164
-rw-r--r--info_files/BNW_to_do.txt32
-rw-r--r--info_files/server_change_notes.txt35
4 files changed, 397 insertions, 0 deletions
diff --git a/info_files/BNW_data_flow.txt b/info_files/BNW_data_flow.txt
new file mode 100644
index 00000000..928983e4
--- /dev/null
+++ b/info_files/BNW_data_flow.txt
@@ -0,0 +1,166 @@
+This file will provide an overview of data flow within BNW and describe the output files that are created for the network. 
+These files are written to the /sourcecodes/data/ directory.
+This discusses what happens after clicking on "Learn network model from data" on homepage (home.php) and focuses on the core functions of BNW.
+
+Step 1: Upload data
+
+Clicking "Learn network model from data" on homepage (home.php) goes to: 
+bn_file_load_gom.php which is responsible for uploading the input file
+   and preparing it for structure/parameter learning.
+
+Specifically, uploading a file runs the 'run_prep_input' script in /sourcecodes.
+This runs the prepareInput.m MATLAB/Octave function.
+
+One additional note:
+BNW assigns each network a randomly generated 3 letter prefix when the file is uploaded.
+I will use ??? to signify this prefix.
+
+The following 13 files are written to /sourcecodes/data directory during this step:
+1) ???continuous_input_orig.txt: This is an exact copy of the input file uploaded by the user.
+2) ???continuous_input.txt: Input file after processing by prepareInput.m.
+   -A couple of notable changes are made that differentiate input.txt from input_orig.txt.
+     a) An additional header type row containing the variable/node type is added as the second row of the file.
+         See ???type.txt below.
+     b) Discrete variable values are recoded to be integers.
+3) ???input_desc.txt: Variable descriptions that can be viewed by user clicking on "View uploaded variables and data"
+4) ???nnode.txt: The number of variables/nodes in the input file (# of columns in input file).
+5) ???nrows.txt: The number of cases/samples in the input file (# of rows in the input file, excluding header lines).
+
+The following 3 files are used to keep track of variable names, variable types, and discrete variable states.
+6) ???name.txt: The names of the variables in the input file in the same order as they are presented in the input file.
+7) ???nlevels.txt: The original possible states of discrete variables in the input file. The order of these states
+      corresponds to the integers in ???continuous_input.txt (i.e., the first listed state for the variable has a value
+      of 1 in ???continuous_input.txt, the second listed state has a value of 2, . . .)
+8) ???type.txt: The type of each variable/node. Continuous nodes have a value of 1. Discrete nodes have a value equal to the
+      number of possible states.
+
+The following 5 files contain default values of structure learning options.
+They will be modified if the structural constraint interface is used.
+9) ???ban.txt: List of banned edges (will contain only a header line at this point).
+10) ???white.txt: List of required edges (will contain only a header line at this point).
+11) ???k.txt: Number of top-scoring models to include in model averaging (default value is 1, indicating no model averaging).
+12) ???parent.txt: Maximum number of parents for each node during structure learning (default value is 4).
+13) ???thr.txt: Threshold value to include edges after model averaging (default value is 0.5). 
+
+Step 2a: Structure learning with default parameters
+
+Click "Perform Bayesian network modeling using default settings"
+This is a link to executionprogress.php which just displays a "progress bar" and starts structure learning.
+To start structure learning, it runs execute_bn_gom.php.
+execute_bn_gom.php which runs the run.sh script and prepares a couple of files.
+
+The run.sh script contains the commands to run the structure learning codes.
+
+Output files from structure learning that are written to /sourcecodes/data:
+1) ???structure_input.txt: The structure matrix, containing the edges included in the network model.
+   The format of this file is a header line containing the variable names.
+   The rest is the strucure matrix where 1 indicates an edge is included in the network and a 2 is not.
+   The matrix had dimensions n x n where n is the number of variables.
+   A '1' in the ith column in the jth row indicates that there is an edge from variable i to variable j.
+2) ???structure_input_temp.txt: Structure matrix with model averaging data.
+   This file has the model averaging probability of each edge.
+   The ???structure_input.txt file is generated from this file. If the value of an edge is this file
+   is greater than the value in ???thr.txt, the edge is included in the network (a '1' in ???structure_input.txt).
+
+execute_bn_gom.php also creates the following graphviz:
+3) ???grviz_name_file.txt: A list of the names of the variables that is used by graphviz/dot. 
+4) ???graphviz.txt: Input file for dot that creates the edges included in the network.
+   0 is the first node listed in ???grviz_name_file.txt, 1 is the second node, . . .
+
+
+Step 2b: Structure learning using the structural constraint interface
+
+Before the process described in Step 2a, additional constraints or changes to default parameters 
+  can be added using the structural constraint interface.
+
+This can be accessed by clicking on "Go to structure learning settings and the BNW
+     structural constraint interface" which links to create_tiers_gom.php
+
+The top section of create_tiers_gom.php is "Global structure learning settings"
+  Modifying this section will change the values in ???parent.txt, ???k.txt, and ???thr.txt.
+
+The remaining sections will modify the ???ban.txt and ???white.txt files.
+
+Clicking on "Perform Bayesian network modeling" goes to executionprogress.php and Step 2a is followed.
+
+
+Step 3: Parameter learning of the original network.
+
+The step begins near the end of execute_bn_gom.php file where the run_octave script is run.
+
+run_octave starts up the runBN_initial.m Matlab/Octave script.
+This prepares parameter learning for the data file in ???continuous_input.txt and 
+    network structure defined in ???structure_input.txt.
+
+runBN_initial makes 2 main output files and 2 files that may be used by other Matlab/Octave scripts.
+1) ???net_figure.txt: This file provides the data that is used to draw the network in BNW.  I will describe 
+      the format of this file elsewhere.
+2) ???parameters.txt: The parameters of the network using the original data set.
+    This file is broken into different sections that correspond to each variable/node.
+    Each section has the name of the variable and whether it is discrete or continuout.
+    If it is discrete, the number of possible states is also provided.
+    For discrete nodes, the percentage of each state is listed.
+    For continuous nodes, the mean and standard deviation of the Gaussian fit to that variable is provided.
+3) ???map.txt: The standard deviations and means of the original data set.
+    The parameter learning tools used in BNW work best if continuous data is normalized.
+    Each line of this file provides the variable name, the standard deviation, and the mean of the original data
+         for each variable for use in standardizing data in the Matlab/Octave scripts.
+4) ???mapdata.txt: The topological order of the nodes used in parameter learning.
+    Sometimes before parameter learning, the nodes are resorted so they are in topological order (i.e., 
+      parents are always listed before parents).
+
+Step 4: Display of the network.
+  
+This step is initiated at the end of execute_bn_gom.php when layout.php is opened.
+
+layout.php is the main page that is used when the network is displayed.
+
+The network is drawn in a division using either 
+network_layout_evd.php if Evidence mode is being used or 
+network_layout_inv.php if Intervention mode is being used.
+
+These php files basically just read and ???net_figure.txt and run dot using the graphviz file
+   described above to draw the network.
+
+Step 5a: Adding evidence or intervention to the network.
+
+Clicking on a node and entering evidence/intervention runs add_evd.php/add_inv.php.
+
+This creates 3 files:
+(I am going to describe these as evidence here, intervention mode is the same.)
+1) ???vardata.txt: The value of the evidence that was entered.
+2) ???varname.txt: The name of the node for which evidence was entered.
+3) ???var.txt: The index of the node for which evidence was entered in the ???mapdata.txt file.
+If evidence is entered for more than one node, these files will contain tab-separated lists.
+
+add_evd.php/add_inv.php then runs a script called either run_octave_evd or run_octave_inv.
+
+This script runs the Predictmultiple or Predictmultipleintervention Matlab/Octave functions.
+
+The output files from this script are:
+4) ???net_figure_new.txt: The net_figure file after entering evidence/intervention.
+5) ???parameters_ev.txt: The parameters of the network considering the evidence/intervention.
+
+Then, network_layout_evd_2.php or network_layout_inv_2.php is used to draw the network with the evidence/intervention.
+
+Step 5b: Additional files created in Intervention mode.
+
+In Intervention mode, the network structure can change. The node with intervention no longer depends on its parents.
+
+Several files must be created to account for this. They are the same as described above, but with the new network structure.
+1) ???graphviz_new.txt
+2) ???grviz_name_file_new.txt
+3) ???structure_input_new.txt
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/info_files/BNW_file_overview.txt b/info_files/BNW_file_overview.txt
new file mode 100644
index 00000000..ad9849ff
--- /dev/null
+++ b/info_files/BNW_file_overview.txt
@@ -0,0 +1,164 @@
+This file will provide an overview of the BNW code.
+
+At this point, BNW requires three packages that are not currently included in the BNW directory.
+These are dot/graphviz; octave; and plotly. The BNW code assumes:
+a) dot can be executed using /usr/bin/dot
+b) octave can be executed using /usr/bin/octave
+c) plotly: 
+    The version of python on the current server is too old for plotly. I installed an newer version of python in my home directory:
+     python2.7 is currently installed in /home/jziebart/python/Python-2.7.15/python
+    Then, to use plotly, I modified files.py in:
+      /home/jziebart/python/lib/python2.7/site-packages/plotly to use absolute paths for PLOTLY_DIR and TEST_DIR
+    The files that need plotly are:  cv_plotly.py, kfold_plotly.py, and ts_plotly.py
+    
+BNW is currently located at /var/www/html/compbio/BNW_x.xx
+(The current development version is BNW_1.21).
+
+The main BNW directory contains two basic files (index.html and home.php) and two directories.
+A couple of lines in home.php should be modified/updated to point to the correct BNW directory.
+
+downloads: This contains the downloadable version of the BNW structure learning package.
+
+sourcecodes: This contains the files and codes that are used by the webserver.
+The main purpose of this file is to provide a brief overview of the files that are contained in 'sourcecodes'.
+
+1. Directories within sourcecodes:
+a) bnt-master: This contains the code for BayesNetToolbox which is used in parameter learning in BNW.
+	It has been slightly modified to work with Octave instead of MATLAB.
+	I have also made a couple of changes to ensure that initial parameters are taken directly from the data for discrete nodes.
+
+b) parameter_learning: This contains the MATLAB/Octave code that we have written for parameter_learning.
+        It also prepares data that has been uploaded to BNW for use with the structure learning code.
+
+c) k-best and localscore: These two directories contains the C code used for structure learning.
+
+d) BNW_workflow_test_files, example_datasets, and examples: These three directories contain files that are used by the tutorials and examples on the BNW homepage.
+
+e) data: The data for files generated by using BNW is written to this directory. It also contains several sub-directories that contain example data and networks.
+
+f) run_scripts: Scripts that run Octave calculations.
+
+2. Files within sourcecodes:
+a) Major BNW php files:
+Many of these will be described in BNW_data_flow.txt.
+bn_file_load_gom.php: Used in uploading data to be used for structure learning.
+create_tiers_gom.php: Structural constraint interface.
+home_upload.php: Used in uploading a data file and a structure file when the structure is known. 
+layout_example.php: Main php file for displaying/making predictions with network using example data.
+layout.php: Main php file for displaying/making predictions with network using user uploaded data.
+net_structure.php: Used in uploading structure file when the network structure is known.
+upload_structure_file.php: Used in uploading structure file when the network structure is known.
+faq.php
+getting_started.php
+help.php
+home.php
+workflow.php
+
+b) Files related to the structure learning package:
+build.sh
+network_score
+structure
+run.sh
+
+c) Files related to home page, help files, example data sets, and tutorials:
+BNW_overview.png
+BNW_workflow_1.htm
+BNW_workflow_2.htm
+BNW_workflow_net1.htm
+BNW_workflow_sci.htm
+index.html
+example.php
+examplefilecopy.sh
+
+d) General html/css/inc files:
+header_batchsearch.inc
+header_new.inc
+js-graph-it.css
+js-graph-it.js
+my_new_style.css
+sf-homepage.css
+
+e) PHP files that support layout.php or layout_example.php:
+add_evd_example.php
+add_evd.php
+add_inv_example.php
+add_inv.php
+network_layout_evd_2_example.php
+network_layout_evd_2.php
+network_layout_evd_example.php
+network_layout_evd.php
+network_layout_inv_2_example.php
+network_layout_inv_2.php
+network_layout_inv_example.php
+network_layout_inv.php
+
+f) Files used for cross-validation/making predictions using a test set:
+cv_predictions.php, cv_predictions_example.php
+-Cross-validations overview page
+
+cross_valid.php, cross_valid_example.php, cv_plotly.py
+-Used for leave-one-out cross-validation
+
+kfold_cv_example.php, kfold_cv.php, kfold_plotly.py
+-Used for k-fold cross-validation
+
+test_set_predictions.php, test_set_predictions_example.php, ts_plotly.py
+-Used with test set predictions.
+
+g) Files used in input checking/error processing
+input_error.php
+input_error_no_menu.php
+input_validate.php
+keyval_error.php
+
+h) Files that perform specific functions:
+tier_description_processing_gom.php
+-Used by create_tiers_gom.php for the structure constraint interface.
+
+clear_example.php, clear.php, and filecopy.sh
+-Used by layout.php to clear entered evidence/intervention 
+
+execute_bn_gom.php
+-Runs the script (run.sh) that performs structure learning after uploading data/adding constraints
+-It is actually called by executionprogress.php
+
+executionprogress.php, runtime_check.php, k_only_table.txt, and maxparent_table.txt
+-Used to provide an estimate of how long structure learning will take.
+
+graphviz_structure.php
+-Called by net_structure.php and used to generate files when users upload data with a known structure.
+
+mat_structure.php
+-Called by add_inv.php and add_inv_example.php when making predictions after an intervention.
+-Interventions can change the network structure and this file help account for these changes.
+
+matrix.php
+-Allows for display of the structure matrix file.
+
+input_check.php
+-Allows for display of the input file and variable description files.
+
+parameter_display.php
+-Allows for display of the network parameters of the original data set and after entering evidence/intervention.
+
+enter_netID.php
+-Allows for returning to old network after entering the netID.
+
+modify_structure_learning.php, bn_after_upload_gom.php
+-Allows for modification of structure learning settings without having to upload the file again.
+
+modify_edges.php, modify_edges_processing.php
+-Allows for the removal or addition of specific nodes to a network.
+
+remove_variables.php, remove_variables_processing.php, remove_variables_processing_default.php
+-Allows for the removal of variables after uploading an input file.
+-remove_variables_processing_default.php performs structure learning using defail settings.
+-remove_variables_processing.php goes to the structural constraint interface.
+
+
+
+
+
+
+
+
diff --git a/info_files/BNW_to_do.txt b/info_files/BNW_to_do.txt
new file mode 100644
index 00000000..b3812c46
--- /dev/null
+++ b/info_files/BNW_to_do.txt
@@ -0,0 +1,32 @@
+1) Improve cross-validation and prediction interface and output. The development version has three specific tools here:
+leave-one-out cross validation, k-fold cross validation, and making predictions using a test data set.
+The input and output methods and format currently work, but could be greatly improved.
+a) Currently, users have to type the name of a variable in an input box on BNW for LOOCV and KfoldCV. The predictions of this variable are then investigated by BNW. For the test data set, the variable of interest has to be the first line of the input test data file. Adding a dropdown selection box with the network variables might be better. 
+b) The output files are just plain text files with no formatting. We should probably at least have something like showing the prediction accurary/error of the predictions on an html page, and then having a button that could be used to download the complete prediction file. 
+c) The predictions could be displayed graphically. For example, for continuous variables, we could show a plot with the predicted and actual values for the cross validation or prediction.
+d) There might be a couple of additional metrics for assessing the quality of predictions that we could add. I will look at some the Bayesian network R packages again to see what they use.
+
+2) Add additional image of the network model that displays only the node names.
+This could be the first visualization of the network that is displayed after structure learning. 
+A couple of desired features: nodes that can be dragged and the potential to export a high quality image.
+This image could also show the strength of the evidence for the edge (e.g., the width of the line or a number next to the line).
+There would be a button somewhere with something like: "Make predictions with network" that would take users to current network visualization.
+This would be viewed before layout.php.
+
+3) Improve look when viewing additional files. 
+Specifically, I am referring to data available in "View uploaded variabels and data", "Display structure matrix", and "View parameters". The related files are input_check.php, matrix.php, and parameter_display.php, respectively.
+
+4) Clarify file loading and BNW calculations. Sometimes it is not clear that a file is still being loaded or a calculation is currently running. 
+a) Improve interface for users with a known structure ("Make predictions using a known structure" on the BNW homepage).
+It should be more clear what button needs to be clicked to go to the next step. It might be better to upload the data and structure files on the same page.
+The related files are home_upload.php, upload_structure_file.php, and net_structure.php.
+b) Some minor changes to the upload procedure for the general data upload ("Learn a network model from data") might also be helpful.
+c) The calculation after evidence/intervention is submitted can take 5-10 seconds.
+
+5) Improve security for uploaded files.  I have made some security improvements to check things like making sure the network ID's that are entered are correct, but th
+
+6) Add informative error messages for when things go wrong with structure/parameter learning. I need to think about how to do this.
+
+7) Allow users to log into BNW to easily save and return to networks? Currently, there is the option of using the network ID to return to the network. Is this something that we should keep long term?
+
+8) Parallelize the structure learning code. 
diff --git a/info_files/server_change_notes.txt b/info_files/server_change_notes.txt
new file mode 100644
index 00000000..e7ccd6ab
--- /dev/null
+++ b/info_files/server_change_notes.txt
@@ -0,0 +1,35 @@
+This file will contain notes that will be needed for moving to a new server:
+
+Required software:
+1) Octave
+   BNW assumes Octave can be executed using /usr/bin/octave
+   The header line in all of the files in the run_scripts directory will need to be modified if this is not true.
+   
+2) dot/graphviz
+   BNW assumes dot can be executed using /usr/bin/dot
+   
+3) plotly
+   I installed a local copy of python in my home directory to run plotly
+   
+
+Specific changes that need to be made:
+Files that use Octave:
+Header lines in all of the files in the run_scripts directory
+
+Files that use dot:
+-network_layout_evd_2_example.php: line 275
+-network_layout_evd_2.php: line 247
+-network_layout_inv_2_example.php: line 360
+-network_layout_inv_2.php: line 360
+-network_layout_inv.php: line 102
+-network_layout_inv_example.php: line 150
+-network_layout_evd.php: line 114
+-network_layout_evd_example.php: line 117
+
+Files that use plotly:
+cv_plotly.ph: header line
+ts_plotly.py: header line
+kfold_plotly.ph: header line
+
+
+