def save_features(df, data_type='train'): save_path = Path('../configs/feature/all.yml') dh = DataHandler() if not save_path.exists(): save_path.touch() feature_dict = {'features': []} else: feature_dict = dh.load(save_path) new_feature = sorted(set(feature_dict['features'] + df.columns.tolist())) feature_dict['features'] = new_feature dh.save(save_path, feature_dict) for col in df.columns: df[[col]].reset_index(drop=True).to_feather(f'../features/{col}_{data_type}.feather')
seed_everything, send_line) warnings.filterwarnings('ignore') # =============== # Settings # =============== parser = argparse.ArgumentParser() parser.add_argument('--common', default='../configs/common/compe.yml') parser.add_argument('--notify', default='../configs/common/notify.yml') parser.add_argument('-m', '--model') parser.add_argument('-c', '--comment') options = parser.parse_args() dh = DataHandler() cfg = dh.load(options.common) cfg.update(dh.load(f'../configs/exp/{options.model}.yml')) notify_params = dh.load(options.notify) comment = options.comment model_name = options.model now = datetime.datetime.now() run_name = f'{model_name}_{now:%Y%m%d%H%M%S}' logger_path = Path(f'../logs/{run_name}') # =============== # Main # ===============
Kaggle, reduce_mem_usage) warnings.filterwarnings('ignore') # =============== # Settings # =============== parser = argparse.ArgumentParser() parser.add_argument('--common', default='../configs/common/compe.yml') parser.add_argument('--notify', default='../configs/common/notify.yml') parser.add_argument('-m', '--model') parser.add_argument('-c', '--comment') options = parser.parse_args() dh = DataHandler() cfg = dh.load(options.common) cfg.update(dh.load(f'../configs/exp/{options.model}.yml')) notify_params = dh.load(options.notify) features_params = dh.load(f'../configs/feature/{cfg.data.features.name}.yml') features = features_params.features comment = options.comment model_name = options.model now = datetime.datetime.now() if cfg.model.task_type != 'optuna': run_name = f'{model_name}_{now:%Y%m%d%H%M%S}' else: run_name = f'{model_name}_optuna_{now:%Y%m%d%H%M%S}'