Skip to content
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

Merged

Conversation

LiuYuHui
Copy link
Contributor

@LiuYuHui LiuYuHui commented Jun 4, 2020

No description provided.

src/shogun/machine/Machine.h Outdated Show resolved Hide resolved
src/shogun/machine/Machine.h Outdated Show resolved Hide resolved
src/shogun/machine/Machine.h Outdated Show resolved Hide resolved
src/shogun/machine/Machine.h Outdated Show resolved Hide resolved
@gf712
Copy link
Member

gf712 commented Jun 4, 2020

Cool! I think this pretty much what we discussed @vigsterkr and @karlnapf? Just had some minor comments

const std::shared_ptr<Features>& data, const std::shared_ptr<Labels>& lab)
{
require(data, "Features not set!");
require(lab, "Labels not set!");
Copy link
Member

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 ...

@gf712
Copy link
Member

gf712 commented Jun 5, 2020

@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

@gf712 gf712 changed the base branch from develop to feature/machine_refactor June 6, 2020 11:46
}

const auto result_iter = std::min_element(dists.begin(), dists.end());
index_t best_index = std::distance(result_iter, dists.begin());
Copy link
Member

Choose a reason for hiding this comment

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

Nice!

src/shogun/machine/DistanceMachine.cpp Outdated Show resolved Hide resolved
src/shogun/machine/DistanceMachine.cpp Outdated Show resolved Hide resolved
@@ -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);
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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>

Copy link
Member

Choose a reason for hiding this comment

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

After this

%shared_ptr(shogun::DistanceMachine)
%shared_ptr(shogun::IterativeMachine<LinearMachine>)

%include <shogun/machine/NonParametricMachine.h>
Copy link
Member

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

@karlnapf
Copy link
Member

looks good so far!

@gf712
Copy link
Member

gf712 commented Jun 12, 2020

Shall we merge this and split things into smaller PRs? This is currently based on the feature branch

@gf712 gf712 merged commit 1c95f53 into shogun-toolbox:feature/machine_refactor Jun 15, 2020
LiuYuHui added a commit to LiuYuHui/shogun that referenced this pull request Jun 16, 2020
* add nonparametric machine
* fix notebooks
gf712 pushed a commit that referenced this pull request Jun 17, 2020
* add nonparametric machine
* fix notebooks
gf712 pushed a commit that referenced this pull request Jun 17, 2020
* add nonparametric machine
* fix notebooks
gf712 pushed a commit that referenced this pull request Jun 17, 2020
* add nonparametric machine
* fix notebooks
gf712 pushed a commit that referenced this pull request Jun 18, 2020
* add nonparametric machine
* fix notebooks
gf712 pushed a commit that referenced this pull request Jun 18, 2020
* add nonparametric machine
* fix notebooks
LiuYuHui added a commit to LiuYuHui/shogun that referenced this pull request Jun 18, 2020
* add nonparametric machine
* fix notebooks
gf712 pushed a commit that referenced this pull request Jul 6, 2020
* add nonparametric machine
* fix notebooks
gf712 pushed a commit that referenced this pull request Jul 28, 2020
* add nonparametric machine
* fix notebooks
LiuYuHui added a commit to LiuYuHui/shogun that referenced this pull request Jul 29, 2020
* add nonparametric machine
* fix notebooks
LiuYuHui added a commit to LiuYuHui/shogun that referenced this pull request Jul 30, 2020
* add nonparametric machine
* fix notebooks
LiuYuHui added a commit to LiuYuHui/shogun that referenced this pull request Jul 30, 2020
* add nonparametric machine
* fix notebooks
gf712 pushed a commit that referenced this pull request Jul 31, 2020
* Add NonParametricMachine class (#5055)
* add nonparametric machine
* fix notebooks
* Refactor NearestCentroid class
gf712 pushed a commit that referenced this pull request Dec 8, 2020
* add nonparametric machine
* fix notebooks
gf712 pushed a commit that referenced this pull request Dec 8, 2020
* Add NonParametricMachine class (#5055)
* add nonparametric machine
* fix notebooks
* Refactor NearestCentroid class
gf712 pushed a commit that referenced this pull request Dec 8, 2020
* add nonparametric machine
* fix notebooks
gf712 pushed a commit that referenced this pull request Dec 8, 2020
* Add NonParametricMachine class (#5055)
* add nonparametric machine
* fix notebooks
* Refactor NearestCentroid class
gf712 pushed a commit that referenced this pull request Dec 8, 2020
* add nonparametric machine
* fix notebooks
gf712 pushed a commit that referenced this pull request Dec 8, 2020
* Add NonParametricMachine class (#5055)
* add nonparametric machine
* fix notebooks
* Refactor NearestCentroid class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants