How autocorrelation works

Поделиться
HTML-код
  • Опубликовано: 29 июн 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_
  • НаукаНаука

Комментарии • 129

  • @MrVishyG
    @MrVishyG 4 года назад +13

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

  • @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

  • @joeaustinathimalamaria624
    @joeaustinathimalamaria624 4 года назад +2

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

  • @antuirno
    @antuirno 5 лет назад +4

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

  • @visualdad9453
    @visualdad9453 4 года назад +4

    One of the best videos about acf

  • @RashmiBanthia29
    @RashmiBanthia29 4 года назад +10

    Autocorrelation 7:02
    Partial Autocorrelation 9:45

  • @bazoozoo1186
    @bazoozoo1186 6 лет назад +1

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

  • @alexeykokh8240
    @alexeykokh8240 5 лет назад +1

    Cool description, very detailed, with lots of graphs

  • @S4KDK
    @S4KDK 5 лет назад +1

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

  • @oliverbalbuenahernandez43
    @oliverbalbuenahernandez43 4 года назад +3

    Best video on this topic. Thank you!

  • @wexwexexort
    @wexwexexort 4 года назад +4

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

  • @Patapom3
    @Patapom3 6 лет назад

    Another great and super clear explanation! Thanks.

  • @niveyoga3242
    @niveyoga3242 3 года назад +1

    This was explained excellently!

  • @rodrigocarvalho6426
    @rodrigocarvalho6426 4 года назад +1

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

  • @ruthgerrighart1669
    @ruthgerrighart1669 6 лет назад +2

    Very nice and clear video!

  • @stephanie_ong
    @stephanie_ong 4 года назад +2

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

  • @checkpeck
    @checkpeck 5 лет назад +2

    best explanation found till now

  • @RagibShahariar
    @RagibShahariar 4 года назад +2

    I really liked the autocorrelation part!

  • @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

  • @bulletkip
    @bulletkip 5 лет назад +3

    fantastic explanation

  • @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.

  • @consideration8881
    @consideration8881 5 лет назад +1

    nice and concise video!!

  • @romellfudi
    @romellfudi 5 лет назад +3

    Thanks a lot, view the code helpful to understand quickly

  • @IslandRai
    @IslandRai 5 лет назад +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.

  • @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.

  • @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 :)

  • @dnyanadaarjunwadkar7441
    @dnyanadaarjunwadkar7441 6 лет назад

    This is great. Thanks

  • @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.

  • @timetraveller3647
    @timetraveller3647 5 лет назад +1

    Thank you!

  • @ishan7975
    @ishan7975 4 года назад +1

    wonderful!

  • @totochandelier
    @totochandelier 5 лет назад +1

    Thanks a lot!

  • @dribblersmy
    @dribblersmy 6 лет назад +1

    Thank you! :D

  • @neelabhchoudhary2063
    @neelabhchoudhary2063 26 дней назад +1

    this was super helpful

  • @bilalkarsl671
    @bilalkarsl671 4 года назад +1

    THANK YOU

  • @armitosmt5753
    @armitosmt5753 4 года назад +9

    Sounds like George Clooney explains it

  • @zeracyb3318
    @zeracyb3318 5 лет назад

    Thanks !

  • @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

  • @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

  • @Mark_Isaiah
    @Mark_Isaiah 4 года назад

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

  • @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.

  • @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"

  • @rezaulkarimmamun6211
    @rezaulkarimmamun6211 5 лет назад +1

    How to compare two voice signal similarity in python?

  • @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

  • @VY-zt3ph
    @VY-zt3ph 5 лет назад +3

    Give this video a like

  • @alimahmood4158
    @alimahmood4158 4 года назад

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

  • @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.

  • @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 4 года назад +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

  • @10monthspregnant
    @10monthspregnant 6 лет назад +1

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

  • @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)

  • @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 :)

  • @charbelhamouche8016
    @charbelhamouche8016 5 лет назад

    Bad

  • @VictorGoncharov-ln1dp
    @VictorGoncharov-ln1dp 4 месяца назад +2

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

  • @chrisidema
    @chrisidema 4 месяца назад

    "degrees" is not a unit

    • @nexyboye5111
      @nexyboye5111 16 дней назад

      a degree is a dimensionless unit of measurement

  • @tariqahassan5692
    @tariqahassan5692 8 месяцев назад +1

    Very very nice explain .. many thanks

  • @omaramil5103
    @omaramil5103 9 месяцев назад +2

    Wow thank you

  • @AnkitGupta-zk6pz
    @AnkitGupta-zk6pz Год назад +4

    Great explanation, Thank you.

  • @ShiyanAkalankaJayanath
    @ShiyanAkalankaJayanath Год назад +1

    Nice

  • @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 :)

  • @typicalidealist9138
    @typicalidealist9138 Год назад

    🤓

  • @cypherecon5989
    @cypherecon5989 Год назад +2

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

  • @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 :(

  • @m.raedallulu4166
    @m.raedallulu4166 Год назад +4

    Very nice demonstration!

  • @AONomad
    @AONomad 2 года назад +2

    You covered regression better than videos on regression 👏

  • @astherphoenix9648
    @astherphoenix9648 2 года назад

    6:48 you'll pull off??

  • @sohailhosseini2266
    @sohailhosseini2266 2 года назад +1

    Thanks for the video!

  • @KAUSHALRMODI
    @KAUSHALRMODI 2 года назад

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

  • @omkarsalunke7117
    @omkarsalunke7117 2 года назад +1

    👏

  • @kshanepaswett261
    @kshanepaswett261 2 года назад +4

    Thank you for existing.

  • @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

  • @anaskhan4841
    @anaskhan4841 2 года назад +1

    Great Video

  • @ranitdey7369
    @ranitdey7369 2 года назад +5

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

  • @Alexander-pk1tu
    @Alexander-pk1tu 2 года назад +1

    very good video!! Thank you

  • @1Bugatti1
    @1Bugatti1 2 года назад +2

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

    • @BrandonRohrer
      @BrandonRohrer  2 года назад

      I'm glad to hear it Bartosz. Thanks.

  • @alirezafarhadizadeh5674
    @alirezafarhadizadeh5674 2 года назад

    Excellent

  • @Ikarus2985
    @Ikarus2985 2 года назад +16

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

  • @zoozolplexOne
    @zoozolplexOne 2 года назад +1

    cool !!!

  • @fah1064
    @fah1064 2 года назад +1

    Cool! You get a coordial thanks from me.

  • @swathireddy8636
    @swathireddy8636 2 года назад

    I have just now seen a simple and easy video to check auto correlation assumption with Durbin Watson test ruclips.net/video/ZDMQo6ID0sg/видео.html. It was very useful for my research work

  • @brandonp3991
    @brandonp3991 2 года назад +1

    This is amazing, thank you

  • @thechhavibansal
    @thechhavibansal 2 года назад +1

    Thank you :)

  • @Lyndanet
    @Lyndanet 3 года назад +1

    Appreciated

  • @nirjhorchakraborty1861
    @nirjhorchakraborty1861 3 года назад +1

    Stellar explanation!

  • @parthagarwal4592
    @parthagarwal4592 3 года назад

    Poor Explanation

  • @carlosnavarro9588
    @carlosnavarro9588 3 года назад +3

    Amazing explanation, subscribed!

  • @alteshaus3149
    @alteshaus3149 3 года назад +1

    Very clearly explained!
    Great video

  • @BM-uf4pp
    @BM-uf4pp 3 года назад +1

    great video man

  • @Tom-qk4jq
    @Tom-qk4jq 3 года назад +2

    really helpful video, thank you for this

  • @marlonzapata5429
    @marlonzapata5429 3 года назад +2

    Damn. So mf nice!!! 10 stars

    • @BrandonRohrer
      @BrandonRohrer  3 года назад +1

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

  • @pv1234567890pv
    @pv1234567890pv 3 года назад +1

    Amazing video! Very useful. Thanks!

  • @kunalmavani5620
    @kunalmavani5620 3 года назад

    The definition of autocorrelation is not correct. For temps=first 100 natural numbers, I get autocorrelation value as 1 for all different values of 'shift'. And that's not true. Autocorrelation is given by the formula: www.itl.nist.gov/div898/handbook/eda/section3/eda35c.htm
    The relevant Python function for autocorrelation is np.correlate.

  • @gagnon124
    @gagnon124 3 года назад +1

    great video

  • @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.

  • @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.

  • @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"

  • @yungrabobank4691
    @yungrabobank4691 3 года назад +2

    Excellent explanation, thank you!

  • @anighosh920
    @anighosh920 3 года назад +9

    This is the best video ever on autocorrelation! 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

  • @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