-
-
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
Add NonParametricMachine class #5055
Add NonParametricMachine class #5055
Conversation
Cool! I think this pretty much what we discussed @vigsterkr and @karlnapf? Just had some minor comments |
src/shogun/machine/Machine.cpp
Outdated
const std::shared_ptr<Features>& data, const std::shared_ptr<Labels>& lab) | ||
{ | ||
require(data, "Features not set!"); | ||
require(lab, "Labels not set!"); |
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.
minor: This should read "No labels provided" as it refers to the arguments, not the members ...
@LiuYuHui could you push to https://github.com/shogun-toolbox/shogun/tree/feature/machine_refactor instead? Same with the KNN PR and all the machine refactor |
1aed72f
to
fd7bc34
Compare
} | ||
|
||
const auto result_iter = std::min_element(dists.begin(), dists.end()); | ||
index_t best_index = std::distance(result_iter, dists.begin()); |
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.
Nice!
@@ -71,6 +71,11 @@ bool Machine::train(std::shared_ptr<Features> data) | |||
return result; | |||
} | |||
|
|||
bool Machine::train(const std::shared_ptr<Features>& data, const std::shared_ptr<Labels>& lab){ | |||
set_labels(lab); |
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.
I think like this is fine for now!
#![create_instance] | ||
|
||
#![train_and_apply] | ||
knn.train() | ||
knn.train(features_train, labels_train) |
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.
I think this API is much better
@@ -9,4 +9,5 @@ SHARED_RANDOM_INTERFACE(shogun::Machine) | |||
%shared_ptr(shogun::LinearMachine) | |||
%shared_ptr(shogun::DistanceMachine) | |||
%shared_ptr(shogun::IterativeMachine<LinearMachine>) | |||
%shared_ptr(shogun::NonParametricMachine) |
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.
You also need to include %include <shogun/machine/NonParametricMachine.h>
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.
After this
src/interfaces/swig/Machine.i
Outdated
%shared_ptr(shogun::DistanceMachine) | ||
%shared_ptr(shogun::IterativeMachine<LinearMachine>) | ||
|
||
%include <shogun/machine/NonParametricMachine.h> |
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.
So from the output of azure pipelines it seems like this has to come after %include <shogun/machine/Machine.h>
, so you'll have to find all the places with this line, and add %include <shogun/machine/NonParametricMachine.h>
after that
8f6aa76
to
05eb781
Compare
looks good so far! |
Shall we merge this and split things into smaller PRs? This is currently based on the feature branch |
* add nonparametric machine * fix notebooks
* add nonparametric machine * fix notebooks
* add nonparametric machine * fix notebooks
* add nonparametric machine * fix notebooks
* add nonparametric machine * fix notebooks
* add nonparametric machine * fix notebooks
* add nonparametric machine * fix notebooks
* add nonparametric machine * fix notebooks
* add nonparametric machine * fix notebooks
* add nonparametric machine * fix notebooks
* add nonparametric machine * fix notebooks
* add nonparametric machine * fix notebooks
* Add NonParametricMachine class (#5055) * add nonparametric machine * fix notebooks * Refactor NearestCentroid class
* add nonparametric machine * fix notebooks
* Add NonParametricMachine class (#5055) * add nonparametric machine * fix notebooks * Refactor NearestCentroid class
* add nonparametric machine * fix notebooks
* Add NonParametricMachine class (#5055) * add nonparametric machine * fix notebooks * Refactor NearestCentroid class
* add nonparametric machine * fix notebooks
* Add NonParametricMachine class (#5055) * add nonparametric machine * fix notebooks * Refactor NearestCentroid class
No description provided.