question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can i train mml-lgb model and loading in local Python?

See original GitHub issue

Code like below

from mmlspark.lightgbm import LightGBMClassifier
model =LightGBMClassifier(boostingType='gbdt',
                          objective='binary',
                          baggingFreq=5,
                          learningRate=0.1,
                          numIterations=50,
                          earlyStoppingRound=10,
                          featuresCol = 'features',
                          categoricalSlotNames = cate_list,
                          numLeaves=30,
                          labelCol="label").fit(train)

model.saveNativeModel(path)

from sklearn.externals import joblib
clf = joblib.load(path) 

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
imatiach-msftcommented, Jun 14, 2021

you can create the python booster from model str: https://github.com/microsoft/LightGBM/issues/2097 model = lgb.Booster({‘model_str’: buf.read().decode(“UTF-8”)}) you can also create the scikit-learn API but it’s not “officially supported”: https://github.com/microsoft/LightGBM/issues/1942

0reactions
RainFungcommented, Jun 17, 2021

Thanks,I finished the project alreday.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Save and Load Machine Learning Models in Python with scikit ...
In this post you will discover how to save and load your machine learning model in Python using scikit-learn. This allows you to...
Read more >
python - Do I need to compile the model again after loading ...
yes. Save your model as .h5. When you want to train your model, load it again and do a model.fit as normal. Make...
Read more >
Save and load models | TensorFlow Core
Model progress can be saved during and after training. This means a model can resume where it left off and avoid long training...
Read more >
Saving and Loading Models (Coding TensorFlow) - YouTube
Training models can take a very long time, and you definitely don't want to have to retrain everything over a single mishap.
Read more >
Save and load models in Tensorflow - GeeksforGeeks
As a result, a model will pick up where it left off to eliminate lengthy training periods. You can still share your model...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found