py-earth
py-earth copied to clipboard
Fixing score_samples
This version of score_samples scores each sample on a coordinate-by-coordinate basis.
It follows the internals of scikit-learn's r2_score implementation in that coordinates that have no variance are arbitrarily set to a score of 1. This prevents division by zero and -inf scores.
I've merged this into the branch v0.2dev. Unfortunately, the latest version of scikit-learn's check_estimator test requires that the score_samples method operate on X only, which obviously doesn't make sense for py-earth. So, the score_samples method is currently commented out in that branch until I can figure out the best way to proceed.
If anyone is looking for this functionality now, I would suggest just working directly off of this PR.
Note: this PR was in response to the discussion in issue #182.