config.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. class DefaultConfig(dict):
  2. def __init__(self):
  3. # ------------ 数据路径 ------------
  4. self['data_dir'] = '../../MOBIKE_CUP_2017'
  5. self['train_csv'] = self['data_dir'] + '/train.csv'
  6. self['test_csv'] = self['data_dir'] + '/test.csv'
  7. self['cache_dir'] = '../cache'
  8. self['model_dir'] = '../snapshot'
  9. self['result_dir'] = '../result'
  10. # ------------ 训练参数 --------
  11. self['startday'] = 23
  12. self['endday'] = 25
  13. self['lgb_leaves'] = 96
  14. self['lgb_lr'] = 0.05
  15. # ------------ 测试参数 --------
  16. self['test_startday'] = 25
  17. self['test_endday'] = 26
  18. self['model_name'] = None
  19. # -------- 是否有用户 --------
  20. self['user'] = True
  21. def update(self, **kwargs):
  22. for key in kwargs:
  23. self[key] = kwargs[key]
  24. self['time_prefix'] = '2017-05-'
  25. self['time_suffix'] = ' 00:00:00'
  26. self['starttime'] = '2017-05-' + str(self['startday']) + ' 00:00:00'
  27. self['endtime'] = '2017-05-' + str(self['endday']) + ' 00:00:00'
  28. self['test_starttime'] = '2017-05-' + str(self['test_startday']) + ' 00:00:00'
  29. self['test_endtime'] = '2017-05-' + str(self['test_endday']) + ' 00:00:00'
  30. def printf(self):
  31. print('Current Config:')
  32. for key in self:
  33. print('{}: {}'.format(key, self[key]))