Skip to content
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

#126 [glmfit]: refactoring input parsing && new output stats #166

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

achengli
Copy link

Issue #126

New computed stats for glmfit output and refactorize the input parsing using parseInput instead of a bunch of concatenated control structures.

New computed stats for glmfit output and refactorize the input parsing using parseInput instead of a bunch of concatenated control structures.
@pr0m1th3as
Copy link
Member

Thanks for the PR. There are a few things you should consider. Do NOT remove existing BISTs when upgrading a function, unless they test for erroneous output. We do not use parseInput in statistics functions, because it is preferable to include input validation for parameter checking in order to output useful error messages. After all, inputParser just over-complicates things rather than shortening your code. Generally, there is no need refactoring a code that is working properly, unless there is something to gain (such as speed, readability, etc.).
Your change at line 100 outputs the wrong message and the input validation logic is wrong.
Keep the varargout at the function's descriptor. You can add inside the if (nargout > 1) statement another if (nargout > 2) in order to compute and return the stats structure. This way you are doing the computations only if necessary.
Using normal distribution as default for 2 input arguments is a nice addition, but you need to change/add necessary BISTs to test the input validation of this code.
Add further BISTs to test that the stats structure computes the correct values.
Add further information in the function's documentation about the returning 3rd argument.

@achengli
Copy link
Author

achengli commented Nov 12, 2024

Thanks for your notes, I will take these points soon:

  • Restore BISTs
  • Restore switch case validation instead of parseInput
  • Problem at line 100 (giving an input validation error)
  • keeping varargout instead of a bunch of returned variables
  • Add the necessary BISTs in order to check if the default normal dist. is working well
  • Same as above but with stats structure and if it computes the correct values
  • Documenting the modifications

Thank you for the attention 🤝

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants