Skip to content

Commit

Permalink
Move class IBoostingStatistics to namespace "boosting".
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-rapp committed Nov 12, 2023
1 parent b304470 commit 59e1715
Showing 1 changed file with 33 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,36 @@

#include <functional>

/**
* Defines an interface for all classes that provide access to gradients and Hessians which serve as the basis for
* learning a new boosted rule or refining an existing one.
*/
class IBoostingStatistics : public IStatistics {
public:

virtual ~IBoostingStatistics() {};

/**
* A visitor function for handling score matrices of the type `CContiguousConstView`.
*/
typedef std::function<void(const CContiguousConstView<float64>&)> DenseScoreMatrixVisitor;

/**
* A visitor function for handling score matrices of the type `SparseSetMatrix`.
*/
typedef std::function<void(const SparseSetMatrix<float64>&)> SparseScoreMatrixVisitor;

/**
* Invokes one of the given visitor functions, depending on which one is able to handle the type of matrix that
* is used to store the currently predicted scores.
*
* @param denseVisitor The visitor function for handling objects of the type `CContiguousConstView`
* @param sparseVisitor The visitor function for handling objects of the type `SparseSetMatrix`
*/
virtual void visitScoreMatrix(DenseScoreMatrixVisitor denseVisitor,
SparseScoreMatrixVisitor sparseVisitor) const = 0;
};
namespace boosting {

/**
* Defines an interface for all classes that provide access to gradients and Hessians which serve as the basis for
* learning a new boosted rule or refining an existing one.
*/
class IBoostingStatistics : public IStatistics {
public:

virtual ~IBoostingStatistics() {};

/**
* A visitor function for handling score matrices of the type `CContiguousConstView`.
*/
typedef std::function<void(const CContiguousConstView<float64>&)> DenseScoreMatrixVisitor;

/**
* A visitor function for handling score matrices of the type `SparseSetMatrix`.
*/
typedef std::function<void(const SparseSetMatrix<float64>&)> SparseScoreMatrixVisitor;

/**
* Invokes one of the given visitor functions, depending on which one is able to handle the type of matrix
* that is used to store the currently predicted scores.
*
* @param denseVisitor The visitor function for handling objects of the type `CContiguousConstView`
* @param sparseVisitor The visitor function for handling objects of the type `SparseSetMatrix`
*/
virtual void visitScoreMatrix(DenseScoreMatrixVisitor denseVisitor,
SparseScoreMatrixVisitor sparseVisitor) const = 0;
};

}

0 comments on commit 59e1715

Please sign in to comment.