-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Remove nonsensical CLinearMachine::compute_bias #4381
Merged
karlnapf
merged 5 commits into
shogun-toolbox:develop
from
karlnapf:feature/no_compute_bias
Jul 23, 2018
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4786b02
Remove nonsensical CLinearMachine::compute_bias
karlnapf 8862afd
correct bias computation in ridge regression
karlnapf 9102f5a
fix bias computation in linear ridge regression
karlnapf 647ad43
apply autoformater
karlnapf 1727a1a
disable bias as it crashes
karlnapf File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Submodule data
updated
7 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/* | ||
* This software is distributed under BSD 3-clause license (see LICENSE file). | ||
* | ||
* Authors: Soeren Sonnenburg, Sergey Lisitsyn, Chiyuan Zhang, Viktor Gal, | ||
* Abhinav Rai, Youssef Emad El-Din | ||
* Authors: Soeren Sonnenburg, Sergey Lisitsyn, Chiyuan Zhang, Viktor Gal, | ||
* Abhinav Rai, Youssef Emad El-Din, Heiko Strathmann | ||
*/ | ||
#include <shogun/lib/config.h> | ||
|
||
|
@@ -71,13 +71,19 @@ bool CLinearRidgeRegression::train_machine(CFeatures* data) | |
linalg::matrix_prod(feats_matrix, feats_matrix, kernel_matrix, false, true); | ||
linalg::add_diag(kernel_matrix, tau_vector); | ||
|
||
auto labels = ((CRegressionLabels*)m_labels)->get_labels(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: fix indentation of this block to rest of the function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will do autoformat once this works, thx |
||
linalg::matrix_prod(feats_matrix, labels, y); | ||
auto labels = regression_labels(m_labels); | ||
auto lab = regression_labels(m_labels)->get_labels(); | ||
linalg::matrix_prod(feats_matrix, lab, y); | ||
|
||
auto decomposition = linalg::cholesky_factor(kernel_matrix); | ||
y = linalg::cholesky_solver(decomposition, y); | ||
|
||
set_w(y); | ||
|
||
auto x_bar = linalg::colwise_sum(feats_matrix); | ||
linalg::scale(x_bar, x_bar, 1.0 / ((float64_t)x_bar.size())); | ||
auto intercept = linalg::mean(lab) - linalg::dot(lab, x_bar); | ||
set_bias(intercept); | ||
|
||
return true; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary or was implicit include?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary