Browse Source

处理用户模型

罗俊辉 1 year ago
parent
commit
9919906360
1 changed files with 17 additions and 17 deletions
  1. 17 17
      main_spider.py

+ 17 - 17
main_spider.py

@@ -204,20 +204,20 @@ class LightGBM(object):
 
 
 if __name__ == "__main__":
-    i = int(input("输入 1 训练, 输入 2 预测:\n"))
-    if i == 1:
-        f = "train"
-        dt = "whole"
-        L = LightGBM(flag=f, dt=dt)
-        L.train_model()
-    elif i == 2:
-        f = "predict"
-        dt = int(input("输入日期, 16-21:\n"))
-        L = LightGBM(flag=f, dt=dt)
-        # L.evaluate_model()
-        L.feature_importance()
-    # L = LightGBM("train", "whole")
-    # study = optuna.create_study(direction=clear'maximize')
-    # study.optimize(L.bays_params, n_trials=100)
-    # print('Number of finished trials:', len(study.trials))
-    # print('Best trial:', study.best_trial.params)
+    # i = int(input("输入 1 训练, 输入 2 预测:\n"))
+    # if i == 1:
+    #     f = "train"
+    #     dt = "whole"
+    #     L = LightGBM(flag=f, dt=dt)
+    #     L.train_model()
+    # elif i == 2:
+    #     f = "predict"
+    #     dt = int(input("输入日期, 16-21:\n"))
+    #     L = LightGBM(flag=f, dt=dt)
+    #     # L.evaluate_model()
+    #     L.feature_importance()
+    L = LightGBM("train", "whole")
+    study = optuna.create_study(direction=clear'maximize')
+    study.optimize(L.bays_params, n_trials=100)
+    print('Number of finished trials:', len(study.trials))
+    print('Best trial:', study.best_trial.params)