Setup instructions
NOT GOOD
pip install libpgm 2to3 -w /home/user/anaconda3/lib/python3.6/site-packages/libpgm/nodedata.py
2to3 -w /home/user/anaconda3/lib/python3.6/site-packages/libpgm/discretebayesiannetwork.py
2to3 -w /home/user/anaconda3/lib/python3.6/site-packages/libpgm/graphskeleton.py
2to3 -w /home/user/anaconda3/lib/python3.6/site-packages/libpgm/tablecpdfactorization.py
2to3 -w /home/user/anaconda3/lib/python3.6/site-packages/utils/bntextutils.py
from the command prompt
In [2]:
#load support functions
import experiment.algorithms.BNve as bn
import features.feature_extraction as fx
import experiment.exp_plot as exp_plot
from math import ceil
#initiate offline plotting for plotly
import plotly.offline as offline
import plotly.graph_objs as go
from plotly import tools
offline.init_notebook_mode(connected=True)
from IPython.core.display import Image
#set data directory that contains evidence
spec_file = 'exp1_spec'
yearstart = 2000
yearend = 2014
param_file = 'exp1_BNve_1' #text file containing model parameters
model = param_file
evidence_dir = 'exp1' #directory containing evidence/observations
In [5]:
bn.graphViz(param_file)
#Image('experiment/images/'+param_file+'.png')
In [4]:
fx.saveData(yearstart, yearend, spec_file)
In [6]:
classes12 = bn.inferCustomerClasses(param_file, evidence_dir, 2000)
print(classes12.head())
len(classes12)
Out[6]:
In [6]:
bn.saveClasses(yearstart, yearend, param_file, evidence_dir)
In [3]:
class_dir = param_file
exp_plot.plotClassDist(2011, class_dir)
In [5]:
exp_plot.plotClassYearRange(2000, 2005, class_dir)