8000 Bugfixes in gaussian_process subpackage by dubourg · Pull Request #2632 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

Bugfixes in gaussian_process subpackage #2632

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

Merged
merged 2 commits into from
Aug 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/gaussian_process/gp_diabetes_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
gp.fit(X, y)

# Deactivate maximum likelihood estimation for the cross-validation loop
gp.theta0 = gp.theta # Given correlation parameter = MLE
gp.theta0 = gp.theta_ # Given correlation parameter = MLE
Copy link
Member

Choose a reason for hiding this comment

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

why Given? if it ends with _ then it's estimated more than given no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The trick is I am setting gp.theta0 to the theta_ estimated from the full dataset (first call to fit), and setting thetaL and thetaU to None to force theta_ to remain the same (that's what's called the given case in the fitmethod, grep for it) during the cross-validation.

gp.thetaL, gp.thetaU = None, None # None bounds deactivate MLE

# Perform a cross-validation estimate of the coefficient of determination using
Expand Down
3 changes: 1 addition & 2 deletions sklearn/gaussian_process/gaussian_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,8 @@ def minus_reduced_likelihood_function(log10t):
raise ve

optimal_theta = 10. ** log10_optimal_theta
optimal_minus_rlf_value, optimal_par = \
optimal_rlf_value, optimal_par = \
self.reduced_likelihood_function(theta=optimal_theta)
optimal_rlf_value = - optimal_minus_rlf_value

# Compare the new optimizer to the best previous one
if k > 0:
Expand Down
0