def test_time_series_observation(self): def week_agg(date): return date.year, date.isocalendar()[1] def month_agg(date): return date.year, date.month ob = rnnmed.data.io.read_time_series_observation( open("/mnt/veracrypt1/EHR_DATA/L270-90-raw-measurements.csv"), min_sparsity=0.1) import random random.seed(10) random.shuffle(ob) n_visits = 10 generator = observations.time_observation_generator(ob, n_visits=n_visits) print(len(ob), ob.n_features) from rnnmed.visit2visit import visit2visit visit2visit(generator, n_features=ob.n_features, n_labels=ob.n_labels, n_timesteps=n_visits, n_hidden=128, max_iter=1000)
def test_med_2_vec_predict(self): observations = rnnmed.data.io.read_labeled_observations( "test_data/mimic_demo.seq") generator = ob.time_observation_generator(observations, n_visits=15) np.set_printoptions(suppress=True) visit2visit.visit2visit(generator, n_labels=observations.n_labels, n_features=observations.n_features, n_timesteps=15, transform=None)
def test_time_series(self): import random timeseries = rnnmed.data.io.read_time_series( open("test_data/synthetic_control.txt")) random.shuffle(timeseries) print(timeseries[0]) generator = ts.timeseries_generator(timeseries) # x, y = rnnmed.data.generate_time_batch(generator, batch_size=5) np.set_printoptions(suppress=True) visit2visit.visit2visit(generator, n_features=timeseries.n_dimensions, n_timesteps=timeseries.n_timesteps, n_labels=timeseries.n_labels, n_hidden=128, max_iter=10000)