Does Matlab perform optimization better than python?

92 views (last 30 days)
Hi, I am currently working on econometrics research and replicating all the matlab codes into python so that I can expand my research using machine learning stuff. But I found that matlab fminsearch() function works so much better than python's optimization packages such as scipy fmin or minimize. I compared two in the same setting (initial value, iteration, opt algorithm - ‘Nelder-Mead’, etc.), and while matlab's fminsearch successfully found the minimum point, scipy couldn't even though I increased the iteration and also implemented other algorithms.
Does this happen in general? Is matlab better than python when it comes to optimization?
  2 Comments
Torsten
Torsten on 1 Feb 2024
Shouldn't it be an indication that MATLAB is a commercial product while python isn't ?
the cyclist
the cyclist on 1 Feb 2024
While I am obviously a huge fan of MATLAB, I don't think you can infer that it is better simply because it is commercial. As a counterexample to that idea, I would point to R, which many many folks would say is vastly superior to either SAS or SPSS.

Sign in to comment.

Answers (1)

the cyclist
the cyclist on 1 Feb 2024
Disclaimer: I barely qualify as a Python programmer.
I don't know of any benchmarking specifcally in optimization problems. I've seen a few comparisons among languages through the years (e.g. this one),
I think one challenge with a language like Python is being absolutely certain that you are using the most rigorous and well-tested packages available. It is not always the easiest one to find via google. Obviously scipy is a fantastic all-purpose package, but that doesn't make it the best for optimization problems.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!