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()); |
karlnapf
Jul 9, 2018
Member
why the change here?
why the change here?
vinx13
Jul 9, 2018
Author
Member
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
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
@@ -76,7 +76,7 @@ class CCombinedFeatures : public CFeatures | |||
} | |||
|
|||
/** list feature objects */ | |||
void list_feature_objs(); | |||
void list_feature_objs() const; |
karlnapf
Jul 9, 2018
Member
lol, this method should rather be deleted (or return a list of strings or so)
lol, this method should rather be deleted (or return a list of strings or so)
@@ -170,28 +170,6 @@ template<class ST> ST* CDenseFeatures<ST>::get_feature_vector(int32_t num, int32 | |||
return feat; | |||
} | |||
|
|||
template<class ST> void CDenseFeatures<ST>::set_feature_vector(SGVector<ST> vector, int32_t num) |
karlnapf
Jul 9, 2018
Member
it is not used?
it is not used?
vinx13
Jul 9, 2018
Author
Member
yes, and i think set_feature_matrix
should be also removed (after some refactor)
yes, and i think set_feature_matrix
should be also removed (after some refactor)
karlnapf
Jul 9, 2018
Member
absolutely, the instance should be tied to the matrix, and otherwise users can create a new instance
absolutely, the instance should be tied to the matrix, and otherwise users can create a new instance
@@ -331,16 +309,6 @@ void CDenseFeatures<ST>::copy_feature_matrix(SGMatrix<ST> target, index_t column | |||
} | |||
} | |||
|
|||
template<class ST> SGMatrix<ST> CDenseFeatures<ST>::steal_feature_matrix() |
karlnapf
Jul 9, 2018
Member
lol another joker method :D
lol another joker method :D
@@ -468,21 +438,6 @@ template<class ST> void CDenseFeatures<ST>::initialize_cache() | |||
|
|||
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) |
karlnapf
Jul 9, 2018
Member
this should just be in the matrix itself, i.e. create a new feature instance using the reshaped sgmatrix
this should just be in the matrix itself, i.e. create a new feature instance using the reshaped sgmatrix
@@ -259,7 +259,7 @@ class CFeatures : public CSGObject | |||
* @return new feature object which contains copy of data of this | |||
* instance and of given one | |||
*/ | |||
virtual CFeatures* create_merged_copy(CFeatures* other) | |||
virtual CFeatures* create_merged_copy(CFeatures* other) const |
karlnapf
Jul 9, 2018
Member
maybe we can rename this to merge
at some point later?
maybe we can rename this to merge
at some point later?
good! |
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_obj
set_feature_vector
,reshape
,steal_feature_matrix
free_features
protected