Gentle Introduction to Modeling with Matrices and Vectors: A Probabilistic Weather Model
Ғылым және технология
This video gives an intro example of how we model complex systems that change in time, using matrices and vectors. Specifically, I build a toy model for the weather, where the probability of the weather today being "(R)ainy", "(N)ice", or "(C)loudy" is stored in a vector [R, N, C]. This probability of the weather being in one of these states tomorrow is then updated by multiplying this vector by a probability matrix.
Code examples are given in Python and Matlab.
Playlist: • Engineering Math: Diff...
Course Website: faculty.washington.edu/sbrunto...
@eigensteve on Twitter
eigensteve.com
databookuw.com
This video was produced at the University of Washington
%%% CHAPTERS %%%
0:00 Overview
1:07 Building a simple weather model
5:00 Modeling the state as a vector
6:50 Writing the dynamical system update rule as a matrix
14:07 Matlab code example
23:43 Python code example
38:24 Teaser of how to make system more realistic
Пікірлер: 97
As a university professor, Ii would say Steve's lectures are amazing. there are a lot to learn, not only knowledge but also how to teach
@Eigensteve
6 ай бұрын
Thank you for your kind words! I'm glad you find them helpful :)
Its clear Steve loves his work, I am a big fan of these lectures.
Best lecture ever! Thank you, Prof. Brunton. If I had learned like this in university, my life would have been different....
I find my self very fortunate to find Teacher like you.
I am truly happy when I found out this channel and your educational playlist. Thanks a lot.
Thank you, you are an amazing person to take the time to share your knowledge.
Steve, your lectures are simply amazing!
Thank you for bringing complex ideas into simple, easy to digest ideas with your lectures
Fantastic. Dear professor - you are a gift to the humanity!
This The BEST video I've seen that shows the process (however simple) of creating a model and then using math/computer to model. A++ to you Steve!!!
Well done. I'm a professional programmer (whatever that means) and you put joy and mathematics into my heart
I am passionnated by your lectures! I could listen to you for hours!!! Thank you soooo so much for those videos! Having a special background it a hard for me to follow by myself only by books but this gives me so much motivation, thank you so so so much !!!
One of the best lectures since Feynman
Outstanding content, gonna try experimenting with the concepts on my own, thanks.
Thank you, sir... for this excellent concept.🙏🙏
I stumbled upon your channel!!!😁😁😁😁😁...you should know I consider myself very lucky! The concepts are very well explained. I have a project am working on, so the information I glean from here is going to help a lot! Thank you very much for sharing!
Great JOB, Professor ❤
Awesome as always, Steve!
FANTASTIC
I wish you were my professor back in time! Looking forward to meet you someday and thank you for all you've done to your students.
I'm loving this
Has anyone ever told you that you are a legend?! I am a huge fan!
This is peice of Art, I can understand how much work goes behind these lectures, may God give you more power.
Just a great work. Thanks
Much better way to explain. Have to say. Thanks man
Thank you for this very interesting video!
Thank you Prof. Brunton!
Thank you for your lecture
thank you very much! you make maths so interesting and attractive!
Thank you, very interesting video. I would also like to add on my own about the features of the numpy library. A column vector can also be written as a row vector, and if, when multiplying the first one, you specify a matrix, and the second is our row vector, then the numpy library will automatically convert it into a column vector for calculations. This is done for convenience, since when working with vectors, it is quite difficult to constantly write them down and work with them as a column due to the syntax. But here it is important to be careful, because the vector still remains in the row vector notation format. Example: M = np.array([ [a11, a12, a13], [a21, a22, a23], [a31, a32, a33] ]) b_vec = np.array([b11, b12, b13]) - row-vector But if we: M @ b - so in this case won`t be any mistakes. Numpy will automaticly convert b into column-vec and will make correct calculations. And of course if we will multiply them in this way: b @ M - there won`t be any mistake too, because we multiply Matrix (row-vec)1x3 to Matrix 3x3. And we will have another resault
Great video ! Please keep going
I maintain weather stations and have a station near tofino bc not far from seattle and it has received over 10m rain annually. We were there once and the 0.2mm bucket tips were audible at 2/s
It's a great experience learning these concepts with a fresh, application-oriented eye. Could you please include the link to the Jupyter Notebook? Great content always, thanks!
thank you professor
I love it.
fabulous and brilliant 😍😍😍😍 ...
sir steve brunton excellent lecture
Love it! this is a bit easier to see it: for k, ii in enumerate(range(50)): xtomorrow = A@x_today print(f"{k}: {xtomorrow} ") x_today = xtomorrow
how would the eigenvalues & eigenvectors relate to this system and the stable values as k increases?
Thank you
Thanks very much for the python. Free software is fantastic.
@dancollins1012
Жыл бұрын
Octave is an free open source version of Matlab, so you don't need to use Python
@An_Attempt
Жыл бұрын
@@dancollins1012 Thanks for the suggestion, I have tried Octave. The problem that I keep running into is that it is just a tiny bit different than Matlab, which results in a lot of debugging. The main advantage to Octave and Matlab have over python is that they tend to be more succinct. Python is more useful (mostly because of the large quantity of libraries) as general programming language .
@dancollins1012
Жыл бұрын
@@An_Attempt Yes, I know what you mean, Octave does have slight differences. I'm hoping that the examples in this great video series are not so lengthy or complex that it's a problem. I also perceive (may be wrong) that Octave incompatibilities with Matlab are reducing over time. Personally, I can't stand Python, so I'll just make Octave work for me. I guess you, I and others could post debugged Octave code on GitHub and share the fun that way
What book would give me an in-depth intuition into using vectors and matrices to model real world problems? Any recommendations?
The numpy package in Python treats column vectors and row vectors the same. That is why it gave a ValueError. It handles vectors as an order-1 tensor and handles if it's a covariant covector (row vector) or a contravariant (column) vector based on whether its the first or second argument in the dot product / matrix multiplication (@) operation. So in this example, just making the vector a "row" vector would suffice and it would be treated as a column vector when it's on the right side of the @ operator.
If you're used to indexing from 1, try Julia programming language. It too starts its index at 1.
do you think is the A matrix correct , as i see you gave rain 0.5 and rest 0.25 , similarly for earch combination it will be 0.5 and 0.25 respectively , please clarify on this
Steve, question about the eigenvectors . To demonstrate that the probability obtained by the simulation. It was the same as the one from the eigenvector -you choose the first column to normalize it. Why the other columns don't have that information? How did you know which column to pick? 🤔💭
In Seattle, we can have 3 model states: rainy, showery, and drizzly.
Geometry world: S=a+b; Sum is equal to a plus b ;;; Computing world: a
Do you have any info on how thise video is made?
No mention of Markov chains?
how do you write backwards?
For the multiplication Ax yo represent the total probability shouldn't you be working with A transpose (each entry i,j being the probability of going from i to j)?
@karatsurba4791
Жыл бұрын
Could you kindly rephrase your question. What seems ambiguous is your reference to the transpose. Hope that helps
Great video! I have some questions about the transition matrix A. Why are the probabilities in matrix A organized in that particular manner (the columns are conditions today and rows are conditions tomorrow). But what is stopping someone from reversing that order, where the columns are instead conditions tomorrow and the rows are conditions today?
@georgebethel1320
Жыл бұрын
You can't do that vector x is a column vector with each row representing the probability of the weather. You also want to make sure that the resulting vector, after multiplying it by the A matrix is a column vector of the same form as the first vector representation. My point is, you're looking for x tomorrow and for that, tomorrow can't be at the top. It has to be by the side
Despite the fact that all is clear, I'm lost when you define ax1, ax2 etc and then you said a2x1 is the third element? Thank you!
Is the recording speeded up?
I wonder how could the "nice" probability converge to 0.2 if at any timestep is has 0 probability to stay "nice". I mean, if we think about these states as 3 bins for particles, then the 0 probability to get "nice" tomorrow is translated to a statistically constant migration of particles from the "nice" bin to the other two, so that in time I would expect to be left with no particles in the "nice" bin. Am I missing something?
@meunomemauricio
Жыл бұрын
The part that is missing is that there are still "particles migrating" from rainy/cloud into nice. The weather never stays nice for more than a day, but it can still become nice after a rainy or cloudy day (albeit with a smaller probability).
How can he write backwards
Great video. A small point on language, traditionally code, referring to computer code, has been treated only as a class of thing, not as an individual item. So in the past we traditionally said "I have 3 pieces of code" not "I have 3 codes". This is kind of important for people who are learning coding as they often think that software code is a literal code like a cypher for passing secret messages. And then they can picture 3 codes as 3 modified versions of one thing, different cyphers. Clearly they can get past this quickly, but working in a software company and interacting with non-technical people this can present significant challenges in communication. I'm guessing that amongst the younger generation this horse has bolted and there is no going back. Especially with the world getting smaller and people with English as a second language tending to struggle with this concept (my co-worker is always referring to multiple "stuffs" when stuff should never be pluralised) it seems that the English language is rapidly changing to discard nouns that are only ever classes of things. So it seems to be very accepted these days to say "these Python CODES that I'm running" versus "this Python CODE that I'm running", or "I did so many STUFFS on the weekend" versus "I did so much STUFF on the weekend". So be it, but I for one am lamenting this change... One last point, although the video is only an introduction it seems unfortunate to model something that converges like that rather than a more interesting example that is more chaotic. It's fine though to have such a cheesy toy model. Great video over all. Thank you
@freeenergymachineforsale9751
9 ай бұрын
Not sure if this is helpful, but the term for this is "uncountable." Code and stuff are both uncountable nouns.
@nigelhill74
9 ай бұрын
@@freeenergymachineforsale9751 nice, thanks
Also great Gorillaz reference
Markov chain or Markov process
It just occurred to me that Dr. Brunton is probably flipping these videos, and is in fact not an expert in writing backwards.
So do you write backwards, or do you just flip the video?
Oh, I'm a graduate student at UNT! Small world
Wil modelling like this disappear with more 'black box' machine learning/AI approaches?
@karatsurba4791
Жыл бұрын
Highly unlikely.
It is called Markov chains.
@afammadudaniel2982
Жыл бұрын
Beautiful stuff.
@afammadudaniel2982
Жыл бұрын
Is it different from graph?
@basics5427
Жыл бұрын
@@afammadudaniel2982 You can use graph as the mathematical tool to represent lots of problems, e.g. connectivity of points in a physical grid (streets, gas or electricity networks, water pipes), logical relationships between elements, transition in time between states of the system (here) for Markov processes (or chains). Markov Process (or Markov chains) are also the basis of Reinforcement Learning. You can model a stochastic process as: - Markov Process, MP: states, and transitions (probability of) between states; - Markov Reward Process, MRP: states, transitions and rewards associated with transitions; - Markov Decision Process, MDP: states, transitions, set of actions that can be made, rewards. Main goal of Reinforcement Learning is to find the best actions to perform to optimize a total reward
I don’t see the links to the code
@fabricetshinangi5042
Жыл бұрын
click on course website, the code is under Syllabus, part 1, Lecture 1
@TheEicio
Жыл бұрын
@@fabricetshinangi5042 Thanks. That is only the Matlab code, not the Python code he refers to in the video.
@An_Attempt
Жыл бұрын
@@TheEicio It needs to be updated. I think this is a remake of an old class, and he is adding python gradually.
@jesperheuver5779
Жыл бұрын
@@TheEicio seems like the python code is up now!
Thank you for this wonderful lecture Prof. Brunton. Big fan of your teaching skills. I just have a small doubt about the probability matrix. To map x2 from x1, we have a probability matrix A such that x2=Ax1. And then mapping from x2 to x3, we have another probability matrix "A", such that x3=Ax2. you have considered the same A matrix for all three days. In reality, will not there be two different A matrices for three different x (x1, x2, x3)? Why we are taking them same matrix for all the remianing days as well? Or this matrix A is universal for all the x?
@karatsurba4791
Жыл бұрын
Albeit I'm not the prof, I know the answer to your Q. Yes, your understanding is correct, i.e. the probability matrix is updated after each iteration.
@shreddingstranger
Жыл бұрын
@@karatsurba4791 No, the probability matrix A doesn't change, it is the probability vector x that updates every iteration.
For Blaise Pascal, there are two kind of intelligence. People who need to see to understand and people who need to use concepts to understand. First use inductive methods and like artificial intelligence, the others use deductive methods, like to start from principles, like beautiful theories and human intelligence. I wonder if Pr Brunton is from the first or the second kind ...
@AnEnemyAnemone1
Жыл бұрын
An ideally intelligent person uses both “modes” of thought. In fact, I don’t think any person leans that heavily into either mode. For the most part, we all rely on both of these epistemic approaches.
So, is Cloudy a linear combination of Rainy and Nice? -sincerely, a smart ass
5:39 Matrices were invented to represent non-commutative system, i.e. values in each row aren't supposed to be summarized.
🙀
Seattle Convergence....
For R users: myprobs
Can someone please edit the squeaks out. I was really hoping to watch the videos. But the squeaks are jarring.
I have a question, is it to possible to find out what the A matrix knowing what this (50, 3) array that holds the different states ? Thanks
Thank you