Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add average_output & objective fields to JSON format #1850

Merged
merged 1 commit into from Nov 23, 2018

Conversation

dmitryikh
Copy link
Contributor

Hi!

I would like to complete JSON format with average_output (bool) and objective (string) fields.
Without these fields it is impossible to restore model behavior from JSON format.

What do you think about this?

@StrikerRUS
Copy link
Collaborator

Hi @dmitryikh !

Sorry for the delay and the inconvenience, but could you please rebase the branch against the latest master with the aim to make CI checks green? Thanks!

@StrikerRUS
Copy link
Collaborator

@guolinke Please take a look.

@dmitryikh
Copy link
Contributor Author

@StrikerRUS , done!

@StrikerRUS StrikerRUS merged commit 9ef85fd into microsoft:master Nov 23, 2018
@StrikerRUS
Copy link
Collaborator

@guolinke Can this be treated as a fix for #1700?
I mean, now we are able to get the objective via dump_model():

import numpy as np
import pandas as pd
import lightgbm as lgb

full_data = pd.DataFrame({'x1': np.random.rand(100),
                          'x2': 5 + np.random.rand(100),
                          'target': np.random.randint(0, 2, 100)})

data_train = lgb.Dataset(full_data.drop(['target'], axis=1), full_data.target)

booster = lgb.train({'objective': 'binary'}, data_train)
booster.dump_model()['objective']
>>> 'binary sigmoid:1'
...

booster = lgb.train({}, data_train)
booster.dump_model()['objective']
>>> 'regression'

@guolinke
Copy link
Collaborator

Yeah, good point.

@lock lock bot locked as resolved and limited conversation to collaborators Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants