def train_gpmcc_chain(num_points=100, num_states=1, num_transitions = 100, save_out=True):
    data = simulate_chain(num_points, rng = np.random.RandomState(0))
    start_time = time.time()
    engine = Engine(data, ['normal','normal','normal'], num_states=num_states, initialize=1)
    engine.transition(N=num_transitions, do_progress=True, do_plot=False)
    train_time = time.time() - start_time
    engine.num_points = num_points
    engine.num_transitions = num_transitions
    engine.data = data
    if save_out:
        file_engine = file('resources/eng_chain_pnts%d_stats%d_trans%d.pkl' % (num_points, num_states, num_transitions),'wb')
        file_data_time =file('resources/data_time_chain_pnts%d_stats%d_trans%d.pkl' % (num_points, num_states, num_transitions),'wb') 
        engine.to_pickle(file_engine)
        pickle.dump([data, train_time],file_data_time)
    return engine, data, train_time
def load_gpmcc_chain(num_points=100, num_states=1, num_transitions = 100):
    file_engine = file('resources/eng_chain_pnts%d_stats%d_trans%d.pkl' % (num_points, num_states, num_transitions),'rb')
    file_data_time =file('resources/data_time_chain_pnts%d_stats%d_trans%d.pkl' % (num_points, num_states, num_transitions),'rb') 
    engine = Engine.from_pickle(file_engine)
    data, train_time = pickle.load(file_data_time)
    return engine, data, train_time