Here is some background and more thoughts/references on this on this topic: https://github.com/brohrer/sharpened-cosine-similarity
1,916 karma · joined May 7, 2017
My research is in hardware acceleration, applied machine learning, and intelligent EDA tools among many other interests.
https://stefanabikaram.com/
stefanabikaram@gatech.edu
Here is some background and more thoughts/references on this on this topic: https://github.com/brohrer/sharpened-cosine-similarity
From my understating, if you want to only able to only pick form a discrete set of components for certain variables, you are essentially transforming the problem into a Mixed-Integer Non-Linear Optimization problem (MINLP). I tried to find and easy way to do this with some python optimization libraries but they always needed other packages which were hard to install on Windows. So my solution was to "relax" the discrete constraints by using a continuous approximation of the minimum function when looking at the error from the nearness comment value that is possible. This also lets you assign weighting to have a tradeoff between having realistic comment values vs. having lower error for your main objective.
But you are correct in that after my second or third electronics lab I realized that even standard component values vary to much that this approach is a little overkill and non-practical in a lot of cases. However there is a way to bake in discrete component values into the continuous optimization problems by using a continuous/"soft"/differentiable approximation of the min function to make "pockets" of optimal regions close to component values part of a set (for example e series values). I plan to do more writeups exploring this idea as well as looking at more complex applications such as higher order filters as you mentioned (my op-amp filter labs are what motivate me to look into this as I wasted so many hours in open lab trying to get my component values right).
https://en.wikipedia.org/wiki/Logistic_function#Modeling_ear...
Link: https://www.youtube.com/watch?v=z_hm5oX7ZlE&list=PL2Uw4_HvXq...