Example #1
0
 def tspots_seqs():
   return (ttob_seq for date in dates
              for ttob_seq in getDayTSpots(data_source['feed'],
                                                   basic_geometry['nid'],
                                                   date,
                                                   basic_geometry['net_type'],
                                                   basic_geometry['box'],
                                                   net))
  save_ttg_structure(tt_graph, experiment_name=experiment_name)
  # The TTG structure is required when loading the GMRF (and the GMRF estimators)
  # Make sure they are saved in all the directories
  save_ttg_structure(tt_graph_one_mode, experiment_name='{0}_one_mode'.format(experiment_name))
  save_ttg_structure(tt_graph_one_mode, experiment_name='{0}_one_mode_indep'.format(experiment_name))
  save_ttg_structure(tt_graph, experiment_name='{0}_indep'.format(experiment_name))


  # Loading the learning data

  data_source = experiment_design['data_source']
  dates = data_source['dates']
  basic_geometry = experiment_design['basic_geometry']
  tspots_seqs = [ttob_seq for date in dates
               for ttob_seq in getDayTSpots(date,net)]
  traj_obs = [traj_ob for tspots_seq in tspots_seqs
                      for traj_ob in traj_conv.mapTrajectory(tspots_seq, **traj_conv_param)]
  traj_obs_one_mode = [traj_ob for tspots_seq in tspots_seqs
                      for traj_ob in traj_conv_one_mode.mapTrajectory(tspots_seq, **traj_conv_param)]


  gmrf_learning = experiment_design['gmrf_learning']
  fillTTGraph(tt_graph, traj_obs, **gmrf_learning['tt_graph_parameters'])
  fillTTGraph(tt_graph_one_mode, traj_obs_one_mode, **gmrf_learning['tt_graph_parameters'])

  # CHECKPOINT HERE: SAVE TT GRAPH Values
  save_ttg_values(tt_graph, experiment_name=experiment_name)
  save_ttg_values(tt_graph_one_mode, experiment_name='{0}_one_mode'.format(experiment_name))

  var_seqs = [[obs.varId for obs in traj_ob.observations] for traj_ob in traj_obs]
import validation_paths as vp
from mm.arterial_hkt.pipeline_script_1 import experiment_design, createTrajectoryConversion
from mm.data import get_network
from mm.arterial_hkt.pipeline_functions import getDayTSpots

design = experiment_design
basic_geometry = design['basic_geometry']
net = get_network(**basic_geometry)
graph_type=design['graph_type']
traj_conv = createTrajectoryConversion(graph_type=design['graph_type'],
                                            process=design['trajectory_conversion']['process'],
                                            params=design['trajectory_conversion']['params'],
                                            network=net)
data_source = design['data_source']
dates = design['data_source']['dates']
basic_geometry = design['basic_geometry']
tspots_seqs = [ttob_seq for date in dates 
               for ttob_seq in getDayTSpots(data_source['feed'], 
                                                    basic_geometry['nid'],
                                                    date, 
                                                    basic_geometry['net_type'],
                                                    basic_geometry['box'], 
                                                    net)]
traj_obs = [traj_ob for tspots_seq in tspots_seqs 
                      for traj_ob in traj_conv.mapTrajectory(tspots_seq)]


param = design['evaluation']
nb_obs_per_path = vp.number_measurements_per_path(traj_obs, net, debug=True, **param)
validation_paths = vp.select_validation_paths(traj_obs, nb_obs_per_path, debug=True, **param)
val_data = vp.select_validation_data_given_paths(traj_obs, validation_paths, debug=True)