-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support One-Versus-One approach (#315)
* Add first version of COneVersusOne Signed-off-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com> * Fix some bugs Signed-off-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com> * Add some tests Signed-off-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com> * Fix Q matrix formula Signed-off-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com> * Fix comment in tests Signed-off-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com> * Remove redundant interface Signed-off-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com> * Add multiclass modes Signed-off-by: FedyuninV <valery.fedyunin@abbyy.com> * Rename MM_SingleTree to MM_SingleClassifier Signed-off-by: FedyuninV <valery.fedyunin@abbyy.com> * Remove copy-paste from COneVersusOneModel::Classify Signed-off-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com> * Add OneVsOne approach to Python wrapper Signed-off-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com> * Add COneVersusOne docs Signed-off-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com> * Mark findProb function as static Signed-off-by: Valeriy Fedyunin <stelz40494@gmail.com> * Fix typo in OneVersusOne.md Signed-off-by: Valeriy Fedyunin <stelz40494@gmail.com> * Add options to MulticlassMode param documentation Signed-off-by: Valeriy Fedyunin <stelz40494@gmail.com> Co-authored-by: Stanislav Angeliuk <59917951+SAngeliuk@users.noreply.github.com> Co-authored-by: NeoML-maintainer <65914319+NeoML-maintainer@users.noreply.github.com>
- Loading branch information
1 parent
76c2e33
commit 853e6f7
Showing
31 changed files
with
684 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
42 changes: 42 additions & 0 deletions
42
NeoML/docs/en/API/ClassificationAndRegression/OneVersusOne.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# One Versus One Classification COneVersusOne | ||
|
||
<!-- TOC --> | ||
|
||
- [One Versus One Classification COneVersusOne](#one-versus-one-classification-coneversusone) | ||
- [Training settings](#training-settings) | ||
- [Model](#model) | ||
- [Classification result](#classification-result) | ||
- [Sample](#sample) | ||
|
||
<!-- /TOC --> | ||
|
||
One vs. one method provides a way to solve a multi-class classification problem using only binary classifiers. | ||
|
||
The original classification problem is represented as a series of binary classification problems, one for each pair of classes, that determine the pairwise probabilities for the object to belong to one class or another. | ||
|
||
Afterfwards the optimal probabilities for each class are found by solving an optimization task, which is described in Section 4 of [this article](https://www.csie.ntu.edu.tw/~cjlin/papers/svmprob/svmprob.pdf). | ||
|
||
In **NeoML** library this method is implemented by the `COneVersusOne` class. It exposes a `Train` method for creating a classification model. | ||
|
||
## Training settings | ||
|
||
The only parameter the algorithm requires is the pointer to the basic binary classification method, represented by an object that implements the [ITrainingModel](TrainingModels.md) interface. | ||
|
||
## Model | ||
|
||
The trained model is an ensemble of binary classification models. It implements the [`IModel` interface](Models.md#for-classification). | ||
|
||
## Classification result | ||
|
||
It provides the standard `Classify` method which writes the result into the given [`CClassificationResult`](README.md#classification-result). | ||
|
||
## Sample | ||
|
||
Here is a simple example of training a one-versus-one model using a linear binary classifier. | ||
|
||
```c++ | ||
CLinear linear( EF_LogReg ); | ||
|
||
COneVersusOne oneVersusOne( linear ); | ||
CPtr<IModel> model = oneVersusOne.Train( *trainData ); | ||
``` |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.