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

LoggingMonitor behavior after slicing #134

Open
mmckerns opened this issue Dec 29, 2020 · 0 comments
Open

LoggingMonitor behavior after slicing #134

mmckerns opened this issue Dec 29, 2020 · 0 comments

Comments

@mmckerns
Copy link
Member

I'm not sure if the behavior after a monitor is sliced is as expected, in particular, for the case of a LoggingMonitor, with a custom label.

>>> import mystic as my
>>> m = my.monitors.VerboseLoggingMonitor(1, 1, 1, label='foo')

Produces:

# Tue Dec 29 09:40:22 2020
# ___#___  __foo__  __params__

Which is expected. The custom label works as expected.
Let's add some entries...

>>> m([1,2,3],4)
Generation 0 has foo: 4.000000
Generation 0 has fit parameters:
 [1, 2, 3]
>>> m([1,2,4],5)
Generation 1 has foo: 5.000000
Generation 1 has fit parameters:
 [1, 2, 4]

Produces:

# Tue Dec 29 09:40:22 2020
# ___#___  __foo__  __params__
  (0,)     4.000000   [1, 2, 3]
  (1,)     5.000000   [1, 2, 4]

This is also as expected.
So, let's slice the monitor...
>>> x = m[:1]
Produces:

# Tue Dec 29 09:40:22 2020
# ___#___  __foo__  __params__
  (0,)     4.000000   [1, 2, 3]
  (1,)     5.000000   [1, 2, 4]
# Tue Dec 29 09:41:00 2020
# ___#___  __ChiSquare__  __params__

Note that the monitors both share the same file... which is potentially ok.
Note that the custom label is not transferred. I would expect that it should.
This should probably be fixed. Now, let's add some entries, using each of the
monitors...

>>> m([1,2,5],6)
Generation 2 has foo: 6.000000
Generation 2 has fit parameters:
 [1, 2, 5]
>>> x([1,2,6],7)
Generation 1 has foo: 7.000000
Generation 1 has fit parameters:
 [1, 2, 6]

Produces:

# Tue Dec 29 09:40:22 2020
# ___#___  __foo__  __params__
  (0,)     4.000000   [1, 2, 3]
  (1,)     5.000000   [1, 2, 4]
# Tue Dec 29 09:41:00 2020
# ___#___  __ChiSquare__  __params__
  (2,)     6.000000   [1, 2, 5]
  (1,)     7.000000   [1, 2, 6]

The last entry in the log is from the sliced monitor, where the step of 1 is expected (due to the slice of [:1])... but as we write to the same log, it's a bit confusing as to which entry is from the sliced monitor and which is from the original. Should the slice be given an id, so that it's distinct, and thus can easily be separated upon plotting, etc? I expect so.

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

No branches or pull requests

1 participant