from src import util_funcs from src.explore import plot_funcs from src.explore.signatures import sig_models, sig_model_runners from src.explore.theme_setup import data_path, logs_path, weights_path from src.explore.theme_setup import generate_theme # load data and prep df_20 = pd.read_feather(data_path / 'df_20.feather') df_20 = df_20.set_index('id') X_raw, distances, labels = generate_theme(df_20, 'all_towns', bandwise=True, max_dist=800) X_trans = StandardScaler().fit_transform(X_raw) test_idx = util_funcs.train_test_idxs(df_20, 200) # 200 gives about 25% # setup paramaters epochs = 5 batch = 256 theme_base = f'VAE_e{epochs}' n_d = len(distances) split_input_dims = (int(2 * n_d), int(9 * n_d), int(2 * n_d)) split_latent_dims = (4, 6, 2) split_hidden_layer_dims = ([24, 24, 24], [32, 32, 32], [8, 8, 8]) latent_dim = 6 lr = 1e-3 # seed = 0 # beta = 4 # cap = 12 for seed in range(10):
from src.explore import plot_funcs from src.explore.theme_setup import data_path, logs_path, weights_path from src.explore.theme_setup import generate_theme # %% # load data and prep df_20 = pd.read_feather(data_path / 'df_20.feather') df_20 = df_20.set_index('id') # generate theme X_raw, distances, labels = generate_theme(df_20, 'pred_lu', bandwise=True) # transform X X_trans_all = StandardScaler().fit_transform(X_raw).astype(np.float32) # get y y_all = df_20['ac_eating_400'].values # test split - use spatial splitting - 300 modulo gives about 11% xy_test_idx = util_funcs.train_test_idxs(df_20, 300) X_trans_train = X_trans_all[~xy_test_idx] X_trans_test = X_trans_all[xy_test_idx] y_train = y_all[~xy_test_idx] y_test = y_all[xy_test_idx] # validation split - 200 modulo gives about 25% xy_val_idx = util_funcs.train_test_idxs(df_20[~xy_test_idx], 200) X_trans_val = X_trans_train[ xy_val_idx] # do first before repurposing variable name X_trans_train = X_trans_train[~xy_val_idx] y_val = y_train[xy_val_idx] # do first before repurposing variable name y_train = y_train[~xy_val_idx] # %% epochs = 100 reg = pred_models.LandUsePredictor(theme_base=f'eating_e{epochs}')