-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Static error: fix static error for list of classes #2807
Conversation
@rcurtin Hi, as I am checking the static error, I encounter an error about calculating the Basically, the adjusted score is computed 2 times:
In the comment you said that "the last score is equal to the distance between the centroids minus the radii of the query and reference bounds along the axis of the line between the two centroids." So can I fix it like this?
|
@rxng8 I think your suggestion is correct. It looks like the current implementation is definitely a bug. If you change to the code you proposed, do all the tests still pass? |
@rcurtin Yes, all the |
@rxng8 awesome! Then I think that is the correct fix. 👍 |
Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>
Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>
Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>
@zoq Hi, I have finished the fix. Please feel free to review it! |
Looks like there are two issues that aren't checked yet, but I guess you checked everything? |
@zoq As you can see from this static code check (from @gauravghati, issue #2798 ) which includes the
Therefore, I believe that it is fine now, but I will still leave those unchecked! |
Okay, perfect, I looked at the two issues and I think they are false postives, so safe to ignore at this point. |
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.
Just some really minor style issues; the rest looks good.
src/mlpack/methods/amf/termination_policies/complete_incremental_termination.hpp
Outdated
Show resolved
Hide resolved
src/mlpack/methods/amf/termination_policies/incomplete_incremental_termination.hpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>
…ntal_termination.hpp Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>
…al_termination.hpp Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>
@zoq I have committed your suggested changes! Thanks! |
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.
Thanks for working on this one, no more comments from my side.
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.
Second approval provided automatically after 24 hours. 👍
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.
@rxng8 thank you so much for working on all these issues! It's great to have them all fixed. I took a look through and I left a few comments, but really only one needs to be addressed before merge---it seems there is a copy/move constructor pair that don't have the if (this != &other)
guard. Let me know if I overlooked something. :)
src/mlpack/methods/amf/termination_policies/simple_residue_termination.hpp
Outdated
Show resolved
Hide resolved
@@ -34,8 +34,7 @@ void ReinforceNormal<InputDataType, OutputDataType>::Forward( | |||
if (!deterministic) | |||
{ | |||
// Multiply by standard deviations and re-center the means to the mean. | |||
output = arma::randn<arma::Mat<eT> >(input.n_rows, input.n_cols) * | |||
stdev + input; | |||
output = output.randn(input.n_rows, input.n_cols) * stdev + input; |
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.
I didn't know randn()
returned the matrix so that it could be used like this. Nice!
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.
thank you!
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.
Same here, actually I had to test it out.
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, I also tested it and it seems to return a matrix. did it happen to behave the same ways?
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.
I believe it is :))
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.
Yep, looks great, thank you!
Co-authored-by: Ryan Curtin <ryan@ratml.org>
Thanks so much @rxng8! It seems like there are still two issues in the big checklist you made at the top, but, you could always open another PR for those two (it should be easy :)). 👍 |
Refer to issue #2798.
list of the errors and warnings (List taken from #2798 ) -
mlpack/src/mlpack/methods/adaboost/adaboost_model.hpp 26 warn V690
The 'AdaBoostModel' class implements a move constructor but lacks the move assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/methods/adaboost/adaboost_model.cpp 74 warn V794
The assignment operator should be protected from the case of 'this == &other'.
mlpack/src/mlpack/core/tree/hrectbound.hpp 54 warn V690
The 'HRectBound' class implements a move constructor, but lacks the move assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/core/tree/ballbound.hpp 32 warn V690
The 'BallBound' class implements a move constructor, but lacks the move assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/core/tree/hollow_ball_bound.hpp 33 warn V690
The 'HollowBallBound' class implements a move constructor, but lacks the move assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/core/tree/hollow_ball_bound_impl.hpp 82 warn V794
The assignment operator should be protected from the case of 'this == &other'.
mlpack/src/mlpack/core/tree/cellbound.hpp 75 warn V690
The 'CellBound' class implements a move constructor, but lacks the move assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp 441 err V758
The 'range' reference becomes invalid when temporary object returned by a function is destroyed.
mlpack/src/mlpack/core/tree/rectangle_tree/discrete_hilbert_value.hpp 29 warn V690
The 'DiscreteHilbertValue' class implements a move constructor, but lacks the move assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/methods/amf/update_rules/svd_incomplete_incremental_learning.hpp 53 err V730
Not all members of a class are initialized inside the constructor. Consider inspecting: currentUserIndex.
mlpack/src/mlpack/methods/amf/update_rules/svd_complete_incremental_learning.hpp 56 err V730
Not all members of a class are initialized inside the constructor. Consider inspecting: currentUserIndex, currentItemIndex.
mlpack/src/mlpack/methods/amf/update_rules/svd_complete_incremental_learning.hpp 172 err V730
Not all members of a class are initialized inside the constructor. Consider inspecting: n, m, isStart.
mlpack/src/mlpack/methods/amf/termination_policies/simple_residue_termination.hpp 42 warn V730
Not all members of a class are initialized inside the constructor. Consider inspecting: residue, iteration, normOld, nm.
mlpack/src/mlpack/methods/range_search/range_search.hpp 42 warn V690
The 'RangeSearch' class implements a move constructor, but lacks the move assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/methods/range_search/range_search_impl.hpp 261 warn V1004
The 'referenceTree' pointer was used unsafely after it was verified against nullptr. Check lines: 257, 261.
mlpack/src/mlpack/methods/fastmks/fastmks.hpp 63 warn V690
The 'FastMKS' class implements a move constructor, but lacks the move assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/methods/fastmks/fastmks_model.hpp 34 warn V690
The 'FastMKSModel' class implements a move constructor, but lacks the move assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/methods/fastmks/fastmks_model.cpp 73 warn V794
The assignment operator should be protected from the case of 'this == &other'.
mlpack/src/mlpack/methods/hmm/hmm_model.hpp 33 warn V690
The 'HMMModel' class implements a move constructor, but lacks the move assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/methods/hoeffding_trees/hoeffding_tree.hpp 61 warn V690
The 'HoeffdingTree' class implements a copy constructor, but lacks the copy assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/methods/hoeffding_trees/hoeffding_tree_model.cpp 64 warn V794
The assignment operator should be protected from the case of 'this == &other'.
mlpack/src/mlpack/methods/hoeffding_trees/hoeffding_tree_model.cpp 92 warn V794
The assignment operator should be protected from the case of 'this == &other'.
mlpack/src/mlpack/methods/kde/kde.hpp 88 warn V690
The 'KDE' class implements a move constructor, but lacks the move assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp 160 warn V519
The 'adjustedScore' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 159, 160.
mlpack/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp 21 err V730
Not all members of a class are initialized inside the constructor. Consider inspecting: lastBaseCase.
mlpack/src/mlpack/methods/lars/lars.cpp 420 warn V688
The 'activeSet' local variable possesses the same name as one of the class members, which can result in a confusion.
mlpack/src/mlpack/methods/preprocess/scaling_model.hpp 29 warn V690
The 'ScalingModel' class implements a move constructor, but lacks the move assignment operator. It is dangerous to use such a class.
mlpack/src/mlpack/methods/ann/layer/reparametrization_impl.hpp 68 err V562
It's odd to compare a bool type value with a value of double type.
mlpack/src/mlpack/methods/ann/layer/reinforce_normal_impl.hpp 23 warn V730
Not all members of a class are initialized inside the constructor. Consider inspecting: reward, deterministic.
mlpack/src/mlpack/methods/ann/layer/recurrent_attention_impl.hpp 30 err V730
Not all members of a class are initialized inside the constructor. Consider inspecting: outSize.
mlpack/src/mlpack/methods/reinforcement_learning/q_networks/categorical_dqn.hpp 56 warn V730
Not all members of a class are initialized inside the constructor. Consider inspecting: atomSize, vMin, vMax.
mlpack/src/mlpack/methods/amf/termination_policies/incomplete_incremental_termination.hpp 36 warn V730
Not all members of a class are initialized inside the constructor. Consider inspecting: incrementalIndex, iteration.
mlpack/src/mlpack/methods/amf/termination_policies/complete_incremental_termination.hpp 37 warn V730
Not all members of a class are initialized inside the constructor. Consider inspecting: incrementalIndex, iteration.