What if we want to plot residuals? How can we use polyfit for anomaly detection in data?
@sknnyjnsndvnckss3 жыл бұрын
Awesome video Adam this was more helpful to me in 9 minutes than in the half-hour I spent searching numpy and python websites! My personal gut response at 2:23 would be to type 'for i in range (1,21)' to avoid using (i+1) in the for loop. Would that also be alright to do?
@AMGaweda3 жыл бұрын
Yup, both would generate your 1-20 numbers! It generally depends on what my loop is "doing" but I'll do the version in the video, the range(1,21) style approach, or another tactic I like to do is to make a variable as the first line in the loop that does whatever calculations or "whatever" is needed. I mostly use the last one for when I'm working with lists that have a long variable number, so it just helps shorten my writing.
@nosratullahmohammadi10983 жыл бұрын
Thanks. It was very informative. How to get an error bar for how wrong we are? Like the one that the seaborn regression plot uses?
@AMGaweda3 жыл бұрын
You'd want to use matplotlib's fillbetween function. Here's a link to their documentation with an example similar to seaborn's: matplotlib.org/3.2.1/gallery/lines_bars_and_markers/fill_between_demo.html#example-confidence-bands
@trademain12784 жыл бұрын
Can this be used to forecast a time series such as financial prices?
@AMGaweda4 жыл бұрын
Possibly! Most financial forecasts use linear regression, but it's only like Step 1 of their process. If you end up figuring out how to make millions... I would not complain over some royalties :D