-
Notifications
You must be signed in to change notification settings - Fork 2k
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
GH-6722 constraint glm #16035
GH-6722 constraint glm #16035
Conversation
Here is the doc that I have implemented the algo based on: |
|
||
// copy a square array | ||
public static double[][] copy2DArray(double[][] src_array) { | ||
double[][] dest_array = new double[src_array.length][src_array.length]; |
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.
Shouldn't this use the MemoryManager? Also it seems to me that copy2DArray(double[][], double[][])
supports any 2d array so I'd prefer not limiting the functionality without changing the name. So either I would change the memory allocation like this:
double[][] dest_array = new double[src_array.length][];
for(int i = 0; i < src_array.length; ++i)
dest_array[i] = MemoryManager.malloc8d(src_array[i].length);
or just rename it to copySquareArray
or something like that. It still might be worth considering changing the memory allocation to use the MemoryManager. (I still don't know the code well enough to know if it copies just small matrices or even the big ones but if you think it's ok to have this memory allocation that's good enough for me).
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 added the change but kept the name because I want to copy rectangular arrays too.
h2o-algos/src/main/java/hex/optimization/OptimizationUtils.java
Outdated
Show resolved
Hide resolved
4ecc837
to
3550df2
Compare
b25636f
to
da3fa6c
Compare
a5b56e9
to
728600e
Compare
error("_max_iterations", H2O.technote(2, "if specified, must be >= 1.")); | ||
warn("max_iterations", " must be >= 1 to obtain proper model. Setting it to be 0 will only" + | ||
" return the correct coefficient names and an empty model."); | ||
//error("_max_iterations", H2O.technote(2, "if specified, m_be4ust be >= 1.")); |
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 would be nice if you'd check that those linear_constrains
are valid even in the expensive == false
branch. I think it's an unwritten contract that we expect e.g. in h2o-flow. Just a simple check that would validate:
- the strings are as expected (
"lessthanequal"
vs"less_than_equal"
) - basic validity/satisfiability of constraints (e.g.,
x > 10
andx < 5
are not satisfiable)
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 moved some checks to be before expensive=true. However, the more complicated checks need information like _dinfo and there cannot be moved.
54d0cab
to
5167ca7
Compare
…waiting for complete model building process. User just need to set max_iterations=0 and then call the model.coef_names() in python or h2o.coef_names(model) in R. GH-6722: extract constraints from betaConstraints and from linear constraints with and without standardization. GH-6722: complete tests to make sure constraint extraction with or without standardization is correct. GH-6722: Streamline GLMConstrainedTest, build matrix representing beta and linear constraints. GH-6722: adding redundant constraint matrix check GH-6722: add QR to check for rank of constraint matrix and added test GH-6722: adding error message about redundant constraints so that user will know which one to remove. GH-6722: added contributinos from constraints for objective function. GH-6722: adding constraint contribution to gram and gradient GH-6722: added test to make sure constraints contribution to gram and gradient is correct. GH-6722: Added constraint parameters update and constraint stopping conditions. GH-6722: finished taken care of gram zero cols and added tests. GH-6722: Add exact line search. GH-6722: Complete constraints/derivative/gram contribution update from beta change. Add short circuit test. GH-6722: Allow users to set parameters so that they can control how the constraint parameters change. GH-6722 moved some linear constraint checks before expensive=true GH-6722 make objective() the function call to get training objective results with linear constraints. incorporate Tomas F comments
…nto one and then throw an error for all the errors.
31d3f45
to
51bcfbd
Compare
…n. True fix will be implemented in issue: #16171
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.
LGTM, Thank you!
issue: #6722
I added linear constraint support to our GLM toolbox. However, I am working on adding the following:
Guys:
I know this is not complete but I would like you guys to start checking my implementation earlier than later. Sorry for getting it done so late.