Giter VIP home page Giter VIP logo

Comments (25)

ericchansen avatar ericchansen commented on June 22, 2024

The central differentiation is to select which parameters to use based upon their derivatives. If the derivatives are already known, it skips the central differentiation.

How else do you propose we select parameters?

from q2mm.

peonor avatar peonor commented on June 22, 2024

Based on the differentiation in the preceding Gradient step, even though it has made a change in between. Doing a very expensive differentiation at the start of the Simplex sort of defeats the purpose of it. This is what we did before.

Have you actually analyzed my original code (Unix, awk, C), or did you go only from Elaine’s python?

/Per-Ola

From: Eric Hansen [mailto:[email protected]]
Sent: den 3 juni 2016 16:31
To: ericchansen/q2mm [email protected]
Cc: Norrby, Per-Ola [email protected]; Author [email protected]
Subject: Re: [ericchansen/q2mm] Simplex (#22)

The central differentiation is to select which parameters to use based upon their derivatives. If the derivatives are already known, it skips the central differentiation.

How else do you propose we select parameters?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/22#issuecomment-223594702, or mute the threadhttps://github.com/notifications/unsubscribe/ANVSNBISXnI9f_avzfoiQCaAwVPDSUhOks5qIDqggaJpZM4Itj0_.


Confidentiality Notice: This message is private and may contain confidential and proprietary information. If you have received this message in error, please notify us and remove it from your system and note that you must not copy, distribute or take any action in reliance on it. Any unauthorized use or disclosure of the contents of this message is not permitted and may be unlawful.

from q2mm.

ericchansen avatar ericchansen commented on June 22, 2024

It's a simple change to take the derivatives from the starting FF from gradient.

What about when you don't want to use gradient at all, just simplex?

I propose leaving simplex as is in case you really don't have the derivatives, and having gradient give the initial derivatives to whatever FF it finds was best.

from q2mm.

arosale4 avatar arosale4 commented on June 22, 2024

At one point didn't the code try and only optimize 10 parameters at a time? It would be nice to avoid that extra calculation cost if it is unnecessary. For example some of my optimizations are looking at all the force constants (26 parameters) and it then generates 52 FF's calculating data from 30 structures. This amounts to parametrizations that go beyond two days, and especially when we consider our Schrödinger Licenses being a constant problem, it becomes more of a problem beyond just calculation time.

from q2mm.

ericchansen avatar ericchansen commented on June 22, 2024

For simplex it limits to a certain number of parameters, which is indeed 10. You can change that with simlex.Simplex.max_params.

I don't have any max parameter limit on the gradient based methods.

Also, I finished coding my suggestion in the last comment. Just testing it now.

from q2mm.

peonor avatar peonor commented on June 22, 2024

You only need the derivatives for selection. If you ONLY run simplex, it's your own responsibility to select the <=10 parameters. You could do this, for example, from a previously written out Jacobian, or from knowing...

Sent from my iPhone

On 3 juni 2016, at 17:05, Eric Hansen <[email protected]mailto:[email protected]> wrote:

For simplex it limits to a certain number of parameters, which is indeed 10. You can change that with simlex.Simplex.max_paramshttps://github.com/ericchansen/q2mm/blob/0a4f2c75e1ef36e81a339c1cc0fbf574a44b635b/simplex.py#L59.

I don't have any max parameter limit on the gradient based methods.

Also, I finished coding my suggestion in the last comment. Just testing it now.

You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/22#issuecomment-223604368, or mute the threadhttps://github.com/notifications/unsubscribe/ANVSNO5JOV6-NcrVinnlZiX9nL8pWkzqks5qIEKigaJpZM4Itj0_.


Confidentiality Notice: This message is private and may contain confidential and proprietary information. If you have received this message in error, please notify us and remove it from your system and note that you must not copy, distribute or take any action in reliance on it. Any unauthorized use or disclosure of the contents of this message is not permitted and may be unlawful.

from q2mm.

ericchansen avatar ericchansen commented on June 22, 2024

Check out commit c7ad106.

Not tested as much as I'd like, so please let me know if I broke anything. I have to hold off on submitting any Q2MM jobs due to a token dispute going on now between our lab and several other labs on campus. If you guys could test this and let me know, that'd be great.

Also, I have another concern. This change may result in some undesired behavior when we loop only using gradient, or when simplex doesn't produce any improvements. See the commit message for more information. Just warning everyone. I can work on it soon.

from q2mm.

peonor avatar peonor commented on June 22, 2024

Numerical differentiation should not be dependent on whether gradients exist or not. GRAD should always do differentiation, SIMP never. The only case when SIMP should need derivatives (mainly 2nd) is when it does parameter selection. Forward them when available; if not present, the SIMP runs with all parameters it is given.

from q2mm.

peonor avatar peonor commented on June 22, 2024

... but OK, SIMP should be allowed to complain and break if it is given more than 10 parameters (preferably as a constant that can be modified by expert users).

from q2mm.

arosale4 avatar arosale4 commented on June 22, 2024

I have been trying out the commit that is referenced above. On line 347 of simplex.py should that be "o" instead of "i"?

from q2mm.

ericchansen avatar ericchansen commented on June 22, 2024

Yes, it appears that it should be. I'm going to change the o on line 342 to an i though. I typically use i as my integer in enumerations. Might as well stick to that.

from q2mm.

nberkel05 avatar nberkel05 commented on June 22, 2024

I'm running into a problem with the updated version of simplex. If the "if" statement on line 105 is false and goes to the else statement on line 136, then on line 149, you reference ff_rows and ff_cols that aren't defined.

from q2mm.

ericchansen avatar ericchansen commented on June 22, 2024

Simplex has been broken since commit c7ad106. I would advise not using until someone has time to work on it.

Unfortunately, that commit should have been in its own branch until it was thoroughly tested. Then we could have used the old version.

from q2mm.

ericchansen avatar ericchansen commented on June 22, 2024

I'm not having any issues anymore. Anyone else want to double check me?

from q2mm.

nberkel05 avatar nberkel05 commented on June 22, 2024

Should "params" be defined with ff_row and f_cols? Also, around line 69 should you have a return statement? Should the 'return best_ff' be before the else statement and 'return self.new_ffs' be in the else statement?

from q2mm.

ericchansen avatar ericchansen commented on June 22, 2024

I made a commit earlier that may do what you're talking about, but I didn't reference this issue. I just updated that now. Do the changes in commit a809c7b do what you are talking about?

from q2mm.

nberkel05 avatar nberkel05 commented on June 22, 2024

Yes, exactly.

from q2mm.

peonor avatar peonor commented on June 22, 2024

I downloaded the iss22 branch (first time I tried accessing another branch :-) ), running it, not crashing. However, the Simplex also is not behaving as it should. It has thrown away my best point, continued with a worse set. Will continue to test, se what I can find.

To help understanding, I think it would helpt if the simplex ORDERED FF SCORES were printed after each cycle, now I had to infer from behavior what happened. But it was clearly going wrong, I started out with a simplex of only two parameters and the scores "93.8 396.1 0.3", and a bit later it tried to expand in a score of "23.7", impossible unless it threw away the "0.3" score first. Will do my own modifications of the code and test, but I remember having a simple, fast test case with only two bond lengths in one small structure (I'm using glycol), fast!

from q2mm.

peonor avatar peonor commented on June 22, 2024

And now my example crashed, after the simplex, in a new place, datatypes.py line 281, seems "self.path" is NoneType. I'll work on it today, upload a simple example if I cannot crack it.

from q2mm.

peonor avatar peonor commented on June 22, 2024

If anyone wants it, here is my error message from the example where I'm just doing two simple bond lengths:

opt
simplex -- Writing best force field from simplex.
Traceback (most recent call last):
File "/home/kcjh508/q2mm/loop.py", line 192, in
main(sys.argv[1:])
File "/home/kcjh508/q2mm/loop.py", line 186, in main
loop.run_loop_input(lines)
File "/home/kcjh508/q2mm/loop.py", line 108, in run_loop_input
self.ff = loop.opt_loop()
File "/home/kcjh508/q2mm/loop.py", line 42, in opt_loop
self.loop_lines, score=self.ff.score)
File "/home/kcjh508/q2mm/loop.py", line 148, in run_loop_input
self.ff = simp.run(r_data=self.ref_data)
File "/home/kcjh508/q2mm/opt.py", line 32, in wrapper
return func(_args, *_kwargs)
File "/home/kcjh508/q2mm/simplex.py", line 318, in run
best_ff.export_ff(best_ff.path)
File "/home/kcjh508/q2mm/datatypes.py", line 633, in export_ff
if lines is None and self.lines is None:
File "/home/kcjh508/q2mm/datatypes.py", line 281, in lines
with open(self.path, 'r') as f:
TypeError: coercing to Unicode: need string or buffer, NoneType found

from q2mm.

ericchansen avatar ericchansen commented on June 22, 2024

Merged your changes Per-Ola, they look good.

However, I'm guessing those changes don't address the bug in your last comment.

Here's my take on your error message. At the end of simplex.run, it wants to write the best FF. It then goes to datatypes.export_ff to do so. Each FF object has an attribute called lines (might look something like ff.lines), which is list of strings, literally it has every line of mm3.fld. It is generated by something like

with open(somefilename, 'r') as f:
    ff.lines = f.readlines()

Because that's so big, I only store it on self.ff, or the initial FF, not all the copies.

Apparently, whatever FF it is trying to write doesn't have that property, so instead it attempts to read the file again, rather than use the lines stored in memory. However, it also can't do that because the property path (maybe ff.path or best_ff.path) is also missing.

These properties must be copied to the the FF it is attempting to write at some point.

Somewhere in your example, I'm assuming the code goes off the standard path and ends up at this point where the attributes don't get copied like they should. I say that because my examples I tried running very recently last night seemed to work fine. We should probably look for a diverging if statement or something similar. I'll check it out more after a few meetings I have this morning.

from q2mm.

ericchansen avatar ericchansen commented on June 22, 2024

The following was taken from the pull request. I wish it updated on here automatically, but I guess I have to copy and paste it. Also unfortunate, but many of the commits in that pull request will not appear here because issue #22 was not referenced in the commit message.

Lots of helpful changes inside here [I was referencing the pull request of q2mm/q2mm:mysimplex.

Still need to do testing before going forward. Here's some things to consider.

  1. Is simplex reading the estimated derivatives properly from gradient?
  2. How best to handle raise when all trial parameter sets produce the same objective function score.
  3. If simplex follows gradient, should simplex only act on parameters with negative 2nd derivatives? Would simplex do nothing if no parameter has a negative 2nd derivative? Or would we rather keep it the same and have it act on which parameters have the lowest 2nd derivatives, not necessarily negative?
  4. If the user wants to run only simplex and specifies more parameters, than the maximum parameter number set inside simplex.Simplex.__init__, do we want to let them use that number of parameters or should it check the 2nd derivatives?

from q2mm.

peonor avatar peonor commented on June 22, 2024

I merged your iss22 branch into my own branch and worked from that, but couldn’t push back since I had no write access to your code, and there was no such branch under Q2MM/q2mm. I had to create a new branch and push that to Q2MM/q2mm, where I had write access. Any other way I could have done it?

/Per-Ola

From: Eric Hansen [mailto:[email protected]]
Sent: den 28 juni 2016 17:43
To: ericchansen/q2mm [email protected]
Cc: Norrby, Per-Ola [email protected]; Author [email protected]
Subject: Re: [ericchansen/q2mm] Simplex (#22)

The following was taken from the pull request. I wish it updated on here automatically, but I guess I have to copy and paste it. Also unfortunate, but many of the commits in that pull request will not appear here because issue #22#22 was not referenced in the commit message.

Lots of helpful changes inside here [I was referencing the pull request of q2mm/q2mm:mysimplexhttps://github.com/Q2MM/q2mm/tree/mysimplex].

Still need to do testing before going forward. Here's some things to consider.

  1. Is simplex reading the estimated derivatives properly from gradient?
  2. How best to handle raise when all trial parameter sets produce the same objective function score.
  3. If simplex follows gradient, should simplex only act on parameters with negative 2nd derivatives? Would simplex do nothing if no parameter has a negative 2nd derivative? Or would we rather keep it the same and have it act on which parameters have the lowest 2nd derivatives, not necessarily negative?
  4. If the user wants to run only simplex and specifies more parameters, than the maximum parameter number set inside simplex.Simplex.init, do we want to let them use that number of parameters or should it check the 2nd derivatives?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/22#issuecomment-229090400, or mute the threadhttps://github.com/notifications/unsubscribe/ANVSNLDDlzwHNTSOSjoRpmNmnwW6MJgfks5qQUEegaJpZM4Itj0_.


Confidentiality Notice: This message is private and may contain confidential and proprietary information. If you have received this message in error, please notify us and remove it from your system and note that you must not copy, distribute or take any action in reliance on it. Any unauthorized use or disclosure of the contents of this message is not permitted and may be unlawful.

from q2mm.

ericchansen avatar ericchansen commented on June 22, 2024

Not sure. It's pretty messing working between forks like this (we just have to be careful where we submit issues in the future). Typically everything between forks is handled with pull requests, which isn't very conducive for close collaboration or coding together. Better suited for adopting fully fleshed out features.

from q2mm.

ericchansen avatar ericchansen commented on June 22, 2024

Okay, we could still go for some functionality changes, but I think all the bugs are gone.

from q2mm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.