|
@@ -130,6 +130,27 @@ class Examples : public std::vector< std::pair<int, Example> >
|
|
/** delete all data associated with all examples
|
|
/** delete all data associated with all examples
|
|
(sparse vector, vector, cached example, etc.) */
|
|
(sparse vector, vector, cached example, etc.) */
|
|
void clean ();
|
|
void clean ();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @brief Create an Examples object from a given full matrix of features and a vector of sample labels.
|
|
|
|
+ *
|
|
|
|
+ * The Examples object consists of individual Example objects containing the label and a pointer to the provided raw feature data (stored in variable Example::vec).
|
|
|
|
+ * Note: No feature data is copied - an Example only contains a pointer to the raw double data.
|
|
|
|
+ * An NICE::Vector is created as an wrapper around this raw double pointer using it, but not copying it.
|
|
|
|
+ * You need to take care to delete these wrapper vectors once you're finished working with the Examples object, otherwise you generate a memory leak.
|
|
|
|
+ * Calling Examples::clean() handles this.
|
|
|
|
+ *
|
|
|
|
+ * Note: memory layout needs to be transposed into rows x column: features x samples
|
|
|
|
+ * features must lay next to each other in memory, so that each feature vector can
|
|
|
|
+ * be adressed by a starting pointer and the number of feature dimensions to come.
|
|
|
|
+ *
|
|
|
|
+ * @param p_MatFeaturesColumWiseSamples matrix containing the features (dimension M) of N samples ( M x N matrix )
|
|
|
|
+ * @param p_VecLabels matrix containing the labels for N samples (1xN)
|
|
|
|
+ * @param p_Examples created Examples object (vector of N Example object with each Example containing a valid vec-ptr to the feature data [uncopied] )
|
|
|
|
+ * @return true for successful Examples creation
|
|
|
|
+ * @author Johannes Ruehle
|
|
|
|
+ */
|
|
|
|
+ static bool wrapExamplesAroundFeatureMatrix(const NICE::Matrix &p_MatFeaturesColumWiseSamples, const NICE::Vector &p_VecLabels, Examples &p_Examples);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|