Cleanup non-const methods in dense and combined features - #4365
Conversation
|
lgtm! |
|
|
||
| m_is_trained=true; | ||
| distance->init(m_centroids,distance->get_rhs()); | ||
| distance->init(centroids_feats, distance->get_rhs()); |
There was a problem hiding this comment.
since we would like to drop setters in featuresset_num_vectors, set_num_features, we can't an empty features and then set feature matrix later, and here there is no need to store it in a member field
|
|
||
| /** list feature objects */ | ||
| void list_feature_objs(); | ||
| void list_feature_objs() const; |
There was a problem hiding this comment.
lol, this method should rather be deleted (or return a list of strings or so)
| return feat; | ||
| } | ||
|
|
||
| template<class ST> void CDenseFeatures<ST>::set_feature_vector(SGVector<ST> vector, int32_t num) |
There was a problem hiding this comment.
yes, and i think set_feature_matrix should be also removed (after some refactor)
There was a problem hiding this comment.
absolutely, the instance should be tied to the matrix, and otherwise users can create a new instance
| } | ||
| } | ||
|
|
||
| template<class ST> SGMatrix<ST> CDenseFeatures<ST>::steal_feature_matrix() |
|
|
||
| template<class ST> EFeatureClass CDenseFeatures<ST>::get_feature_class() const { return C_DENSE; } | ||
|
|
||
| template<class ST> bool CDenseFeatures<ST>::reshape(int32_t p_num_features, int32_t p_num_vectors) |
There was a problem hiding this comment.
this should just be in the matrix itself, i.e. create a new feature instance using the reshaped sgmatrix
| * instance and of given one | ||
| */ | ||
| virtual CFeatures* create_merged_copy(CFeatures* other) | ||
| virtual CFeatures* create_merged_copy(CFeatures* other) const |
There was a problem hiding this comment.
maybe we can rename this to merge at some point later?
|
CI is not happy though |
|
let me know once CI is happy and I will merge |
|
@karlnapf timeout on windows |
|
restarted. |
…box#4365) * Cleanup non-const methods in DenseFeatures * Make several getters in CombinedFeatures const * Drop set_feature_vector in python examples
create_merged_copy,get_feature_matrix,get_feature_objset_feature_vector,reshape,steal_feature_matrixfree_featuresprotected