アプリ置き場

アプリ置き場

http://www.moreread.net/

LightGBMでモデルの作成と保存と読込方法 (python)

モデルの作成

model = lgb.train(
        params,
        trains,
        valid_sets=valids,
        callbacks=[
            lgb.early_stopping(stopping_rounds=100, verbose=True),
            lgb.log_evaluation(10),
        ],
    )

モデルの保存

model.save_model("model.txt", num_iteration=model.best_iteration)

モデルの読込

model = lgb.Booster(model_file="model.txt")