shogun-toolbox / shogun

Shōgun
http://shogun-toolbox.org
BSD 3-Clause "New" or "Revised" License
3.03k stars 1.04k forks source link

Machine object should return a reference to themselves #5139

Open gf712 opened 3 years ago

gf712 commented 3 years ago

Machine object should return a reference to themselves (like in sklearn)

auto machine = pipeline->over(std::make_shared<NormOne>())
                                       ->composite()
                                              ->over(std::make_shared<MulticlassLibLinear>())
                                  ->over(std::make_shared<MulticlassOCAS>())
                                    ->then(std::make_shared<MeanRule>());

machine->train(train_feats, train_labels);
auto pred = machine->apply_multiclass(test_feats);

should be simply

auto pred = pipeline->over(std::make_shared<NormOne>())
                                 ->composite()
                                          ->over(std::make_shared<MulticlassLibLinear>())
                                      ->over(std::make_shared<MulticlassOCAS>())
                             ->then(std::make_shared<MeanRule>())
                                 ->train(train_feats, train_labels)
                                 ->apply_multiclass(test_feats);

This should be a simple fix in Machine::train signature, but it might break some code..

sgayangi commented 3 years ago

Hey, I would like to work on this issue :) This is my first contribution so would it be ok if I fix one file and commit it just to make sure it doesn't break any code?

jonpsy commented 3 years ago

@gf712 This issue seems stale, shall I take it up? I've already done 80% of the work. Some unit tests and integration tests are failing that's all.

gf712 commented 3 years ago

@jonpsy great! If you start a PR I can have a look.

Jia1018 commented 3 years ago

Hello everyone. I am a student at the University of Chinese Academy of Sciences, and I am interested in this project. As a newcomer I would like to do something for the communinty, and I noticed that this issue with a "good first issue" label. I am interested in the current status of this issue. Were there any changes? What can I do for now?

jonpsy commented 3 years ago

@Jia1018 I've already made the changes in my PR. If you want, you can copy my PR and modify it a bit to answer the build failure. I'll close my PR when you send yours.

Jia1018 commented 3 years ago

@jonpsy ok, thanks a lot! I'll have a try.

rajpratyush commented 3 years ago

@Jia1018 if this issue is still open I owuld like to give it a shot. I have experience in ml and also practice on Kaggle

ankit0806 commented 1 year ago

I would like to work on this issue if it is still open. I have experience in ML and Data Science.