28 #ifndef GRT_DERIVATIVE_HEADER 29 #define GRT_DERIVATIVE_HEADER 31 #include "../CoreModules/PreProcessing.h" 41 enum DerivativeOrders{FIRST_DERIVATIVE=1,SECOND_DERIVATIVE};
53 Derivative(
const UINT derivativeOrder=FIRST_DERIVATIVE,
const Float delta = 1,
const UINT numDimensions = 1,
const bool filterData =
true,
const UINT filterSize = 3);
102 virtual bool reset();
111 virtual bool save(std::fstream &file)
const;
120 virtual bool load(std::fstream &file);
133 bool init(
const UINT derivativeOrder,
const Float delta,
const UINT numDimensions,
const bool filterData,
const UINT filterSize);
141 Float computeDerivative(
const Float x);
158 bool setDerivativeOrder(
const UINT derivativeOrder);
168 bool setFilterSize(
const UINT filterSize);
179 bool setDelta(
const Float delta);
188 bool enableFiltering(
const bool filterData);
195 UINT getFilterSize()
const;
204 Float getDerivative(
const UINT derivativeOrder = FIRST_DERIVATIVE)
const;
213 VectorFloat getDerivatives(
const UINT derivativeOrder = FIRST_DERIVATIVE)
const;
220 static std::string
getId();
240 static const std::string id;
247 #endif //GRT_DERIVATIVE_HEADER std::string getId() const
virtual bool predict(VectorFloat inputVector)
virtual bool deepCopyFrom(const PreProcessing *rhs)
virtual bool predict_(VectorFloat &inputVector)
The MovingAverageFilter implements a low pass moving average filter.
UINT filterSize
The size of the filter used to filter the input data before the derivative is computed.
virtual bool train(ClassificationData trainingData)
VectorFloat yy
A buffer holding the previous input value(s)
virtual bool save(const std::string &filename) const
virtual bool reset() override
VectorFloat yyy
A buffer holding the previous first derivative values.
bool filterData
Flags if the input data should be filtered before the derivative is computed.
The Derivative class computes either the first or second order derivative of the input signal...
Float delta
The estimated time between sensor samples.
virtual bool train_(ClassificationData &trainingData)
virtual bool process(const VectorFloat &inputVector)
UINT derivativeOrder
The order of the derivative that will be computed (either FIRST_DERIVATIVE or SECOND_DERIVATIVE) ...
virtual bool load(const std::string &filename)
MovingAverageFilter filter
The filter used to low pass filter the input data.