How autocorrelation works

Поділитися
Вставка
  • Опубліковано 9 чер 2024
  • Part of the End-to-End Machine Learning School Course 212, Time-series Analysis at e2eml.school/212
    To use autocorrelation in a weather prediction model, check out the Time-Series Analysis project course:
    end-to-end-machine-learning.t...
    Slides are available: docs.google.com/presentation/...
    Follow me for announcements and update: / _brohrer_
  • Наука та технологія

КОМЕНТАРІ • 128

  • @ranitdey7369
    @ranitdey7369 2 роки тому +5

    This is simply excellent. I haven't seen a better explanation of this concept.

  • @MrVishyG
    @MrVishyG 4 роки тому +13

    Well explained! Very natural transition from topic to topic until I accidentally learned autocorrelation.

  • @anighosh920
    @anighosh920 3 роки тому +9

    This is the best video ever on autocorrelation! Thank You!

  • @daesoolee1083
    @daesoolee1083 4 роки тому +1

    Woah, thank you, Sir. This short tutorial gets me to understand this entire auto-correlation thing than 10 page pdf explaining with all kinds of formulas .

  • @valerianmp
    @valerianmp 5 років тому +4

    Thank you very much. This give the insight for ACF, not just mindlessly calculating them

  • @RashmiBanthia29
    @RashmiBanthia29 4 роки тому +10

    Autocorrelation 7:02
    Partial Autocorrelation 9:45

  • @joeaustinathimalamaria624
    @joeaustinathimalamaria624 4 роки тому +2

    Came to revise Autocorrelation. Ended up revising regression too. Great video.

  • @visualdad9453
    @visualdad9453 4 роки тому +4

    One of the best videos about acf

  • @antuirno
    @antuirno 5 років тому +4

    The kind of explanation I was looking for! Thanks!!!

  • @S4KDK
    @S4KDK 5 років тому +1

    Great explanation with such a good example.
    Easy to understand too.
    Thanks!

  • @VictorGoncharov-ln1dp
    @VictorGoncharov-ln1dp 3 місяці тому +2

    Nice video, the best one I've seen yet about the concept of partial autocorrelation!

  • @AbrahamSalazar210
    @AbrahamSalazar210 3 роки тому +1

    Excellent explanation with an easy-to-follow example!

  • @bazoozoo1186
    @bazoozoo1186 6 років тому +1

    Brandon's videos deserve a lot more likes and views. Very underrated.

  • @wexwexexort
    @wexwexexort 4 роки тому +4

    I watched this 2 years ago. Didn't understand the concept. I watch again in quarantine days.

  • @alexeykokh8240
    @alexeykokh8240 5 років тому +1

    Cool description, very detailed, with lots of graphs

  • @oliverbalbuenahernandez43
    @oliverbalbuenahernandez43 4 роки тому +3

    Best video on this topic. Thank you!

  • @Patapom3
    @Patapom3 6 років тому

    Another great and super clear explanation! Thanks.

  • @kshanepaswett261
    @kshanepaswett261 2 роки тому +4

    Thank you for existing.

  • @Ikarus2985
    @Ikarus2985 2 роки тому +16

    And this is where the info on autocorrelation starts: 6:57

  • @1Bugatti1
    @1Bugatti1 2 роки тому +2

    Hello Brandon,
    thank you for the explanation. Especially the code helped to understand whats happening.

  • @rodrigocarvalho6426
    @rodrigocarvalho6426 4 роки тому +1

    Very good video. In Numerical Methods it always helps to visualise what you are doing

  • @niveyoga3242
    @niveyoga3242 3 роки тому +1

    This was explained excellently!

  • @checkpeck
    @checkpeck 5 років тому +2

    best explanation found till now

  • @stephanie_ong
    @stephanie_ong 4 роки тому +2

    Great video! I liked how you presented the python code that would perform what you're explaining.

  • @m.raedallulu4166
    @m.raedallulu4166 Рік тому +4

    Very nice demonstration!

  • @everything_is_on_fire3155
    @everything_is_on_fire3155 5 років тому +1

    Really helpfull
    And straight forward
    U r genius man

  • @whenmathsmeetcoding1836
    @whenmathsmeetcoding1836 5 років тому +1

    this is best available in you tube thanks it was very helpful

  • @pv1234567890pv
    @pv1234567890pv 3 роки тому +1

    Amazing video! Very useful. Thanks!

  • @AnkitGupta-zk6pz
    @AnkitGupta-zk6pz 11 місяців тому +4

    Great explanation, Thank you.

  • @ruthgerrighart1669
    @ruthgerrighart1669 6 років тому +2

    Very nice and clear video!

  • @RagibShahariar
    @RagibShahariar 3 роки тому +2

    I really liked the autocorrelation part!

  • @moesaleh12
    @moesaleh12 5 років тому +1

    Nice and clear explanation. I will add at 4:30. That the points can fit the line very well but there is no correlation. It is the case when the fitted line is parallel to the x-axis or y-axis. It is the case of near zero variance variables.

  • @alteshaus3149
    @alteshaus3149 3 роки тому +1

    Very clearly explained!
    Great video

  • @AONomad
    @AONomad 2 роки тому +2

    You covered regression better than videos on regression 👏

  • @romellfudi
    @romellfudi 5 років тому +3

    Thanks a lot, view the code helpful to understand quickly

  • @neelabhchoudhary2063
    @neelabhchoudhary2063 6 днів тому +1

    this was super helpful

  • @carlosnavarro9588
    @carlosnavarro9588 3 роки тому +3

    Amazing explanation, subscribed!

  • @Tom-qk4jq
    @Tom-qk4jq 3 роки тому +2

    really helpful video, thank you for this

  • @bulletkip
    @bulletkip 5 років тому +3

    fantastic explanation

  • @yungrabobank4691
    @yungrabobank4691 3 роки тому +2

    Excellent explanation, thank you!

  • @nirjhorchakraborty1861
    @nirjhorchakraborty1861 3 роки тому +1

    Stellar explanation!

  • @leonsponzoni
    @leonsponzoni 6 років тому

    Auto correlation sounds useful for finding data cycles. Like every year temperature correlation, around ~365 days shift~, there is probably a max again. You can find cycles in shifts where correlations peak.
    Also thanks for showing how it can be refined the same way as tailor series. Didn't cross-concept that correlation can give differentials weight for interpolation.

  • @consideration8881
    @consideration8881 4 роки тому +1

    nice and concise video!!

  • @brandonp3991
    @brandonp3991 2 роки тому +1

    This is amazing, thank you

  • @siddharthrawat7205
    @siddharthrawat7205 3 роки тому +2

    Brendon, I would so love to learn ML from you. teaching code along with concept would definitely decrease the MSE between ignorance and knowledge. Thanks

    • @BrandonRohrer
      @BrandonRohrer  3 роки тому +1

      Thanks Siddarth! In case you're interested, there's a whole collection of concept-with-code courses at e2eml.school/catalog

  • @IslandRai
    @IslandRai 4 роки тому +1

    Good job on this video!
    I wish it would have showed up when I searched for information on ARIMA, all the ones that did were pretty poor.

  • @Alexander-pk1tu
    @Alexander-pk1tu 2 роки тому +1

    very good video!! Thank you

  • @sohailhosseini2266
    @sohailhosseini2266 2 роки тому +1

    Thanks for the video!

  • @yungrabobank4691
    @yungrabobank4691 3 роки тому +10

    Where you use the word "shift", when describing autocorrelations, wouldn't it be better to use the word "lag", as I've seen this appear in literature more often and am now wondering whether they're the same thing

    • @kapricun
      @kapricun 2 роки тому

      they are used interchangeably, as well as the word "delay"

  • @DebatingDog
    @DebatingDog 5 років тому +2

    Instead of using list slicing it is a bit easier to use the "shift" method from the pandas library. The video in general is great :)

  • @mohammedalmarakby1221
    @mohammedalmarakby1221 Рік тому +3

    thanks for the great video, @4:57 should the greater than and smaller than signs be flipped in the moderate correlation plot ?

    • @BrandonRohrer
      @BrandonRohrer  Рік тому +1

      Thanks mohammed, you're exactly right :)

  • @cypherecon5989
    @cypherecon5989 Рік тому +2

    temp_change is not defined in your code is it? Something is missing there.

  • @BM-uf4pp
    @BM-uf4pp 3 роки тому +1

    great video man

  • @matthiasrichter9264
    @matthiasrichter9264 6 років тому

    Very nice and explanatory video! Thanks! One thing that you could also do is mention real-world applications. A toy model is always very helpful for me to *understand* a topic but real-world application helps me to also *motivate* it.
    Besides that keep it up your videos are super nice! :)

    • @dribblersmy
      @dribblersmy 6 років тому

      I am also currently learning so I'm not sure if my idea is entirely correct, you could use this for any data set, to see how it changes. You could use the auto-correlation on gas prices to see how it changes with time, on flight tickets to see how it changes on a day to day basis or even on the price of a big mac to see how it has changed over the years.

  • @anindadatta164
    @anindadatta164 3 роки тому

    If in the time series , the residuals on temperatures day i after fiting temp(i-1) are correlated with actual temperatures of day i , then can it be said the there is partial auto correlation with lag beyond (i-1). If that method holds good ,then it could be much easier method of detecting PACF.
    But I have liked your video also.

  • @tariqahassan5692
    @tariqahassan5692 7 місяців тому +1

    Very very nice explain .. many thanks

  • @TheAmolchavan
    @TheAmolchavan 3 роки тому

    I was looking for good video to understand the concepts and this video has done that. I have the following questions:
    - Can we do correlation to compare stock market bottoms or tops? If we compare the market price by its 1 day 1 week prior price then will this help in prediction of top or bottom?
    - How can we compare two asset prices? I am thinking of below methods
    - Do a ratio of two asset prices and run the n-1 vs n comparison of the ratio
    - Do a ratio of two asset prices and compare the ratio vs one of the asset prices
    - Compare the % return of each assets against each other on X and Y axis
    Let me know what do you think

  • @Mark_Isaiah
    @Mark_Isaiah 4 роки тому

    do you know how to do a white noise time series to test for seasonality?

  • @mohammedsaeed7241
    @mohammedsaeed7241 2 роки тому +2

    Amazing video, but the autocorrelation loop contains a bug. for shift in range(10) will start from zero, and when you temp[ : -0] you will get an empty array, and your code won't work, because you will do a corrcoef of an empty matrix with another that contains data, thus, the correct loop will be something like: for shift in range(1,10)...thanks a lot for the vid

  • @dnyanadaarjunwadkar7441
    @dnyanadaarjunwadkar7441 6 років тому

    This is great. Thanks

  • @anaskhan4841
    @anaskhan4841 2 роки тому +1

    Great Video

  • @timetraveller3647
    @timetraveller3647 5 років тому +1

    Thank you!

  • @KAUSHALRMODI
    @KAUSHALRMODI 2 роки тому

    In partial autocorrelation, the graph for shift 2 is incorrect, it has to show the points tilted along the 1st fit.

  • @rezaulkarimmamun6211
    @rezaulkarimmamun6211 5 років тому +1

    How to compare two voice signal similarity in python?

  • @ishan7975
    @ishan7975 4 роки тому +1

    wonderful!

  • @gagnon124
    @gagnon124 3 роки тому +1

    great video

  • @omaramil5103
    @omaramil5103 8 місяців тому +2

    Wow thank you

  • @totochandelier
    @totochandelier 5 років тому +1

    Thanks a lot!

  • @bilalkarsl671
    @bilalkarsl671 4 роки тому +1

    THANK YOU

  • @stepover12
    @stepover12 5 років тому

    I think you might be conflating 2 different concepts: 1. de-trending the timeseries before forecasting with AR, 2. partial auto-correlation.
    For example the first de-trending step may not be just fitting a straight line, it could be non-linear or have seasonality etc. This is unrelated to PACF which teases out what marginally new information are gained with each auto-correlation step

  • @dribblersmy
    @dribblersmy 6 років тому +1

    Thank you! :D

  • @anindadatta164
    @anindadatta164 3 роки тому

    It is not clear in the video how much residual of the previous periods to be added to the time series equation of the present period.

  • @Yifzmagarki
    @Yifzmagarki 4 роки тому +1

    I think you have small error on screens, please 11:02 , on left graph should be "temperature on day i-1"

  • @darmstadtvideo
    @darmstadtvideo 4 роки тому +1

    nice and clear explanation for this useful concept! for me its just not clear how to determine whether or not a value is still whithin the 95% confidence interval? R is giving some limits but there it remains unclear as well how to calculate those boundaries..

    • @BrandonRohrer
      @BrandonRohrer  4 роки тому

      Thanks darmastadvideo! This is important, but unfortunately didn't make it into this video. I'll have to save it for a future one.

  • @carbon273
    @carbon273 4 роки тому +1

    Intuitively, how does one gather the data for the temperature scatter plot for autocorrelation? This is my only stumbling block.

    • @BrandonRohrer
      @BrandonRohrer  4 роки тому

      To see a detailed example in practice (including step-by-step data collection and organization), check out e2eML course 212: e2eml.school/212

  • @armitosmt5753
    @armitosmt5753 4 роки тому +9

    Sounds like George Clooney explains it

  • @Arthur-nf9dm
    @Arthur-nf9dm 3 роки тому +1

    Is the autocorrelation with zero lag always 1? Because I've read that Gauss-Markov processes have the following equation for autocorrelation:
    autocorrelation(lag) = variance*exp(-constant*lag)
    In the case of this formula, autocorrelation(0)=variance (!!!) why is it different in this case?

    • @eloboa5355
      @eloboa5355 3 роки тому +2

      no question about this. with no lag, you're basically computing the correlation of a variable with itself. Any algorithm that gives you something different than 1 in this case simply fallacious.

  • @alirezafarhadizadeh5674
    @alirezafarhadizadeh5674 2 роки тому

    Excellent

  • @alimahmood4158
    @alimahmood4158 4 роки тому

    can i have the data sample sir on the basis of which you are calculating thanks

  • @thechhavibansal
    @thechhavibansal 2 роки тому +1

    Thank you :)

  • @zeracyb3318
    @zeracyb3318 5 років тому

    Thanks !

  • @JagoBridgland
    @JagoBridgland 4 роки тому +1

    im confused! So when you talk about correlating the shifted (lagged) dataset. Lets say in an AR(1) process you shift the Y values by 1 day, does that mean the Y-1 dataset will have 1 less data point than the original Y dataset? And by extension if you specify an AR(10) process are you then knocking off 10 data points and hence correlating two datasets where one dataset has 10 less data points than the other?
    Sorry if i explained that like a moron, maybe this will help:
    let's say
    y = [1,2,3,4,5,6,7,8,9,10]
    y-1 = [1,2,3,4,5,6,7,8,9]
    y-2 = [1,2,3,4,5,6,7,8]
    y-3 = [1,2,3,4,5,6,7]
    y-n = [.........]
    so for example if i'm interested in specifying an AR(3) process, to determine the autocorrelation would i just find the correlation coefficient between y & y-3:
    y = [1,2,3,4,5,6,7,8,9,10]
    y-3 = [1,2,3,4,5,6,7]
    i am confused as to whether the fact you are correlating a [1,10) with a [1,7] is correct? or an issue? or what!
    sorry this was really long!

    • @dhirendrasingh7379
      @dhirendrasingh7379 4 роки тому +1

      yes .
      Think of it like this , when you are using a lag of 1 , you are comparing every day value to its previous day value therefore automatically for day 1 you won't have anything to compare it to. But it doesn't matter , the data points left are enough to give an accurate correlation value.

    • @JagoBridgland
      @JagoBridgland 3 роки тому +1

      Dhirendra Singh amazing, thanks so much for the response. I have since experimented with some data and it makes much more sense now! Cheers mate

  • @Lyndanet
    @Lyndanet 3 роки тому +1

    Appreciated

  • @ferozshahquriashi3021
    @ferozshahquriashi3021 4 роки тому +6

    Close your eyes and you can hear Matthew McConaughey explaining autocorrelation. The only thing missing in here "Alright, alright, alright"

    • @xenonmob
      @xenonmob 3 місяці тому +2

      he literally sounds nothing like him

  • @ShiyanAkalankaJayanath
    @ShiyanAkalankaJayanath Рік тому +1

    Nice

  • @fah1064
    @fah1064 2 роки тому +1

    Cool! You get a coordial thanks from me.

  • @silentsnooc
    @silentsnooc 6 років тому +3

    Hi! Great video but there is an error at 5:24 - The correlation is not negative if just the slope of the line is negative. Correlation is negative if the data points and the line have converse slopes.
    %matplotlib inline # JuPyter Notebooks
    import matplotlib.pyplot as plt
    import numpy as np
    n = 10
    x = -np.linspace(0, 1, n)
    y = x + (0.3 * np.random.rand(n)) - 0.3/2
    neg = np.corrcoef(x, y)[0, 1]
    plt.plot(y, marker='o', markersize=4, ls='None', c='k')
    plt.plot(x, label='negative ({:.2f})'.format(neg), c='r')
    plt.legend(); plt.show()

    • @mankindh9183
      @mankindh9183 6 років тому +1

      No error there, video is correct. you are plotting x and y independently on the same plot, not y against x. correct code should be:
      plt.plot(x,y)

  • @zoozolplexOne
    @zoozolplexOne 2 роки тому +1

    cool !!!

  • @10monthspregnant
    @10monthspregnant 6 років тому +1

    Great video! Except:
    Traceback (most recent call last):
    NameError: name 'temp_change' is not defined
    ;)

  • @VY-zt3ph
    @VY-zt3ph 5 років тому +3

    Give this video a like

  • @pigrebanto
    @pigrebanto 5 років тому +1

    good but i think the way you represent the days shift in the code using [1:] and [:-1] is wrong (i do not get the meaning) or please explain what you meant. tks

    • @cetrusbr
      @cetrusbr 5 років тому +2

      It isn't wrong, its just python notation to slice a array. Just google it :)

  • @PikesCore24
    @PikesCore24 3 роки тому +1

    What is the payoff of all this autocorrelation stuff? Once you have fit the data to the line and calculated the correlation, it seems like that is the all the useful information. I can't see where the autocorrelation ads information that would be useful.

    • @sebastianliendo6579
      @sebastianliendo6579 3 роки тому

      Autocorrelation helps understand seasonality/periodicity in time series data, which can determine when will a value repeat itself in the future. A high autocorrelation means the selected shift/lag is likely to be the period; and instead of guessing which lag value will yield a high autocorrelation, we can checkout something called the correlogram. This can be useful, as sometimes the time series has both a trend and seasonality, and the correlogram decomposes it (sort of).

  • @marlonzapata5429
    @marlonzapata5429 3 роки тому +2

    Damn. So mf nice!!! 10 stars

    • @BrandonRohrer
      @BrandonRohrer  3 роки тому +1

      Aw, thanks Marlon. I'm really happy it clicked.

  • @omkarsalunke7117
    @omkarsalunke7117 2 роки тому +1

    👏

  • @zagwask78
    @zagwask78 Рік тому +2

    The graph at 10:46 and the graph at 10:52 are the same but the x-axis is labeled differently. Which is accurate?

    • @zagwask78
      @zagwask78 Рік тому

      And does the correlation coefficient, r, from the regression performed on the graph at 11:02 give you the point on the PACF (2, r)? And the graph at the right I'm confused by. If you are regressing the series with lag 2 against itself it would be a perfect fit. Why are there residuals at all?

    • @keek1337
      @keek1337 Рік тому

      @@zagwask78 doesn’t answer questions, sad :(

  • @typicalidealist9138
    @typicalidealist9138 Рік тому

    🤓

  • @astherphoenix9648
    @astherphoenix9648 2 роки тому

    6:48 you'll pull off??

  • @chrisidema
    @chrisidema 4 місяці тому

    "degrees" is not a unit

  • @charbelhamouche8016
    @charbelhamouche8016 5 років тому

    Bad

  • @parthagarwal4592
    @parthagarwal4592 3 роки тому

    Poor Explanation