8000 [MRG] Handle warnings by betatim · Pull Request #222 · scikit-optimize/scikit-optimize · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

[MRG] Handle warnings #222

Merged
merged 4 commits into from
Sep 16, 2016
Merged

[MRG] Handle warnings #222

merged 4 commits into from
Sep 16, 2016

Conversation

betatim
Copy link
Member
@betatim betatim commented Sep 12, 2016

Fixes #221

Remove deprecation warnings by changing our scoring parameter
names.

Try and handle the warning from matplotlib about building the
font cache.

@betatim
Copy link
Member Author
betatim commented Sep 12, 2016

Is there a way to see the output of the notebooks from the circle CI run?

Reproducing the matplotlib warning locally will be tricky as you only see if the very first time you import matplotlib.

@codecov-io
Copy link
codecov-io commented Sep 12, 2016

Current coverage is 81.83% (diff: 100%)

Merging #222 into master will not change coverage

@@             master       #222   diff @@
==========================================
  Files            18         18          
  Lines           892        892          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits            730        730          
  Misses          162        162          
  Partials          0          0          

Powered by Codecov. Last update 6655873...7c0bbed

@betatim
Copy link
Member Author
betatim commented Sep 13, 2016

Voila: https://circleci.com/gh/scikit-optimize/scikit-optimize/100#artifacts/containers/0 how cool is that? If we made the links relative you could navigate the whole website for the build. Tres cool.

Unfortunately it seems to suggest that the warnings are still there. 😕

@@ -43,6 +43,10 @@ export SKOPT_HOME=$(pwd)
conda install --yes jupyter
pip install pdoc==0.3.2 pygments

# importing matplotlib once builds the font caches. This avoids
# having warnings in our example notebooks
python -c "import matplotlib.pyplot as plt"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever! 🐘

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old 🐶 new trick 😄

Remove deprecation warnings by changing our scoring parameter
names.

Try and handle the warning from matplotlib about building the
font cache.
Importing matplotlib for the first time creates warnings about
the font cache. To avoid those appearing in our example notebooks
we import it before running the notebooks
@betatim
Copy link
Member Author
betatim commented Sep 13, 2016

@betatim betatim changed the title Handle warnings [MRG] Handle warnings Sep 13, 2016
@glouppe
Copy link
Member
glouppe commented Sep 13, 2016

Hmm, look at the last plot. What happened? bad initial random state?

@betatim
Copy link
Member Author
betatim commented Sep 13, 2016

Good question. I can reproduce it locally.

# Plot GP(x) + concours
gp = res.models[12]
y_pred, sigma = gp.predict(x, return_std=True)

gives a flat prediction, but gp = res.models[11] still works:
image

but already looks a bit weird. Something strange about the kernel we use?

@betatim
Copy link
Member Author
betatim commented Sep 13, 2016

From looking at commits related to the kernel choice the only idea I have is #209 ?

@MechCoder
Copy link
Member

Uggh. not sure what I broke :/

@MechCoder
Copy link
Member

I figured out the bug. Thinking of an efficient way to fix it.

@MechCoder
Copy link
Member
MechCoder commented Sep 16, 2016

The fix is more subtle, decribed as TODO item no 2 in #225. (and may or may not have a huge impact) However, the bottom line is that you need more samples such that the noise prediction becomes stabilized. A better function approximation is obtained after 50 iterations (or even before around 25). Here is a plot of the attribute noise from #225 . I am truly amazed at how the GP picks up the variance!
noise

@betatim
Copy link
Member Author
betatim commented Sep 16, 2016

I will try and make a summary to see if I understand what is happening: the kernel has a parameter that represents the amount of noise (the np.random.randn() * noise_level term in the toy model). The value of this parameter is plotted in your plot (is the x axis number of samples or number of models?). For the first few iterations there aren't enough samples to really set that parameter to a good value. Then at 15 it suddenly picks up on it (noise ~ 0.025) and by the time we get to ~55 iterations it is tuned to the "true" value.

I don't quite understand why it causes the prediction (mean of the GP) to become flat in the example though.

@betatim
Copy link
Member Author
betatim commented Sep 16, 2016

Another question: should we merge this with the justification that this was already a problem before this PR and is being addressed in #225?

@glouppe
Copy link
Member
glouppe commented Sep 16, 2016

Yes we can merge this now

@glouppe glouppe merged commit d84600e into scikit-optimize:master Sep 16, 2016
@betatim betatim deleted the nowarnings branch September 16, 2016 11:58
@MechCoder
Copy link
Member

@betatim Yes, that is right. My assumption is that the prediction is wrong because keeping the noise term (or the WhiteKernel) at prediction time gives an estimate of y, (that is f(x) with the noise) while we would like to model just f(x)

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.

4 participants
0