Intro to Scipy Optimization: Minimize Method

  Рет қаралды 40,165

TokyoEdtech

TokyoEdtech

Күн бұрын

Пікірлер: 66
@codingmadeeasy3126
@codingmadeeasy3126 3 жыл бұрын
You can also use manim the python library to visualise math and graphs. Also I think in f(x) you will have to integrate it with -infinite to positive infinite to make the calculation with more precision. Although I can be wrong since I am rusty with my integration skills..
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
I can't speak to the manim library but it sounds useful. EDIT: We need to take the derivative and solve for 0 to find the minimum. However, the scipy library is used for machine learning and it figures out the values using its own methods.
@lencone
@lencone 2 жыл бұрын
Thanks man, it was very comprehensive
@TokyoEdTech
@TokyoEdTech 2 жыл бұрын
You're welcome. Keep on codin'!
@Balamayooran
@Balamayooran 12 күн бұрын
Hi sir, can we do this optimization through from scipy.optimize import linprog
@TokyoEdTech
@TokyoEdTech 12 күн бұрын
@@Balamayooran I believe so - might want to try it and report back!
@Balamayooran
@Balamayooran 11 күн бұрын
@@TokyoEdTech , Hi sir, thanks, when it comes to area, then this will be non-linear type, so I think from scipy.optimiza import linprog is not suited, your one is correct
@TokyoEdTech
@TokyoEdTech 11 күн бұрын
@Balamayooran Thanks for the update!
@rohitbuddabathina
@rohitbuddabathina 6 ай бұрын
Very well explained. Thanks bro🤗
@TokyoEdTech
@TokyoEdTech 6 ай бұрын
Cheers!
@rohitbuddabathina
@rohitbuddabathina 6 ай бұрын
@@TokyoEdTech Hey, Is this video a part of any playlist? Do you have more videos on optimization?
@TokyoEdTech
@TokyoEdTech 6 ай бұрын
@@rohitbuddabathina Sorry, this is the only one.
@mahtabyaghouti5446
@mahtabyaghouti5446 2 жыл бұрын
Hey, thank you! BTW do you know what is the name of the optimization method?
@TokyoEdTech
@TokyoEdTech 2 жыл бұрын
You're welcome. Sorry, not sure -it's probably in the documentation somewhere.
@trueresolute
@trueresolute 3 жыл бұрын
hi, how can u minimize x**2 using Conjugate gradient method using above method?
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
I'm not sure how to set the method. The formula is easy, but check the docs for more info on choosing the method.
@kitchencrumb4031
@kitchencrumb4031 3 жыл бұрын
How/Can I use this library to make a 1/Y^2 line fitting?
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
I'm not really sure what you mean - I think what optimize does is finds the lowest result of an equation.
@furkanyanmaz5190
@furkanyanmaz5190 3 жыл бұрын
Can you make a video about PyQt5?
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
I'm curious about that too, but I haven't tried it yet. Sorry.
@RachelDance
@RachelDance 3 жыл бұрын
Hi - I have a function with 6 inputs, 4 of which I want it to change values for optimisation (call them a,b,c,d), and the other two I need it to ignore, one of them is a simple scalar (t=0.01 say so i could set a bound of (0.01,0.01) to force it to have that value), but the other (X) is a huge list (its the y values of an xy plot, there are 100,000 values) so i cant simply set bounds for it like (1,1), as its an array. The function uses X and t, but I only want to change the a,b,c,d in maximising. How can i set this up so that it can ignore X and t? Its like, I only want to pass it guess values for *some* of the variables, but if I dont provide them all it will fall over right? Any help appreciated :D
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
That's a tough one - not 100% sure. Pretty much all I know is what I put in the video. The only thing you can try is to use lists for the variables that change and tuples for the ones that don't. Just a guess though. Good luck!
@SaintcantfeintIIOKII
@SaintcantfeintIIOKII Жыл бұрын
how do i remove the message" optimization successfull " mssg , i check on overstack and it told me to do disp="False"...but im thinking im doing it wrong...could someone help
@TokyoEdTech
@TokyoEdTech Жыл бұрын
Can you share all of your code and I'll take a look?
@SaintcantfeintIIOKII
@SaintcantfeintIIOKII Жыл бұрын
@@TokyoEdTech nm i solved it ty
@TokyoEdTech
@TokyoEdTech Жыл бұрын
@@SaintcantfeintIIOKII Good to hear. What was the solution?
@0alcoholism2
@0alcoholism2 3 жыл бұрын
Hey, love the video, just have one question. If I am returning multiple variables in a function that I want to minimize, how do I do that ?
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
I'm not sure how you'd go about that - there's probably a way, but I haven't tried it. This is really all I know about the subject. Sorry!
@0alcoholism2
@0alcoholism2 3 жыл бұрын
@@TokyoEdTech dont worry about it lol, I did find a work around tho. If I want to maximise one variable and minimize the other, I just set a separate variable which is the division of the maximised variable and the minimized one. then I maximize that new variable. I also include a print statement in the function to see the values of the 2 variables. To maximise or minimise 2 variables, I just add them and then do the same process.
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
Clever!
@NtotheGMC
@NtotheGMC 2 жыл бұрын
Hey is there a way to make it so that the values only use integers for x? For example with the fence: say you can only build 1 meter fence blocks.
@TokyoEdTech
@TokyoEdTech 2 жыл бұрын
Interesting question! I found this on StackOverflow: stackoverflow.com/a/47316508
@avanishparmessur5032
@avanishparmessur5032 Жыл бұрын
thanks, this is pretty detailed
@TokyoEdTech
@TokyoEdTech Жыл бұрын
You're welcome - hope it comes in handy!
@superkb172
@superkb172 3 жыл бұрын
Good job, oh question, have you done a pacman remake?
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
Thanks. No Pacman yet, but one of my students modified my maze game tutorial into Pacman so that might be a good place to start.
@superkb172
@superkb172 3 жыл бұрын
@@TokyoEdTech interesting 🤔
@miyirbek6821
@miyirbek6821 3 жыл бұрын
Hi Bro. I hope you are ok. Could make a video , which draws quadratic functions parabola.
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
Hi Mix. Sorry, I'm not 100% sure how to do that one myself - I'd use the matplotlib library. I have a video about it on my channel.
@mishra___vaibhav
@mishra___vaibhav Ай бұрын
why you used xstart = 2
@TokyoEdTech
@TokyoEdTech Ай бұрын
As I said in the video it's a guess.
@yuyuan4593
@yuyuan4593 2 жыл бұрын
why minimize returns initial value sometime?
@TokyoEdTech
@TokyoEdTech 2 жыл бұрын
Not sure - maybe the initial value also happens to be the initial value?
@prashanths4455
@prashanths4455 2 жыл бұрын
thanks a lot man
@TokyoEdTech
@TokyoEdTech 2 жыл бұрын
You are welcome - keep on codin'!
@ДарьяКорнеева-с9ь
@ДарьяКорнеева-с9ь 3 жыл бұрын
Many thanks!
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
You're welcome!
@EgmatXelugo
@EgmatXelugo 2 жыл бұрын
THANK YOU !!!
@TokyoEdTech
@TokyoEdTech 2 жыл бұрын
You're welcome! I had to learn this for class - they just expected us to figure it out. Glad I could help.
@ewnetuabebe5059
@ewnetuabebe5059 3 жыл бұрын
What a bout newton method and steepest method for optimization
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
Not sure - check the documentation. There's lots in there!
@mishka5169
@mishka5169 3 жыл бұрын
👍🏼👍🏼👍🏼
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
:)
@mishka5169
@mishka5169 3 жыл бұрын
@@TokyoEdTech :)
@excursion5246
@excursion5246 2 жыл бұрын
Thanks
@TokyoEdTech
@TokyoEdTech 2 жыл бұрын
You're welcome!
@godzilla9289
@godzilla9289 3 жыл бұрын
what if you have three constraints? How to put them in the result? result = spo.minimize(f,xy_start, constraints = con1+con2+con3 ??????). or what? could you help me with that?
@TokyoEdTech
@TokyoEdTech 3 жыл бұрын
Try using a list.
@raj345to
@raj345to 10 ай бұрын
you were maximizing area in the second problem but used minima
@TokyoEdTech
@TokyoEdTech 10 ай бұрын
Yep. This is explained here: kzbin.info/www/bejne/fWHcgZKKgpKil8ksi=f-_XBLyx_tZNaMeN&t=1111
@JohnChu-z4w
@JohnChu-z4w Жыл бұрын
watched 2023.9.9
@TokyoEdTech
@TokyoEdTech Жыл бұрын
Thanks for stopping by!
Python Game Programming Tutorial: Snake Game Part 2
14:19
TokyoEdtech
Рет қаралды 160 М.
Python Tutorial: Learn Scipy - Optimization (scipy.optimize) in 13 Minutes
13:36
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
SciPy Beginner's Guide for Optimization
11:03
APMonitor.com
Рет қаралды 299 М.
SciPy Tutorial (2022): For Physicists, Engineers, and Mathematicians
1:33:29
Optimize with Python
38:59
APMonitor.com
Рет қаралды 15 М.
Intro to AI: Breadth First Search
27:39
TokyoEdtech
Рет қаралды 300
Solve Optimization Problems in Python Using SciPy minimize() Function
17:10
Aleksandar Haber PhD
Рет қаралды 7 М.
Optimization in Python: Pyomo and Gurobipy Workshop - Brent Austgen - UT Austin INFORMS
1:11:46
INFORMS Student Chapter - UT Austin
Рет қаралды 42 М.
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН