2
mle[data_] := ArgMin[
              {-LogLikelihood[twoState[a, b, 60, 0.2], data],  
               Element[{a, b}, Reals] && a > 0 && b > 0}, 
              {a, b}]

ParallelMap[mle, {BG6, BG3, DC5}]

I'm executing the mle function in parallel over independent datasets using ParallelMap. I'd like to see the output as each parallel evaluation finishes. I looked at the documentation for Monitor, but its not clear to me how to use it here. It looks I need to a vector to hold the results using something like:

SharedVariable[params]

And then append the output of mle to params inside a call to Monitor, but I don't know the syntax to do this.

Sjoerd C. de Vries
  • 16,122
  • 3
  • 42
  • 94
jfelectron
  • 1,033
  • 9
  • 6

1 Answers1

0

If you just want to view the result when it is ready, you can print it before returning.

mle[data_] := Module[{result},
    result = ArgMin[
          {-LogLikelihood[twoState[a, b, 60, 0.2], data],  
           Element[{a, b}, Reals] && a > 0 && b > 0}, 
          {a, b}];
    Print[result];
    Return[result];
];

You can replace the call to Print if you want to do something more complicated, like calling Monitor.

Guy Gur-Ari
  • 369
  • 1
  • 7