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

NeuralNet's history API #496

Open
thomasjpfan opened this issue Jul 21, 2019 · 4 comments
Open

NeuralNet's history API #496

thomasjpfan opened this issue Jul 21, 2019 · 4 comments
Projects

Comments

@thomasjpfan
Copy link
Member

Two API questions:

  1. Should history be in __init__? This seems to be used for continue training. One would need to pass in an initialized module, criterion, optimizer, history, and set warm_start=True.
  2. Should history be stored as history_?
@BenjaminBossan
Copy link
Collaborator

1. Should `history` be in `__init__`? This seems to be used for continue training.

I believe the main reason it is in __init__ is for some sklearn compatibility thing. If we wanted to allow passing a history object, we should change initialize_history. However, we already have load_params(f_history=...), maybe one way is enough.

2. Should `history` be stored as `history_`?

We thought about this at the beginning but decided that history is accessed often enough that the underscore could be annoying. I guess there's no harm in leaving it as is.

@thomasjpfan
Copy link
Member Author

I believe the main reason it is in init is for some sklearn compatibility thing.

It is a little strange. Since initialize_history just creates a new History object, I can not see a use case for passing history into __init__.

We thought about this at the beginning but decided that history is accessed often enough that the underscore could be annoying. I guess there's no harm in leaving it as is.

There is no harm. It is very "scikit-learn" to have learnt attributes be stored with an underscore. I was considering adding a @property to define a history_ that returns `history. (or the other way around).

@BenjaminBossan
Copy link
Collaborator

It is a little strange. Since initialize_history just creates a new History object, I can not see a use case for passing history into __init__.

There is a check in sklearn's clone that parameters are consistent after cloning (I would add a link but github is down). This check can fail when history is not set during __init__.

With the naming of history vs history_, I think we should just leave it as is as long as it doesn't create any major problems.

@thomasjpfan
Copy link
Member Author

There is a check in sklearn's clone that parameters are consistent after cloning

This could be because we are defined _get_param_names to be self.__dict__.keys() which includes all attributes.

Traditionally sklearn's clone creates a copy of the estimator with only its hyper-parameters and non of its learnt attributes.

With the naming of history vs history_, I think we should just leave it as is as long as it doesn't create any major problems.

I am okay with this.

@ottonemo ottonemo added this to To do in 0.8.0 via automation Oct 10, 2019
@ottonemo ottonemo moved this from To do to To discuss in 0.8.0 Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.8.0
  
To discuss
Development

No branches or pull requests

2 participants