guruucsd / DifferentialEncoding

Differential Encoding model
1 stars 3 forks source link

Named args #94

Closed bcipolli closed 7 years ago

bcipolli commented 7 years ago

MATLAB sucks because args are positional only (not named). A common workaround is to pass args as a name, value pair. I've implemented this in our current function.

Now, we can call like this:

bandpass_by_task('../34x25/sergent_1982/uber_sergent_args', 'sergent_1982/de/sergent', 'trial_types', {'L+S-', 'L-S+'}, 'args', {'runs', 5, 'stats', {}, 'plots', {'ls-bars'}})

Such that only a few, required args are positional; optional args are named (with meaningful defaults).

bcipolli commented 7 years ago

Two other unrelated changes in here:

  1. Sergent scripts were using errorType = 3 (cross-entropy), but sigmoid output units. They should be using sum-squared error.
  2. parfor loops weren't running on my version of MATLAB. I finally took the time to fix them.
vishaalprasad commented 7 years ago

Looks good! Thanks for giving an example of how to use the new script.

On Nov 22, 2016 7:27 AM, "Ben Cipollini" notifications@github.com wrote:

MATLAB sucks because args are positional only (not named). A common workaround is to pass args as a name, value pair. I've implemented this in our current function.

Now, we can call like this:

bandpass_by_task('../34x25/sergent_1982/uber_sergent_args', 'sergent_1982/de/sergent', 'trial_types', {'L+S-', 'L-S+'}, 'args', {'runs', 5, 'stats', {}, 'plots', {'ls-bars'}})

Such that only a few, required args are positional; optional args are

named (with meaningful defaults).

You can view, comment on, or merge this pull request online at:

https://github.com/guruucsd/DifferentialEncoding/pull/94 Commit Summary

  • ENH: allow to receive a single cell array
  • BF: make parfor work on older version of MATLAB.
  • BF: use SSE (not cross-entropy) for sigmoid output units.
  • ENH: pass args by name.

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/guruucsd/DifferentialEncoding/pull/94, or mute the thread https://github.com/notifications/unsubscribe-auth/AG_3Pq1vbw-3GNzLcAh4InIw-qJvCzaIks5rAwnkgaJpZM4K5kWE .