New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup non-const methods in dense and combined features #4365
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the change here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, and i think set_feature_matrix
should be also removed (after some refactor)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can rename this to merge
at some point later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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