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

Ordinale Conditions separat speichern #768

Merged
merged 22 commits into from
Aug 13, 2023
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4338515
Rename arguments, class members, etc. that refer to conditions.
michael-rapp Aug 8, 2023
0aded8c
Rename values of the enum Comparator.
michael-rapp Aug 8, 2023
0bbfd67
Merge branch 'development' into store-ordinal-conditions-separately
michael-rapp Aug 8, 2023
ebc6256
Merge branch 'development' into store-ordinal-conditions-separately
michael-rapp Aug 13, 2023
a069b91
The class CompleteHead now uses a DenseVector.
michael-rapp Aug 13, 2023
e4b9b22
Export class SparseArrayVector.
michael-rapp Aug 13, 2023
0d89a5e
Do not export class SparseArrayVector.
michael-rapp Aug 13, 2023
8015c7e
The class PartialHead now uses DenseVectors.
michael-rapp Aug 13, 2023
989b4de
Add class SparseArraysVector.
michael-rapp Aug 13, 2023
01aac76
The class PartialHead now uses a SparseArraysVector.
michael-rapp Aug 13, 2023
31a21e9
Rename class member.
michael-rapp Aug 13, 2023
4ecabc4
Export class SparseArraysVector.
michael-rapp Aug 13, 2023
9d72ab3
Edit comment.
michael-rapp Aug 13, 2023
7eb66d6
The class SparseArraysVector is not final anymore.
michael-rapp Aug 13, 2023
c9f171b
Add class IConditional.
michael-rapp Aug 13, 2023
42d0e94
The class ConjunctiveBody now uses SparseArraysVectors.
michael-rapp Aug 13, 2023
0e10c4d
The class ConjunctiveBody now stores ordinal conditions separately.
michael-rapp Aug 13, 2023
7ae02fa
Consider ordinal conditions for the output of models or model charact…
michael-rapp Aug 13, 2023
c7f6e12
Add function "isOrdinal" to class IFeatureType.
michael-rapp Aug 13, 2023
2e0b505
Format code.
michael-rapp Aug 13, 2023
daa6752
Format code.
michael-rapp Aug 13, 2023
5429468
Use appropriate conditions if a feature is nominal.
michael-rapp Aug 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add class IConditional.
michael-rapp committed Aug 13, 2023
commit c9f171bd7ccd3741f44ade0d9715072f9979e5bd
40 changes: 24 additions & 16 deletions cpp/subprojects/common/include/mlrl/common/model/body.hpp
Original file line number Diff line number Diff line change
@@ -14,26 +14,15 @@ class EmptyBody;
class ConjunctiveBody;

/**
* Defines an interface for all classes that represent the body of a rule.
* Defines an interface for all classes that allow to check whether an example is covered or not.
*/
class MLRLCOMMON_API IBody {
class MLRLCOMMON_API IConditional {
public:

virtual ~IBody() {};

/**
* A visitor function for handling objects of the type `EmptyBody`.
*/
typedef std::function<void(const EmptyBody&)> EmptyBodyVisitor;

/**
* A visitor function for handling objects of the type `ConjunctiveBody`.
*/
typedef std::function<void(const ConjunctiveBody&)> ConjunctiveBodyVisitor;
virtual ~IConditional() {};

/**
* Returns whether an individual example, which is stored in a C-contiguous matrix, is covered by the body or
* not.
* Returns whether an individual example, which is stored in a C-contiguous matrix, is covered or not.
*
* @param begin A `VectorConstView::const_iterator` to the beginning of the example's feature values
* @param end A `VectorConstView::const_iterator` to the end of the example's feature values
@@ -43,7 +32,7 @@ class MLRLCOMMON_API IBody {
VectorConstView<const float32>::const_iterator end) const = 0;

/**
* Returns whether an individual example, which is stored in a CSR sparse matrix, is covered by the body or not.
* Returns whether an individual example, which is stored in a CSR sparse matrix, is covered or not.
*
* @param indicesBegin An iterator to the beginning of the example's feature values
* @param indicesEnd An iterator to the end of the example's feature values
@@ -64,6 +53,25 @@ class MLRLCOMMON_API IBody {
CsrConstView<const float32>::value_const_iterator valuesBegin,
CsrConstView<const float32>::value_const_iterator valuesEnd, float32* tmpArray1,
uint32* tmpArray2, uint32 n) const = 0;
};

/**
* Defines an interface for all classes that represent the body of a rule.
*/
class MLRLCOMMON_API IBody : public IConditional {
public:

virtual ~IBody() override {};

/**
* A visitor function for handling objects of the type `EmptyBody`.
*/
typedef std::function<void(const EmptyBody&)> EmptyBodyVisitor;

/**
* A visitor function for handling objects of the type `ConjunctiveBody`.
*/
typedef std::function<void(const ConjunctiveBody&)> ConjunctiveBodyVisitor;

/**
* Invokes one of the given visitor functions, depending on which one is able to handle this particular type of