# Monte Carlo Simulation vs ML Models

• fog37
In summary: We don't average the outputs of the MC SPICE simulations -- we use them to see what the worst-case performance can be.For example, when my first simulations of a particular anti-alias filter for an audio application showed that my passband ripple was too large, I explored other polynomials for the filter and ended up picking one that had fewer terms and was not as sharp at cutoff, but had much better passband ripple performance.There have been other times when I was not happy with what my simulations were showing me about another analog filter circuit, so I opted instead to do simple filtering with the analog front end, and digitize the waveform to implement the rest of the filtering digitally.
fog37
Hello,

I have become familiar with ML and a number of ML models (supervised and unsupervised). I would like to now learn about Monte Carlo simulations since they are so ubiquitous in many fields.

When would we choose to do a Monte Carlo simulation instead of building a ML model (supervised, unsupervised, reinforcement learning)?
What kind of problems are more suitable for a MC simulation?

Thank you!

Others will give better answers, but I can give you an example where Monte Carlo simulation is very important. When EEs design analog circuits, you can get some very subtle interactions between slight variations in the values of the resistors, capacitors, inductors, transformers, etc. There are tolerances associated with the parameters for each of those components (and also temperature coefficients for those values), and the worst-case performance of the circuit will not necessarily be when all components are at their upper tolerance limit (or lower) at the same time.

So we use Monte Carlo SPICE simulations to vary the values of the components randomly within their tolerance bands, and look at the families of plots for the simulations to see if the topology we are using and the tolerances we are specifying will meet the overall performance specs for the circuit.

I can tell you from personal experience that it is very non-trivial to design a high-performance analog filter with specifications you want (filter passband ripple, cutoff frequency, stopband ripple, etrc.) when you are varying so many component values all at once.

Good times.

fog37
berkeman said:
Others will give better answers, but I can give you an example where Monte Carlo simulation is very important. When EEs design analog circuits, you can get some very subtle interactions between slight variations in the values of the resistors, capacitors, inductors, transformers, etc. There are tolerances associated with the parameters for each of those components (and also temperature coefficients for those values), and the worst-case performance of the circuit will not necessarily be when all components are at their upper tolerance limit (or lower) at the same time.

So we use Monte Carlo SPICE simulations to vary the values of the components randomly within their tolerance bands, and look at the families of plots for the simulations to see if the topology we are using and the tolerances we are specifying will meet the overall performance specs for the circuit.

I can tell you from personal experience that it is very non-trivial to design a high-performance analog filter with specifications you want (filter passband ripple, cutoff frequency, stopband ripple, etrc.) when you are varying so many component values all at once.

Good times.
Thank you. I see how your are trying to optimize something (some variable) that depends on many other input variables and use randomization to get there.

I guess ML models are made for prediction (regression or classification) or clustering. Reinforcement learning is about making the right decisions inside a particular environment after some trial and error learning.

So would MC simulations instead be about running a model many many times using several inputs to which we randomly assign specific values at every different iteration with the resulting of getting many many generally different outputs which we will then average out together?

fog37 said:
So would MC simulations instead be about running a model many many times using several inputs to which we randomly assign specific values at every different iteration with the resulting of getting many many generally different outputs which we will then average out together?
We don't average the outputs of the MC SPICE simulations -- we use them to see what the worst-case performance can be. For example, when my first simulations of a particular anti-alias filter for an audio application showed that my passband ripple was too large, I explored other polynomials for the filter and ended up picking one that had fewer terms and was not as sharp at cutoff, but had much better passband ripple performance. There have been other times when I was not happy with what my simulations were showing me about another analog filter circuit, so I opted instead to do simple filtering with the analog front end, and digitize the waveform to implement the rest of the filtering digitally.

Without using MC simulations, I doubt I would have seen how bad the passband ripple could get for that first circuit, and my first prototypes may have worked just fine. But if you are designing a circuit for volume production, all those tolerance variations will show up in some of the production units, which can cause performance problems in the field.

fog37 said:
So would MC simulations instead be about running a model many many times using several inputs to which we randomly assign specific values at every different iteration with the resulting of getting many many generally different outputs which we will then average out together?
That is the idea, except the data is not always averaged. A complicated MC simulation can generate a massive amount of detailed data. What you do with that data depends on what question you are asking about the problem. You could be looking for averages, variation, extreme examples, etc.
It is often true that simple, standard analysis problems become much more difficult with the addition of a couple of "if .. then" conditions in the problem statement. The analysis can be a lot trickier than a simple MC model, where all you have to do is to add the "if ... then" condition into the simulation code. There have been threads in this forum where the mathematical analysis of a problem required a long, complicated, discussion and the easiest way to determine when the analysis was correct was to verify it with a relatively simple MC simulation.

fog37 and berkeman

• Programming and Computer Science
Replies
4
Views
997
• Programming and Computer Science
Replies
1
Views
3K
• Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
• Other Physics Topics
Replies
0
Views
2K
• Astronomy and Astrophysics
Replies
1
Views
1K
• High Energy, Nuclear, Particle Physics
Replies
9
Views
2K
• Atomic and Condensed Matter
Replies
3
Views
4K
• Set Theory, Logic, Probability, Statistics
Replies
4
Views
2K
• Engineering and Comp Sci Homework Help
Replies
1
Views
2K
• Programming and Computer Science
Replies
2
Views
5K