predict_proba functionality for kNN. Small bugfix. More concise and e…#362
Open
skywardfire1 wants to merge 1 commit intosmartcorelib:developmentfrom
Open
predict_proba functionality for kNN. Small bugfix. More concise and e…#362skywardfire1 wants to merge 1 commit intosmartcorelib:developmentfrom
skywardfire1 wants to merge 1 commit intosmartcorelib:developmentfrom
Conversation
…xact computation. Many tests.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development #362 +/- ##
===============================================
- Coverage 45.59% 44.35% -1.24%
===============================================
Files 93 95 +2
Lines 8034 8017 -17
===============================================
- Hits 3663 3556 -107
- Misses 4371 4461 +90 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds:
let mut max_c = 0f64. If something went wrong, the result will always be a "class 0". Now correctly initializes with the first computed probability.predict_for_rowis now a thin wrapper around predict_proba_for_row, the latter is somewhat of "main routine" for 2 or 3 functions, so we avoid repeating the code.predict_probafunctionality for kNN. Returns class probability distributions for input samples. Works with both search algorithms.predict()andpredict_proba()kvalues, multiclass labelsUniformandDistanceweightingI also made a real world test.
This is the predictions of a prev functionality
Those are new ones
Pls note, that they are not identical. What we should also remember is that every result shown is actually a result of 18 kNN models voting, where every one kNN model is created using smartcore.
The difference, in my opinion, comes from float computing issues. And I did my research to ensure our new kNN realization is slightly more concise and exact. I have made some computations more mathematically correct.