Commit 135c073a authored by mzed's avatar mzed
Browse files

Merge branch 'master' into dev

parents f414e85e 1e6df133
......@@ -17,7 +17,7 @@
#define SEARCH_RADIUS 1
template<typename T>
seriesClassificationTemplate<T>::seriesClassificationTemplate() {};
seriesClassificationTemplate<T>::seriesClassificationTemplate() : hopSize(1), counter(0) {};
template<typename T>
seriesClassificationTemplate<T>::~seriesClassificationTemplate() {};
......@@ -55,6 +55,10 @@ bool seriesClassificationTemplate<T>::train(const std::vector<trainingSeriesTemp
lengthsPerLabel[allTrainingSeries[i].label] = tempLengths;
}
}
//TODO: make this size smarter?
for (int i = 0; i < maxLength; ++i ) {
seriesBuffer.push_back({0}); //set size of continuous buffer
}
return trained;
};
......@@ -105,6 +109,19 @@ T seriesClassificationTemplate<T>::run(const std::vector<std::vector<T>> &inputS
return lowestCost;
};
template<typename T>
std::string seriesClassificationTemplate<T>::runContinuous(const std::vector<T> &inputVector) {
seriesBuffer.erase(seriesBuffer.begin());
seriesBuffer.push_back(inputVector);
std::string returnString = "none";
if ((counter % hopSize) == 0 ) {
returnString =
counter = 0;
}
++counter;
return returnString;
}
template<typename T>
std::vector<T> seriesClassificationTemplate<T>::getCosts() const{
return allCosts;
......
......@@ -50,6 +50,12 @@ public:
*/
T run(const std::vector<std::vector<T> > &inputSeries, std::string label);
/** Compare an input series to all of the stored series with a specified label
* @param std::vector<T> one frame either float or double input data
* @return The lowest cost match, float or double
*/
std::string runContinuous(const std::vector<T> &inputVector);
/** Get the costs that were calculated by the run method
* @return A vector of floats or doubles, the cost of matching to each training series
*/
......@@ -103,6 +109,10 @@ private:
int maxLength;
int minLength;
std::map<std::string, minMax<int> > lengthsPerLabel;
std::vector<std::vector<T> > seriesBuffer;
int hopSize;
int counter;
};
//This is here to keep the old API working
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment