Ejemplo n.º 1
0
import logging
import os

import tensorflow as tf

import seaborn as sns
sns.set()

ROOT_FOLDER = configs.ROOT_FOLDER
MODEL_ROOT = configs.MODEL_ROOT

expt_name = "treatment_effects"

# EDIT ME ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Specify parameters for model to load - optimal set from paper listed
action_inputs_only = configs.load_optimal_parameters(
    'treatment_rnn_action_inputs_only', expt_name, add_net_name=True)
action_w_trajectory_inputs = configs.load_optimal_parameters('treatment_rnn',
                                                             expt_name,
                                                             add_net_name=True)
censor_w_action_inputs_only = configs.load_optimal_parameters(
    'censor_rnn_action_inputs_only', expt_name, add_net_name=True)
censor_w_trajectory_inputs = configs.load_optimal_parameters('censor_rnn',
                                                             expt_name,
                                                             add_net_name=True)

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if __name__ == "__main__":

    logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
Ejemplo n.º 2
0
ROOT_FOLDER = configs.ROOT_FOLDER
MODEL_ROOT = configs.MODEL_ROOT
RESULTS_FOLDER = configs.RESULTS_FOLDER
expt_name = "treatment_effects"

logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)

# EDIT ME! ######################################################################################
# Defines specific parameters to train for - otherwise runs full hyperparameter optimisation
decoder_specifications = {}

# Optimal encoder to load for decoder training
# - This allows for states from the encoder to be dumped, and decoder is intialised with them
encoder_specifications = {
    'rnn_propensity_weighted':
    configs.load_optimal_parameters('rnn_propensity_weighted', expt_name)
}

# Specify which networks to train - only use R-MSN by default. Full list in activation map
net_names = ['rnn_propensity_weighted']

##################################################################################################


# Data processing Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def process_seq_data(
        data_map,
        states,
        projection_horizon=5,
        num_features_to_include=1e6):  # forecast 10 years into the future
    def _check_shapes(array1, array2, dims):
Ejemplo n.º 3
0
import seaborn as sns
sns.set()

ROOT_FOLDER = configs.ROOT_FOLDER
MODEL_ROOT = configs.MODEL_ROOT
RESULTS_FOLDER = configs.RESULTS_FOLDER

# Default params:
expt_name = "treatment_effects"

# EDIT ME! ######################################################################################
# Optimal network parameters to load for testing!
configs = [
configs.load_optimal_parameters('rnn_propensity_weighted',
                                 expt_name,
                                 add_net_name=True)
          ]

##################################################################################################


if __name__ == "__main__":

    logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)

    # Setup tensorflow
    tf_device = 'gpu'
    if tf_device == "cpu":
        tf_config = tf.ConfigProto(log_device_placement=False, device_count={'GPU': 0})
    else: