Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Introduced rejection strategies for MC machines
- Loading branch information
Showing
6 changed files
with
126 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Written (W) 2012 Sergey Lisitsyn | ||
* Copyright (C) 2012 Sergey Lisitsyn | ||
*/ | ||
|
||
#ifndef _REJECTIONSTRATEGY_H___ | ||
#define _REJECTIONSTRATEGY_H___ | ||
|
||
namespace shogun | ||
{ | ||
|
||
/** @brief rejection strategy */ | ||
class CRejectionStrategy : public CSGObject | ||
{ | ||
public: | ||
/** default constructor */ | ||
CRejectionStrategy() { }; | ||
|
||
/** destructor */ | ||
virtual ~CRejectionStrategy() { }; | ||
|
||
/** get name */ | ||
virtual const char* get_name() const | ||
{ | ||
return "RejectionStrategy"; | ||
}; | ||
|
||
/** returns true if given output set leads to rejection */ | ||
virtual bool reject(SGVector<float64_t> outputs) const = 0; | ||
|
||
}; | ||
|
||
class CThresholdReject : public CRejectionStrategy | ||
{ | ||
public: | ||
|
||
/** constructor */ | ||
CThresholdReject() : | ||
CRejectionStrategy(), m_threshold(0.0) { }; | ||
|
||
/** constructor */ | ||
CThresholdReject(float64_t threshold) : | ||
CRejectionStrategy(), m_threshold(threshold) { }; | ||
|
||
virtual ~CThresholdReject() {}; | ||
|
||
/** get name */ | ||
virtual const char* get_name() const | ||
{ | ||
return "AllNegativesMulticlassReject"; | ||
} | ||
|
||
/** returns true if given output set leads to rejection */ | ||
virtual bool reject(SGVector<float64_t> outputs) const | ||
{ | ||
for (int32_t i=0; i<outputs.vlen; i++) | ||
{ | ||
if (outputs[i]>m_threshold) | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
protected: | ||
|
||
float64_t m_threshold; | ||
|
||
|
||
}; | ||
} | ||
#endif |