Q5: Good Uses of Machine Learning in Finance · Max Margenot — Transcript
Full transcript
- 0:00chat with Traders collaboration with
- 0:02quantopian episode
- 0:05[Music]
- 0:125 hey how's it going folks Aaron ffield
- 0:15here of chatwi Traders podcast what
- 0:18you're listening to right now is part
- 0:20five in a special six- part series which
- 0:23is of course a collaboration with the
- 0:26good people at quantopian in this
- 0:29episode we explore machine learning in
- 0:31trading and in finance we talk about
- 0:34what is machine learning where it's
- 0:35commonly used in everyday life and what
- 0:39are some of the good and not so good
- 0:41ways that quants may use machine
- 0:43learning joining myself and Delaney is
- 0:47Max margut Max is a data scientist at
- 0:51quantopian and needless to say he knows
- 0:53a lot about the subject matter uh just
- 0:56to run through a few things real quick
- 0:58if you have any questions please go to
- 1:01quantopian
- 1:14docomo
- 1:16and.com chatwi Traders you'll find
- 1:19everything there all in one place and
- 1:22also props to datacamp for sponsoring
- 1:26this series as I've been preaching datac
- 1:28camp.com in my opinion is probably the
- 1:32best place you could go to learn how to
- 1:35program particularly for working with
- 1:37data in languages Python and R they
- 1:41courses some of which are entirely free
- 1:43and talked by talented data scientist uh
- 1:46very interactive there's videos there's
- 1:49coding tasks and much more all of which
- 1:52you can complete online using their
- 1:54portal really good stuff so visit datac
- 1:57camp.com today sign up for a free
- 1:59account and get stuck into one of their
- 2:02online courses which cater for
- 2:04programmers of all levels beginner
- 2:06through to intermediate again that's
- 2:09datac
- 2:10camp.com last thing I should point out
- 2:12to you is the next episode and the final
- 2:15episode in the series is the Q&A episode
- 2:18so these episodes have been coming out
- 2:21weekly but I'm not exactly sure when
- 2:23this next episode will be released it's
- 2:26likely to be in January sometime though
- 2:29but if you follow me on Twitter I'll of
- 2:31course keep you posted anyway let's get
- 2:34to it haris Delaney and Max margut to
- 2:37talk all things machine learning and
- 2:42trading Delaney here we are episode 5 um
- 2:45I'm excited to be doing this we're
- 2:47discussing something very interesting
- 2:48today machine learning we're also joined
- 2:51by Max Max I'm not even going to attempt
- 2:54to pronounce your last name because I
- 2:56know uh even Delaney struggles with that
- 2:58one so Ma I'll leave that part up to you
- 3:01but I mean tell us a little bit about
- 3:02your story give us a quick introduction
- 3:04and um you know just bring us up to
- 3:06speed with who you are and your
- 3:07experience in the
- 3:09field yeah so I'm a Max margut it's a
- 3:12tough one but I'm a I'm a data scientist
- 3:14at quantopian I also help to manage the
- 3:16lecture series I've done a lot of math
- 3:20and statistics in the past I've messed
- 3:22around with uh a lot of like
- 3:23cryptocurrency stuff uh a lot of trading
- 3:26bots on bitcoin uh some of them
- 3:28involving machine learning uh some of
- 3:30them uh not involving machine learning
- 3:33but generally stuff that I found
- 3:35interesting that other people may or may
- 3:36not find interesting so a lot of math a
- 3:38lot of statistic stuff that's awesome no
- 3:41I think that's very cool What attracted
- 3:43you to to cryptocurrencies so you still
- 3:45do you still Mark around with that sort
- 3:46of thing currently I'm actually not
- 3:48allowed to but what uh what mainly drew
- 3:52me to them in the first place was I was
- 3:53a little involved with Bitcoin when like
- 3:55they first started happening like I
- 3:57heard about it years and years ago and I
- 3:59was like right I I'll mine some of this
- 4:01on my own computer so I got into it then
- 4:03and then I got back into it uh when I
- 4:05realized that the um the apis for the
- 4:09online exchanges uh the ways that I
- 4:11could get like my Bots and everything to
- 4:13communicate with them were very
- 4:15simplistic compared to like actual
- 4:18trading uh like stocks or anything uh
- 4:21apis so I would just like all right I'm
- 4:24going to build bots on cryptocurrencies
- 4:26because it's easier okay okay awesome so
- 4:29you actually got involved in the mining
- 4:31side of it as well yeah not super into
- 4:34it because this was back when I was
- 4:37still pretty terrible at computers I
- 4:39guess so I didn't really have a proper
- 4:42setup for it it was just mining on my uh
- 4:45just on my desktop computer nothing
- 4:47special okay so what part do you play at
- 4:50quantopian today tell us a little bit
- 4:51about that yeah so as part of the
- 4:55academic team I am R and Delaney I run a
- 4:58quantitative fin lecture Series so we
- 5:02basically have this curriculum of just
- 5:05curated IPython notebooks in our
- 5:07research environment and we just kind of
- 5:10while we have a bunch of individual
- 5:12lectures on statistical Concepts and
- 5:14financial Concepts building up from like
- 5:16the very most basic stuff like how do we
- 5:19even use Python how do we even use um
- 5:22some very basic uh python packages and
- 5:25what is a mean or a variance or a
- 5:28standard deviation up through uh like
- 5:31actual examples of building trading
- 5:33algorithms like pairs trading algorithms
- 5:34or long short Equity algorithms so it's
- 5:36a pretty wide range of content yeah yeah
- 5:39delane's referenced it many times during
- 5:41the series so you know anyone who's
- 5:43listening is is aware that those
- 5:44lectures are all available I think it's
- 5:46at quantopian
- 5:51docomo this sort of thing yeah so I have
- 5:54a uh Bachelor's in math minor and
- 5:57computer science and then I have a
- 5:59master's in mathematical Finance very
- 6:01impressive man all right cool well let's
- 6:04get let's get stuck into it so I mean
- 6:06first things first at a very high level
- 6:09what is machine learning you know many
- 6:11people have probably heard the term but
- 6:14many people probably don't fully
- 6:17understand it as well so yeah let's
- 6:19start right there what is machine
- 6:21learning I mean machine learning is a
- 6:25really really broad field and uh it's
- 6:28also something that means many different
- 6:30things to many different people right
- 6:31now I think cuz it's such a young field
- 6:34it's to an extent in its infancy and um
- 6:37there's so much excitement and you know
- 6:39what's called you know I call it a hype
- 6:41cycle around machine learning that
- 6:43everybody's excited about it now and so
- 6:45there's tons of people trying to get
- 6:47into it and you have all the people who
- 6:49have kind of been doing this forever
- 6:51being like I don't understand what's
- 6:53going on I have all these people I've
- 6:54never seen before in my house and
- 6:56they're trying to do all the same things
- 6:58I usually do but they're not doing it
- 7:00right so it's kind of it's it's really
- 7:02it's crazy right now what's going on in
- 7:03machine learning at its core and kind of
- 7:06I'll give kind of my very broad
- 7:07definition of it um I'm sure Max will
- 7:09also have a different angle on it but
- 7:11like at its core I view machine learning
- 7:14as any kind of um kind of automated
- 7:18statistical process uh that attempts to
- 7:22find patterns in data so when you talk
- 7:25about the work that statisticians do on
- 7:28a day-to-day basis a lot of machine
- 7:31learning is really just an attempt to
- 7:33actually automate that work itself and
- 7:36have the machine run tests the machine
- 7:38find patterns the machine fit models and
- 7:41there's like a ton of different ways you
- 7:43can do that but you think that's like
- 7:46about about right or yeah I I definitely
- 7:49agree with that I think like the
- 7:50patterns is definitely the biggest thing
- 7:53uh it's just like a class of algorithms
- 7:55and how people actually Implement them
- 7:56is going to vary okay sure so while
- 8:00we're talking about this at a very high
- 8:01level right now in what areas outside of
- 8:04Finance are machine learning techniques
- 8:07applied I mean it might be helpful for
- 8:09you know people listening to this who
- 8:11are unfamiliar with machine learning to
- 8:13think about how it's used in sort of
- 8:16almost everyday life I mean a good
- 8:19example of this is probably talking
- 8:22about credit card fraud
- 8:24detection um and that's not frog not
- 8:27frog is in the animal which which I
- 8:29always I always say by accident but
- 8:31credit card fraud is in someone stealing
- 8:33your credit card and using it for their
- 8:35nefarious purposes and um obviously this
- 8:38is like a huge industry uh detecting
- 8:41credit card fraud uh and obviously um
- 8:45because oftentimes Banks or or credit
- 8:47card companies have to take the hit if
- 8:50someone uses a a card improperly because
- 8:52a lot of them will have guarantees you
- 8:54know generally if someone steals your
- 8:56card and uses it for an improper purpose
- 8:59purchase generally you can get that
- 9:01canell at least in the states I'm not
- 9:03sure about you know other regions of the
- 9:05world so as a result um credit card
- 9:08companies have a very large Financial
- 9:11incentive to reduce the amount of fraud
- 9:14that goes on and one of the first ways
- 9:16to do that and kind of a very kind of
- 9:18lowcost algorithmic way to do that is
- 9:21just to monitor the transactions that
- 9:23are made on the credit card and try to
- 9:26pick out which transactions might be
- 9:29fraud and so for people who have been
- 9:32listening to the previous podcast um you
- 9:35might actually remember that we talked
- 9:36about classifiers a few different times
- 9:39and so we're actually going to return to
- 9:41that notion because What's Happening
- 9:43Here is a classification problem you
- 9:46have in front of you a credit card
- 9:49transaction and you would like to
- 9:51classify it as fraud or not fraud and so
- 9:56in fact this is actually a special case
- 9:58of binary classification I think we also
- 10:00mentioned this notion of binary
- 10:02classification being a very simple form
- 10:04of classification in which you only can
- 10:05classify into one of two buckets or
- 10:08outcomes um and so there's a lot of
- 10:11different machine learning algorithms
- 10:13that are used for this and again it's
- 10:16all about trying to find what patterns
- 10:19represent normal use so you might have a
- 10:22machine learning algorithm that tells
- 10:23you oh well the patterns that represent
- 10:26normal use are transactions with a mean
- 10:29amount of
- 10:31$20 and a standard deviation of
- 10:35$30 and they generally happen between
- 10:39the hours of 9:00 a.m. and 9:00 p.m. uh
- 10:43eastern time for this user and then you
- 10:45have all sorts of other details right in
- 10:47each transaction you have the amount you
- 10:50have where it was made from How It Was
- 10:52Made uh you know online or in person you
- 10:56have the time it was made um assuming
- 10:59usually also have the time zone in which
- 11:00it was made probably one or two other
- 11:02things like whether it was swiped or or
- 11:04on chip and so you have basically for
- 11:06each
- 11:07transaction a bunch of little
- 11:09measurements and the algorithms look
- 11:12through those measurements and they try
- 11:13to assign a likelihood to the overall
- 11:16transaction based on like how weird
- 11:18those measurements are and so this is
- 11:21there are many different machine
- 11:22learning algorithms that could do
- 11:24something like this but this General
- 11:26notion of classification is a core to a
- 11:30lot of machine learning and I think that
- 11:32this is a good illustration of one of
- 11:34the common uses do you have anything to
- 11:35add to that yeah I mean so it sounds
- 11:37like what you're talking about is
- 11:39definitely like an example of what we'd
- 11:41call supervised machine learning uh be
- 11:44because you can usually break out
- 11:45machine learning methods all these
- 11:46different algorithms into a couple
- 11:48different classes themselves uh this is
- 11:52supervised and unsupervised machine
- 11:54learning so in supervised machine
- 11:57learning what you do is you essentially
- 12:00hold the algorithm's hand you'll show it
- 12:02hey here's all this data and this is
- 12:05what it is it's like I I have this
- 12:08transaction at this time and all this
- 12:10and this is fraud or I have this
- 12:12transaction at this time from this
- 12:14vendor and this is not fraud so you're
- 12:17you're in essence teaching it what is
- 12:20and isn't fraud by holding its hand
- 12:23through a bunch of different examples
- 12:25and then you use that trained model to
- 12:28predict stuff in the future
- 12:30okay so what is unsupervised learning
- 12:32just you know going to the other side of
- 12:34the spectrum so that's more uh when you
- 12:37just take all this data and you let the
- 12:39machine go ham like you just have an
- 12:42algorithm and it looks for patterns it
- 12:44doesn't know what it's looking for
- 12:45nothing's really particularly labeled
- 12:48this could be something like using the
- 12:51semi Central example of credit card
- 12:52fraud right there's some whole
- 12:55collection of behavior right and at some
- 12:58point in this Behavior there's a
- 13:00shift so someone and and would basically
- 13:04hypothesize that there are two people uh
- 13:06or multiple people using the same credit
- 13:08card right where we have this initial
- 13:11person with their initial behavior and
- 13:12at some point the behavior changes and
- 13:15that would be kind of a warning thing
- 13:17and that's not really looking at what is
- 13:20or isn't fraud that's looking for some
- 13:22sudden burst in purchases or some sudden
- 13:26uh new information that we haven't
- 13:29really experienced before that is
- 13:30outside the wealth of what we've already
- 13:32had to deal with so that would be
- 13:34another way to Market fraud instead of
- 13:36looking at individual transactions and
- 13:38marking them fraud or not I think a good
- 13:40like very simple intuitive example of
- 13:42this might be that an unsupervised
- 13:44machine learning model might look at
- 13:46your credit card transactions and say
- 13:4995% of your credit card transactions
- 13:53have a value of between and
- 13:56$200 right and so if you look at the
- 13:59value of a credit card transaction and
- 14:02it's outside of you know it's above 100
- 14:04it's above
- 14:05$200 um that represents you know kind of
- 14:09an uncommon event it's a rare event and
- 14:12that's some evidence towards the fact
- 14:14that it might be fraud you probably
- 14:16wouldn't immediately flag it as fraud
- 14:18just because of that one occurrence and
- 14:20so um what another big thing that
- 14:23machine learning algorithms do is they
- 14:24usually try to kind of com find patterns
- 14:27across multiple different variables so
- 14:30in this case one variable is the price
- 14:33you know of the transaction another
- 14:35variable is the time at which it's made
- 14:37and let's say in our for our purposes a
- 14:38third variable is the location at which
- 14:41it's made and so for each one you know a
- 14:44machine learning algorithm might say
- 14:45okay well 95% of transactions are
- 14:47between $1 and
- 14:48$200 um 95% of them are made within 10
- 14:52miles of this location probably your
- 14:54home uh and 95% of them are made between
- 14:589:00 a.m. and 9 p.m uh your time zone
- 15:01and so if you see a transaction which is
- 15:02$300 but within 10 miles of your home
- 15:05and within 9:00 a.m. and 9:00 p.m. in
- 15:07your time zone Pro you know maybe that's
- 15:09not enough evidence to flag it um but
- 15:10then if you see a transaction which is
- 15:13$1,000 and it's 50 miles away from your
- 15:15T from your hometown and it's 3:00 a.m.
- 15:19your time that's a good amount of
- 15:21evidence that you want to flag it so
- 15:22really what machine learning algorithms
- 15:24will do is try to find these patterns
- 15:26try to figure out what is kind of normal
- 15:28behavior variables and then look for
- 15:30examples which fall outside of those
- 15:32bounds yeah no I think that's a really
- 15:34good summary and I I really do like the
- 15:37example of you know credit card fraud
- 15:39detection while we're talking about
- 15:42supervised and unsupervised machine
- 15:44learning I don't know if this is maybe
- 15:45getting a little bit ahead of ourselves
- 15:47for where we want to be right now in
- 15:48this episode but when is it right to use
- 15:52supervised versus unsupervised machine
- 15:55learning algorithms well it really
- 15:57depends on what you're going for right
- 16:00so if if you have an idea of how things
- 16:04are if you have an idea of the different
- 16:06classes that you're looking at uh in
- 16:08credit card fraud still you have fraud
- 16:10or not fraud uh so if you know what your
- 16:14classes are going to be then well
- 16:17there's really no harm in using a super
- 16:18supervised algorithm where you're
- 16:20basically providing the inputs and
- 16:22you're providing the outputs at the same
- 16:24time and using this in order to train
- 16:25the model but but if you're looking for
- 16:27something uh if you just have a bunch of
- 16:29unlabeled data and you want to learn
- 16:31something interesting about it uh look
- 16:33for any particular clusters or um uh
- 16:37different uh groups of behavior within
- 16:40this big data set uh that's more of an
- 16:42unsupervised learning problem so I I
- 16:44alluded a bit to uh this kind of shift
- 16:48um in uh in Behavior so that that's one
- 16:52what that's one uh thing that we could
- 16:56learn uh about a data set just by
- 16:58running it through like uh something
- 17:00called a mixture model right uh if we
- 17:02don't know how many classes there are
- 17:04but we suspect that there may be uh a
- 17:08few different things going on what we
- 17:09would do is we would try to run it
- 17:10through a mixture model uh uh which is
- 17:13an unsupervised learning algorithm and
- 17:14see if it will group things into
- 17:16particular sections okay yeah that makes
- 17:19sense now Delaney right at the beginning
- 17:22you described um you said there's a lot
- 17:24of a hype around uh machine learning at
- 17:27the moment you I think you just
- 17:28described it as being a hype Circle um
- 17:31hype cycle hype cycle um why are people
- 17:34so excited about machine learning right
- 17:37now particularly in the trading and
- 17:39investing
- 17:40space well I think there's a lot of
- 17:42reasons I think um machine learning is
- 17:44something that has been being developed
- 17:46in the computer science math and stats
- 17:49academic disciplines for I don't know
- 17:51maybe 30 to 60 years now seriously a lot
- 17:55of it has really just been enabled by
- 17:56modern Computing um there's a lot of
- 17:59techniques that just would not be
- 18:01possible without kind of chips that were
- 18:04fast and because you know a lot of these
- 18:06machine learning methods have take a lot
- 18:08of computational power they require many
- 18:10iterations many training Cycles so as a
- 18:13result you know it's only kind of
- 18:14recently that it's really started to
- 18:16take off because uh consumer Hardware
- 18:19has gotten fast enough to support um
- 18:21machine learning algorithms um on the
- 18:24other hand we're also in this I believe
- 18:26a hype cycle around uh kind of data
- 18:29science in general in which uh there's
- 18:31just a lot of interest in data science a
- 18:33lot of companies are trying to turn to
- 18:35data science to understand what's going
- 18:37on at the company they're collecting
- 18:39tons of data now like pretty much every
- 18:41every electronic device is spewing out
- 18:43data at this point and so a lot of
- 18:46people are trying to use it to make
- 18:47their lives better to make better
- 18:49decisions um and you know machine
- 18:51learning is just kind of a really key
- 18:53component of what is known as modern
- 18:56data science and so lot of people also
- 19:00gravitate towards it because it's just
- 19:01kind of it's it's the flashiest part of
- 19:05statistics and data science to a lot of
- 19:07people um nobody wants to go and learn
- 19:11how to uh you know check their standard
- 19:14errors on a regression model accurately
- 19:16in the presence of something boring like
- 19:18heteroscedasticity but you know if
- 19:20someone talk comes and tells you that
- 19:22they have this crazy new algorithm which
- 19:24mimics the way that the human brain
- 19:26works and can detect any pattern you
- 19:29want in an unsupervised learning like
- 19:31there's just there's there's there's so
- 19:33much more flash factor with machine
- 19:36learning than kind of traditional
- 19:37statistics that I think a lot of people
- 19:39are just drawn to it and so a lot of
- 19:41people even who haven't like really done
- 19:43the core of Statistics that you need to
- 19:46validate these models that are put out
- 19:47by Machine learning algorithms are
- 19:49jumping into the field and it can be a
- 19:51little dangerous because you have people
- 19:52who are using it who might not be as
- 19:54familiar with the techniques to know
- 19:56whether it makes any sense or not um
- 19:59something else I just wanted to say is
- 20:02uh with the uh unsupervised learning
- 20:04example I think another uh important
- 20:06distinction is if you're dealing with
- 20:07data for which you don't know the answer
- 20:11um that's a case in which you usually
- 20:12want to use unsupervised learning uh so
- 20:15for example if you had a bunch of credit
- 20:18card transactions but you actually
- 20:19didn't know which ones were fraud and
- 20:22you wanted to Look Backwards um
- 20:24sometimes you need because you just
- 20:25don't know the answer you have to you
- 20:28there's no way to supervise it you can't
- 20:30say this is fraud this is not fraud this
- 20:32is fraud this is not fraud um but if you
- 20:35had examples of uh credit card
- 20:38transactions which were uh grouped into
- 20:41stuff you knew was fraud historically
- 20:42and stuff you knew you know you you knew
- 20:44was not fraud um then that's a different
- 20:47situation and you can do different types
- 20:48of stuff with that okay sure so even
- 20:52with the flash Factor does machine
- 20:54learning bring anything new compared to
- 20:57uh traditional statistics
- 21:00methods I think it absolutely does and
- 21:03and the way I view machine learning is
- 21:04it's like machine learning is really
- 21:06kind of like a gun it's like it's really
- 21:09powerful when used correctly um but it's
- 21:13also really easy to to do serious harm
- 21:15to yourself if used improperly and the
- 21:18serious harm of course is if you have a
- 21:20machine learning algorithm and it spits
- 21:21out something that looks really good
- 21:23which machine learning algorithms will
- 21:25tend to do and and we can go into this a
- 21:27bit more later but
- 21:29machine learning algorithms are really
- 21:31really good at fitting data and so
- 21:33they're really really good at
- 21:34overfitting if you're if you're not
- 21:35careful and there was a result
- 21:37oftentimes if you apply machine learning
- 21:38to something you'll get models that look
- 21:41so good on the data set you train them
- 21:43on they look like perfect they can
- 21:45predict everything that happened um and
- 21:47as a result you get this amazing
- 21:49confidence in your ability to predict
- 21:51things going forward uh and of course
- 21:53like just like any other statistical
- 21:55method if you haven't done your proper
- 21:57validation um you know you could
- 21:58completely fall apart out of sample and
- 22:01and and blow up and of course in finance
- 22:02that's a particularly big risk because
- 22:04it could be that you lose a substantial
- 22:06amount of money um but that said uh the
- 22:10kind of broad uh Power that machine
- 22:12learning algorithms have to deal with
- 22:15new types of data um do bring a lot of
- 22:19new things to the table in in in finance
- 22:22and I think that there are some really
- 22:23good uses of machine learning and
- 22:25finance and some dangerous uses so like
- 22:28uh you know some of the stuff we're
- 22:29going to talk about as we go on today is
- 22:31what some of the broad good cases are um
- 22:34and some of the broad maybe you don't
- 22:37really want to use it this way cases are
- 22:39um and so maybe we can just start with
- 22:42an example um which I I have a fun I
- 22:44have a fun uh a fun metaphor all ready
- 22:47to go and talking about unstructured
- 22:49data go for it yeah well let's let's go
- 22:51into some of those good usages and poor
- 22:54usages of machine learning like when is
- 22:56it powerful and when is it not so much
- 23:00yeah so I'm going to give a shout out
- 23:02here uh so one of the first um
- 23:05professors that uh we ever worked with
- 23:07at quantopian his name is Andre keno and
- 23:10if you Google search him you'll actually
- 23:12find a Russian professional basketball
- 23:14player so you have to like Google search
- 23:16Andre koleno Finance um or or or
- 23:20something uh but he's a he's actually he
- 23:23a really smart guy um he uh used to be
- 23:27the chief economist at the Commodities
- 23:29and Futures Trading commission uh here
- 23:31in the US um and and was teaching at MIT
- 23:34when uh when we met him he's now
- 23:37actually um running a new program I
- 23:39believe at uh Imperial College London
- 23:43which I recommend if any of your
- 23:44listeners are are are in London
- 23:46interested in some kind of um Finance
- 23:49program I definitely recommend you check
- 23:50it out he's he's he he really knows this
- 23:52stuff well and and one of the things
- 23:54that most impressed me uh was just like
- 23:56how much he focused on this statistical
- 23:59rigor when he was teaching because he
- 24:01was teaching a lot of people who had
- 24:02heard about these crazy new techniques
- 24:04who did want to do this stuff um and and
- 24:06he was really good about making sure
- 24:08that you know they came away with with
- 24:10good and bad examples and he had some
- 24:12good like kind of very visual stories of
- 24:15uh explaining some of these Concepts and
- 24:17so I'm going to use one of his right now
- 24:19which is um there's a preponderance now
- 24:23of what I call unstructured data and
- 24:27what that means is you get data that
- 24:29really has no well no structure to it
- 24:32you're you're getting data let's an
- 24:34example might be headlines news
- 24:35headlines right there's no structure of
- 24:38a news headline every reporter writes
- 24:41theirs differently um yeah there's going
- 24:43to be structure in the the language you
- 24:45know let's say that you're looking at
- 24:46just English news headlines well there's
- 24:48going to be structure because English
- 24:50has a structure but beyond that that
- 24:52even might be pretty weak because news
- 24:54headlines use a lot of slang they use a
- 24:56lot of shortening like headlines have
- 24:57their own language right they kind of
- 24:59drop words as appropriate to fit the
- 25:00headline onto the page um and so you're
- 25:04looking at a headline and you're trying
- 25:06to learn information from those
- 25:08headlines the the the metaphor that that
- 25:11uh Andre Keno likes to use for this is
- 25:14um imagine that your data source um is
- 25:18the garbage that's coming out of a of a
- 25:21of a coffee shop right so you're you're
- 25:23in the back alley and every time they
- 25:26dump their garbage out you you take
- 25:27their garbage and you're trying to learn
- 25:29as much as you can about the workings of
- 25:31the coffee shop from the garbage and and
- 25:33this is actually a really good metaphor
- 25:35to understand how not only unstructured
- 25:38data often is but kind of how um machine
- 25:42learning algorithms can oftentimes be
- 25:44powerful because what you have there is
- 25:46you have well what are you trying to
- 25:47learn about well let's let's kind of try
- 25:49to get a sense of what data you might
- 25:51have you're going to have obviously like
- 25:53coffee cups and maybe you have different
- 25:55coffee cups because they have different
- 25:57types of cups for different drinks you
- 25:58know they might have paper cups and
- 26:00plastic cups and they have different
- 26:02sizes of Cups and some of the cups will
- 26:04have a name written on them and some of
- 26:06the cups will not have a name written on
- 26:08them um some drinks are served in two
- 26:10cups and some drinks are served in one
- 26:12cup you know they'll double up the cup
- 26:13sometimes um some cups come with one of
- 26:16the cup holders so you don't get burned
- 26:19uh some you'll you'll have sometimes
- 26:21you'll have a lid attached to the cup
- 26:22sometimes you'll have free floating Lids
- 26:24sometimes you won't have a lid at all
- 26:25for cups so you can get a sense and then
- 26:27and of that's all floating in a whole
- 26:30like other garbage right so there even
- 26:32even like information you might want to
- 26:34get at like stuff like what type of Cups
- 26:35you're looking at trying to reverse
- 26:36engineer what type of drinks the coffee
- 26:38shop is serving let's say that's all
- 26:41floating in like a whole bunch of other
- 26:42garbage from like food or or or napkins
- 26:46or whatever so you're sitting there and
- 26:48and this is actually really close to
- 26:50when um quantitative professionals
- 26:52whether they be in finance or other
- 26:53fields are looking at unstructured data
- 26:55that's flowing in from The Real World
- 26:57often times you need to do a data
- 26:59processing step and so a huge part of
- 27:01modern kind of data science and and
- 27:03oftentimes what will set apart someone
- 27:06who has data science on the resume from
- 27:07like someone who says statistics is this
- 27:09notion of cleaning the data and and
- 27:11getting the data into a usable format um
- 27:14and that would involve like you know
- 27:16sorting out your garbage and okay now
- 27:17you have a pile of Cups and then you
- 27:19start counting the cups and you you make
- 27:21notes of this cup came with another cup
- 27:23this cup came with a lid this cup came
- 27:25with a name and then that kind of dat
- 27:28which isn't necessarily all the same
- 27:31format you're going to have a lot of
- 27:33null values in there lots of different
- 27:35weird stuff this is where machine
- 27:38learning can be really powerful in
- 27:40getting you somewhere useful because
- 27:42what machine learning methods will do
- 27:44especially the unsupervised ones that
- 27:46Max was talking about is they will kind
- 27:49of from that be able to start giving you
- 27:52initial ideas about the broad trends
- 27:55that might be present uh and they might
- 27:57what you can do is you can start saying
- 27:59uh look at each individual K piece of
- 28:01garbage and try to classify it as one
- 28:04thing or another based on this you know
- 28:06learning that you're doing um and and
- 28:09and this is the type of situation often
- 28:11times that machine learning is very
- 28:13powerful at um because a lot of the
- 28:15algorithms are actually designed to work
- 28:18in these kind of unstructured data
- 28:20scenarios okay is there anything you
- 28:21want to add on to that Max or should we
- 28:23keep moving yeah I think that's a
- 28:26delightful example
- 28:28sometimes your cups are actually
- 28:31Forks so let's continue on this point
- 28:34what are some good usages and also some
- 28:36poor usages of machine learning like in
- 28:39a trading sense in a finance sense I'll
- 28:42quickly give one more kind of follow on
- 28:45so I think we actually probably talked
- 28:47about this before but like the the
- 28:49favorite uh the favorite example and and
- 28:52and I'm pretty sure we've talked about
- 28:54this briefly in one of the one of the
- 28:55previous episodes is using um computer
- 28:59vision uh to analyze images uh namely
- 29:03satellite images right and so if you
- 29:07have satellite images of parking lots
- 29:10and you use uh computer vision which is
- 29:13often times models that are trained
- 29:15using some form of machine learning
- 29:17you'll have like these classifiers that
- 29:19look at these images and they attempt to
- 29:22like first of all catalog okay split the
- 29:24image into objects that's one of the
- 29:26problems and then the next is for each
- 29:28object classify it as a thing um and
- 29:31this is actually a problem that we've
- 29:32gotten pretty good at um Google
- 29:35especially has been one of the companies
- 29:36that's like really I think been ahead of
- 29:39the curve and in designing um computer
- 29:42computer vision Technologies and so as a
- 29:44result nowadays we actually have
- 29:46open-source computer vision libraries um
- 29:49that actually work pretty well for just
- 29:51saying this is a car this is a cat this
- 29:55is a person and it's because they've
- 29:57just trained these models on like so
- 30:00many tens of thousands of examples of
- 30:02things that are people and things that
- 30:04are close to looking like people but are
- 30:06not people and the algorithm has learned
- 30:08the rules for differentiating the two
- 30:10and so what you can do is you can take
- 30:11these models that have been developed
- 30:13and apply them to these images and count
- 30:15how many cars are in the parking lots
- 30:17and then use that to try to forecast
- 30:18sales figures for for retail chains so
- 30:22that's an example of taking you know
- 30:23unstructured data which is in the form
- 30:25of images and turning it into an actual
- 30:28score which is like cars outside each
- 30:31retail chain for each
- 30:32quarter okay so what would be a poor
- 30:35usage of machine learning in a in a
- 30:37trading sense we mentioned a little bit
- 30:40about how it's really easy to overfit
- 30:42with machine learning and one of the
- 30:45very fun things about financial data
- 30:47especially like price data is that it's
- 30:50really really noisy it's Jagged it's
- 30:54ugly it's contorted it doesn't follow
- 30:56any nice assumptions so
- 30:58why why not just forego the assumptions
- 31:00entirely and use a machine learning
- 31:01model in order to predict prices uh the
- 31:04issue with this is because machine
- 31:05learning models are so flexible and
- 31:07because they're so good at fitting the
- 31:08data they'll contort exactly to fit this
- 31:12noise and then going forward you're just
- 31:16you're there whenever you have any sort
- 31:18of process in real life
- 31:22um yes so whenever you have any sort of
- 31:24process in real life there's always some
- 31:26true underlying
- 31:28thing driving it there there's some
- 31:31underlying process that makes it all
- 31:33work together and whenever you build a
- 31:34model you're trying to infer that
- 31:37underlying process from the data at
- 31:40large but if you fit perfectly to the
- 31:44data since it's real life data there's
- 31:46going to be a lot of noise involved so
- 31:48you're just contorting it to fit what
- 31:50you actually see instead of getting any
- 31:51actual information about what's actually
- 31:53there so when you then go out of sample
- 31:56and try to use this in order to predict
- 31:59any sort of future prices it's just
- 32:01going to be garbage okay is there any
- 32:03way you can use it to predict or attempt
- 32:06to predict future prices without it
- 32:09being garbage like are
- 32:10there is there a way that it can be used
- 32:14uh for for forecasting prices or is it
- 32:16best used in you know the examples we've
- 32:19talked about like you know if you want
- 32:21to use satellite imagery as an example
- 32:24like actually using it to read images so
- 32:28there's I think that um it certainly can
- 32:31I I think that that would probably be
- 32:33considered like the most advanced use
- 32:35case of of machine learning in in in
- 32:37finance it would be actually using it
- 32:39directly as a price forecasting model um
- 32:44and that's just because again I think
- 32:45that that given like the problem you're
- 32:48trying to solve and the nature of the
- 32:49data and the system producing the data
- 32:51that's just the riskiest application and
- 32:54so you need to have kind of the the best
- 32:57experience and and steadiest hand to be
- 32:59able to do something like that so I
- 33:01would say that would not be my
- 33:02recommendation as the first place to
- 33:04start playing with machine learning and
- 33:06finance um although for I think for a
- 33:09lot of people it's the first like
- 33:10intuitive it's the most intuitive place
- 33:12to try to use it is just to predict
- 33:14prices because that's you know that's
- 33:16kind of it's that seems like the best
- 33:17idea off the bat but I would actually
- 33:19say that's kind of probably the LA one
- 33:21of the one of the last places you want
- 33:22to try using it and not in the sense
- 33:24that it's not going to work but um I
- 33:27mean I don't in any individual case I
- 33:29don't know if it's going to work I don't
- 33:31want to tell you that these things are
- 33:32going to be like definitely bad or
- 33:34definitely good what I do want to say is
- 33:36just like you want to apply the same
- 33:39model validation principles to whatever
- 33:41the machine learning algorithm is
- 33:43spitting out as you would to anything
- 33:45else so a lot of the stuff that we
- 33:46talked about in the first episode when
- 33:48we talked about biases and ways to be
- 33:50wrong without knowing you're wrong um
- 33:52you want to watch out for those same
- 33:54things with machine learning and for
- 33:56machine and and for machine learning
- 33:57some of those are especially especially
- 33:59common so um I'll give you an example of
- 34:02something that I might do here which is
- 34:04let's say that I had a data file of uh
- 34:09let's say I had a data file of um 60
- 34:13variables that I was recording all the
- 34:15time and I wanted to use these 60
- 34:17variables to uh predict the price of
- 34:21some stock some asset and so what I
- 34:24might do is I might um use machine
- 34:28learning to basically try to guess some
- 34:32variables that might be good variables
- 34:34to use in a model to predict price of
- 34:37this asset so the machine learning
- 34:38algorithm would look at um my you know
- 34:41data set of 60 variables going back in
- 34:43time it would look at the price of the
- 34:45asset that I wanted to predict and it
- 34:46would try to come up with some set of
- 34:49variables hopefully a smaller set you
- 34:51know it try to come up with maybe like
- 34:52five variables two to five variables
- 34:55that predict the price of my asset uh
- 34:58well and and this use of machine
- 35:00learning is is known as dimensionality
- 35:02reduction um in in uh in data science
- 35:05and it's especially common in a field
- 35:07where I used to work which is
- 35:09bioinformatics uh in which you have um
- 35:12millions of genes and you want to figure
- 35:15out which genes are associated with
- 35:17diseases and so you can't of you just
- 35:20can't look at all the genes at once so
- 35:22you need to use filtering methods to
- 35:25filter down to small sets of genes for
- 35:27kind of more in-depth analysis and yeah
- 35:29you might throw the good ones out when
- 35:32you're using the filtering method but
- 35:33that's just a risk that you're going to
- 35:34have to take because if you're the
- 35:37amount of analysis you can really do is
- 35:39in maybe like 20 genes maximum at a time
- 35:42um for variety of reasons statistical
- 35:44and computational limitations so if I
- 35:46have like 60 variables and I'm trying to
- 35:48predict the price of some asset I might
- 35:50use a machine learning algorithm to
- 35:52filter myself down to a set of say five
- 35:54variables and then construct a simple
- 35:57model based on those five variables and
- 36:00from there on just validate it the same
- 36:02way I would anything else so in this
- 36:04case I'm using machine learning to try
- 36:05of inform my model selection but the
- 36:07model itself is still a very simple uh
- 36:11model probably just like a linear
- 36:12regression a linear combination model or
- 36:14something like that so that that's an
- 36:16example of how I might go about um using
- 36:20uh machine learning to try to forecast
- 36:23price although obviously like in any
- 36:25individual case I have no idea if it's
- 36:27going to work okay now you said
- 36:29something towards the end there which I
- 36:31think might be key and I just I'd love
- 36:34it if you could expand on that a little
- 36:35bit how important is it to try and keep
- 36:38the model itself simple like even when
- 36:40using machine learning techniques is it
- 36:43like like how important is it to keep
- 36:45things
- 36:46simple so Simplicity is kind of like the
- 36:50Crux of everything that you're trying to
- 36:51get out with a model because you want it
- 36:53to be General is the idea like you want
- 36:57it to trained well on the data that you
- 37:00already have the things that you know
- 37:01about but you want that model to be
- 37:04General enough to still be extensible to
- 37:06any sorts of new information like this
- 37:09is part of the issue uh with like
- 37:10fitting to noise that I was talking
- 37:12about before like if you're fitting to
- 37:13the noise of a very particular data set
- 37:16uh of data that you already have that
- 37:19noise is going to be different in the
- 37:21future it's it's going to change so if
- 37:23you're incorporating the noise as an
- 37:25integral part of the model if you're
- 37:26making it more complex
- 37:28as a result of the noise you're making
- 37:30your model less General so there's
- 37:32actually a bunch of different methods in
- 37:34order to kind of determine whether your
- 37:37model is too complex or uh as simple as
- 37:42it could be and it comes down to a lot
- 37:44of the same things that we use in like
- 37:45normal statistical models um because
- 37:48this is something that we want to look
- 37:49at with normal statistical models as
- 37:51well we generally want General models
- 37:53that are relatively simple and explain
- 37:55as much information as possible with as
- 37:57few terms as we can so we'll we'll
- 38:00conduct a lot of testing with our
- 38:02machine learning models in order to kind
- 38:04of penalize any sort of complexity to
- 38:06rein in any sort of extra complexity so
- 38:09that they don't go off the rails or do
- 38:11anything weird okay I was just going to
- 38:14say like kind of two points one just to
- 38:16Circle back to points we made before out
- 38:18of sample testing is is really important
- 38:22because without like if you if you come
- 38:25up with some model even if it's seems
- 38:27simple unless you have saved some of the
- 38:30data to test on like your model is going
- 38:33to be built on the data you've already
- 38:34seen so of course it's going to work
- 38:36well on the data you've already seen you
- 38:37know it's it's like uh if you teach
- 38:40someone to drive on a small section of
- 38:42roads in in some one small town yeah
- 38:45they maybe they'll get good at those
- 38:46roads but then when you let them loose
- 38:48on like a highway it's it's not going to
- 38:50work very well so um you know you you
- 38:53generally want to to make sure that when
- 38:55you're actually evaluating your model
- 38:56you want to use data you have not seen
- 38:58before preferably new data data that
- 38:59You' kept separate purely for the
- 39:01purpose of testing your model and then
- 39:03as soon as you see it it stops being out
- 39:05of sample data anymore now you know
- 39:06you've seen it it's done it's it's it's
- 39:08used so that's just an important
- 39:09principle that that I think uh is still
- 39:12required when you're doing um you know
- 39:15any kind of Statistics especially
- 39:17machine learning and uh you know there
- 39:20are some people who might argue that AOS
- 39:22sample testing is not always strictly
- 39:24necessary and I would say that if you're
- 39:26at a point in your sta iCal knowledge
- 39:28when you can argue that with me I you
- 39:30don't need my help you can go off and do
- 39:32whatever you want um so uh but and then
- 39:36the other thing is just really like yeah
- 39:38in terms of like model Simplicity again
- 39:41like the goal of models is really to be
- 39:42as simple as possible because if you
- 39:44look at what physicists are trying to do
- 39:46when they're trying to explain the
- 39:47universe right they're looking for like
- 39:49very simple broad explanations that
- 39:52capture large amounts of behavior and
- 39:55all like basically like no body in
- 39:57physics um tries to come up with uh a
- 40:01model which is based on 300 variables
- 40:03and precisely explains the motion of
- 40:05some asteroid because most likely that
- 40:07model is going to be wrong for reasons
- 40:08of of overfitting you just can't check
- 40:10it um you have so much you have so
- 40:13limited data in general the more
- 40:14variables you have in the model the more
- 40:16complexity you actually need
- 40:17exponentially more data to check whether
- 40:20that model makes sense so as a result
- 40:22physicists always try to come up with
- 40:23models that have like one or two
- 40:25variables very simple effects um and and
- 40:28explain a wide variety of phenomena and
- 40:30then you can explain very complex
- 40:32phenomena by building together multiple
- 40:34simple models um into into complex
- 40:37systems um so that's just like a really
- 40:40important point that I I think is
- 40:41important to remember with all this
- 40:42stuff whenever you're trying to think
- 40:44about ways in which you might know more
- 40:46than the Market and Test those you
- 40:48always want to be finding kind of broad
- 40:50behaviors that are expressed by some
- 40:52simple rules and and the opposite of
- 40:55this is what's known as blackbox models
- 40:57which is something we can talk about a
- 40:58little bit more later but um a blackbox
- 41:01model is just a model in which you don't
- 41:03actually understand what's going on
- 41:04inside uh and you know kind of could be
- 41:07anything but you can see the input and
- 41:08output um and those models tend to be
- 41:11very risky and a lot of machine learning
- 41:13algorithms actually put out kind of like
- 41:15spit out blackbox models that really
- 41:17can't be comprehended in any way they
- 41:19just have inputs and outputs and and
- 41:21those those models are very risky
- 41:22because you just have no idea what's
- 41:24going on inside there you don't know how
- 41:25many how many variables they operate on
- 41:28you don't know why they're making the
- 41:29decisions they do and there's just no
- 41:31way to validate it so do you want to
- 41:33talk about why that's an issue with
- 41:35blackbox quote unquote systems like it
- 41:39it probably seems quite obvious to you
- 41:41know you guys but like to for someone
- 41:43who might be sort of new to this sort of
- 41:45thing why why is that dangerous to not
- 41:47really know what's going on inside your
- 41:50black
- 41:50box so part of having a model is you
- 41:54want it to tell a story about your data
- 41:59um so you want it to be in some way
- 42:03understandable by the people that are
- 42:05trying to use the model because that
- 42:06makes it comprehensible if if you can
- 42:08explain the model it means the model
- 42:10likely isn't doing anything bizarre or
- 42:14weird or UNC that you wouldn't
- 42:15necessarily want a model to do so if you
- 42:18have this black box that you're just
- 42:20putting stuff in and putting stuff out
- 42:23uh again it goes back to the same idea
- 42:24of overfitting uh where
- 42:28uh even if you're doing well uh in your
- 42:31out of sample uh in your out of sample
- 42:33data you may not necessarily know why
- 42:35and a lot of times when we're dealing
- 42:36with these models we want to know what's
- 42:39the most important stuff what are the
- 42:41key driving factors and if you can't
- 42:43explain what the key driving factors are
- 42:45in a model uh then it just makes the
- 42:47model just kind of fundamentally less
- 42:49helpful even if you do get the correct
- 42:51answers in the end now Max you've spoken
- 42:55about there being a lot of noise
- 42:58especially in price data you've bought
- 43:00it up a few times I'm just wondering is
- 43:02there any way that you can sort of
- 43:04separate noise from signal if that's the
- 43:07right term when you're looking at data
- 43:10like are there any methods you can use
- 43:12to uh kind of separate the two so it's
- 43:15hard to separate the two directly um
- 43:19basically how we kind of immunize
- 43:21ourselves against these mistakes of
- 43:23dealing with overfitting uh and dealing
- 43:26with uh
- 43:27too much noise is like we have our
- 43:30um we have our out of sample testing but
- 43:33in some cases if we have like too few
- 43:36data points to do out of sample testing
- 43:39like machine learning models tend to use
- 43:41they tend to require a lot of training a
- 43:43lot of data in order to inform them so
- 43:46we can't really break it into like an
- 43:4880% 20% split where we're testing and
- 43:52building our model on 80% of our data
- 43:55and then we're
- 43:57then taking that model and then using it
- 43:59on the out of sample hold out 20%
- 44:02sometimes we just don't have enough data
- 44:03for that kind of stuff so what we'll do
- 44:05in this case is something that we call
- 44:07cross validation which is instead of
- 44:09doing one split we'll do two splits or
- 44:12three splits or four splits or five
- 44:14splits uh or just however so many splits
- 44:17as we desire depending on how uh
- 44:19uncomfortable we are with our small
- 44:21amount of data and what what I mean by a
- 44:23split is we just like say we have 100
- 44:25data points right and that's all we have
- 44:27to work with then what we' do is we'
- 44:29train our we'd say hey we want to do
- 44:33five uh rounds of cross validation so we
- 44:37would in turn take 20% of our data and
- 44:41then take 80% of our data and train that
- 44:44and then test it on the hold out 20%
- 44:46then we'd pick a different 20% of our
- 44:48data and we just keep shifting this
- 44:51block of data that we're training and
- 44:53then testing on in order to kind of
- 44:56simulate a larger amount of data and try
- 44:59to go from there to try to alleviate any
- 45:00effects of particularly noisy data uh
- 45:03which can only be aggravated when you
- 45:05have fewer data points because when you
- 45:07have more data it tends to smooth out
- 45:09this
- 45:10noise and and and what you're looking
- 45:12for there is consistency you want your
- 45:14model to consistently explain what's
- 45:16going on through all the different
- 45:18rounds of training testing training
- 45:20testing because if it stops being able
- 45:22to explain stuff consistently if it
- 45:24picks kind of different patterns each
- 45:26time that's an indication that it's not
- 45:28really picking up on anything consistent
- 45:29in your data set and therefore all it's
- 45:31picking up on is no is noise I I I view
- 45:35kind of cross validation um a little bit
- 45:37as kind of like Poor Man's out of sample
- 45:39testing and that you know it's it's not
- 45:40optimal in many cases but it will help
- 45:43in in in reducing the risk of
- 45:45overfitting I think in general it's
- 45:47really hard to split noise from signal
- 45:50um because if you could split noise from
- 45:52signal you'd know exactly what the
- 45:53signal was and therefore you'd have the
- 45:55answer already uh if you were able to do
- 45:57that I mean one of the simplest ways you
- 45:59can try to get rid of noise is by
- 46:01increasing your sample size uh and then
- 46:04you know averaging everything together
- 46:06you know because if if if the noise is
- 46:08kind of going in both directions
- 46:10randomly and then you average two things
- 46:13together uh you know there's a higher
- 46:15chance that noise will cancel out and if
- 46:16you have a hundred things and you
- 46:17average them all together there's a
- 46:18higher chance that noise will cancel out
- 46:20so often times um just looking at more
- 46:23data is usually a way to try to get rid
- 46:26of noise sometimes though you're
- 46:28constrained into systems in which you
- 46:30have a fixed size there's only a fixed
- 46:32number of of assets on the US market you
- 46:35can't like get more data you know you
- 46:38can't really get more assets per se in
- 46:41that so um you don't always have that
- 46:44luxury yeah yeah now that's a really
- 46:47good point so I think this has been a
- 46:48really good overview of machine learning
- 46:51I'd just like to spend a few minutes and
- 46:52maybe talk a little bit more about how
- 46:54to actually uh go about learning and and
- 46:56maybe implementing some of these things
- 46:59uh does the quantopian platform support
- 47:01machine learning I know you mentioned
- 47:03earlier that it it does take quite a lot
- 47:05of computational uh Power are there any
- 47:08limitations um on the quantopian
- 47:10platform in regard to the use of machine
- 47:13learning certainly I mean we currently
- 47:15have some limitations on the platform um
- 47:18however and and we we'll link to these
- 47:21uh examples uh quantopian dcom chatwi
- 47:25Traders we'll have for all the episodes
- 47:27listed out um and and and for the
- 47:30machine learning episode we're going to
- 47:31link to some examples of actual
- 47:34implementations of machine learning um
- 47:38for I believe Factor aggregation which
- 47:42is something we talked about in the
- 47:43previous episode so using machine
- 47:45learning algorithm to try to construct
- 47:48one overall factor from a variety of
- 47:50input Alpha factors uh and I I'm
- 47:54actually not sure of the second I think
- 47:55the second one is actually using it as a
- 47:57a factor itself as a as a price
- 47:59forecasting model so the thing I said
- 48:01was the hardest kind of most dangerous
- 48:03thing to do so those were both uh
- 48:05examples made by um mostly Thomas I
- 48:09believe uh I'm not sure did you take a
- 48:11look at those Max or is that mostly
- 48:12Thomas in his cave who pump pumped those
- 48:14out yeah that was Thomas and James
- 48:16Thomas and James so Thomas and James
- 48:18Christopher um but so we'll have
- 48:20examples uh listed for actually like how
- 48:23you would do that in the quantopian
- 48:24platform um currently it's kind of hard
- 48:27to actually put the uh machine learning
- 48:31methodology into a trading algorithm but
- 48:33within our research environment which is
- 48:35kind of offline analysis and hypothesis
- 48:38testing and statistics uh you can do
- 48:40actually quite a wide variety of um
- 48:43machine learning stuff nothing that's
- 48:45going to take like there's some
- 48:46algorithms that just take like huge
- 48:48amounts of memory and computational time
- 48:50and and those currently you you you
- 48:52can't use but a lot of the machine
- 48:54learning algorithms just because
- 48:55consumer Hardware is gotten so fast
- 48:57these days actually run fairly quickly
- 49:00um and so you can do some pretty
- 49:01advanced stuff um as far as you know a
- 49:05lot of the cases that I was talking
- 49:06about like you know looking at trying to
- 49:08parse unstructured data or select
- 49:11factors for your model or aggregate um
- 49:14Alpha factors that kind of stuff and
- 49:16we're working constantly on trying to
- 49:18enable more support for more types of of
- 49:21machine learning and just other use
- 49:23cases on the platform yeah I I know I'm
- 49:25going to be working on a
- 49:27lectures teaching machine learning at
- 49:29some point uh and just as part of our
- 49:31research environment we allow you to use
- 49:34uh psyit learn which is a very popular
- 49:36uh uh package in Python which has just a
- 49:40very large number of classifiers
- 49:43estimators and their documentation is
- 49:45really fantastic and it's a good place
- 49:46to get started with learning how to
- 49:48actually use the methods yeah I was
- 49:49going to ask you about that actually
- 49:51because psyit learn is the main library
- 49:54or or package uh for python for machine
- 49:57learning right are there any other uh
- 49:59packages or libraries that that you'd
- 50:00suggest for this as well or is that
- 50:04probably enough to get started at least
- 50:07I mean I know there are I don't know off
- 50:09the top of my head um like I'm not
- 50:12someone who uh like i' I've done I've
- 50:16done my I've done my time in the machine
- 50:18learning minds but I'm not currently
- 50:20using this dayto day and and and python
- 50:22moves so fast that I'm sure that since
- 50:24I've touched it there are many libraries
- 50:27that have popped up which do tons of
- 50:28interesting stuff with machine learning
- 50:30tons of forks of various other libraries
- 50:33and and you know it there's so much work
- 50:36going on right now in Python so I
- 50:38couldn't tell you right off the top of
- 50:40my head if there other libraries Max
- 50:41might know a few others that are that
- 50:43are good but um I think uh scikit learn
- 50:46also NN what is it what's the the modu
- 50:49module is actually SK learn it's like
- 50:51yeah so I think some some people
- 50:53probably know as like sklearn I think
- 50:55it's like the flagship uh library in
- 50:57Python that really will will get like
- 51:00you know 80 to 90% of your use cases
- 51:02done out of the box yeah there's tensor
- 51:06flow but that's a little weirder yeah
- 51:07there's tensor flow which is like a
- 51:09whole new like a whole new world we're
- 51:11talking about hype Cycles there's this
- 51:12little like mini hype cycle going on
- 51:14around tensor computations which are
- 51:17used I believe for calculating
- 51:18covariance matrices which I'm not even
- 51:20going to get into right now but that's
- 51:22like a whole a whole little subfield of
- 51:24machine learning that has popped up
- 51:26especially in finance because
- 51:28co-variance is so important especially
- 51:30for portfolio construction right right
- 51:32okay we'll um we'll save that for
- 51:34another day um there's also a course by
- 51:39Andrew I'm not going to attempt to
- 51:41pronounce his last name either NG yes
- 51:45yeah that's how it's spelled is that how
- 51:46you pronounce it uh well you pronounce
- 51:48it I think but I'm doing a very poor job
- 51:51at that so please don't write me hate
- 51:53mail so that's that's like that's my
- 51:55pronunciation I use in Singapore and
- 51:58like it's close enough that they've
- 52:00given up correcting me on it so that's
- 52:03CLE yeah yeah I know his course is very
- 52:06sort of highly rated um in the field of
- 52:08machine learning is that something you
- 52:10guys would recommend uh people check out
- 52:12if they're interested in um you know
- 52:14learning more about this would that be a
- 52:15good place to start also I don't know
- 52:18the course I don't know Max do you know
- 52:20the course I uh started looking into it
- 52:21you started looking into it yeah I I
- 52:23don't know the course I know he's very
- 52:25highly regarded and and he is kind of
- 52:27the go-to name right now for for machine
- 52:30learning um so you know I would say my
- 52:35my my basian prior on this my is is
- 52:38quite strong that it would be a good
- 52:40course but I I cannot actually endorse
- 52:42the course having never seen it myself I
- 52:46like stuff that I did read sure okay
- 52:48cool you've got a you've got a small
- 52:50sample very small data sample from Max
- 52:52very
- 52:54partial that's funny so is there
- 52:56anything else you guys would like to add
- 52:58on machine learning before we wind
- 53:00things down here um I mean honestly like
- 53:04if this stuff fascinates you just like
- 53:07try messing with it in Python um or your
- 53:09language of choice I I say python just
- 53:11because obviously that's what works on
- 53:13quantopian and and I think in kind of
- 53:15also in a more objective sense it's the
- 53:16easiest one to get started in learn
- 53:19makes it really easy yeah and and also
- 53:21python is so good at in ingesting data
- 53:25whether it be unstructured scraping web
- 53:27pages parsing text files whatever you're
- 53:29trying to do python actually makes it
- 53:31pretty easy um and uh so it's generally
- 53:34a good place to start but like obviously
- 53:37if you're if you're experienced and and
- 53:38you have some programming knowledge some
- 53:40math or stats knowledge just just try it
- 53:42because this stuff is cool and and and
- 53:44the reason it's cool is why makes it so
- 53:46dangerous because you you want to try
- 53:48all these complicated models and then
- 53:49you're like oh my gosh this thing
- 53:50actually works I'm going to make
- 53:52billions of dollars and it doesn't um
- 53:55but but just go try it and and we'll
- 53:57have links to a lot of the the related
- 53:59content for stuff we talked about at
- 54:02quantopian dcom chatwi Traders under the
- 54:05under the section for this episode so
- 54:07like you can actually start trying to
- 54:08play with it a bit awesome so the next
- 54:10episode is going to be a Q&A episode and
- 54:13that's going to be part six of the
- 54:15series which will be the the final
- 54:17episode so uh for that we're obviously
- 54:20answering uh any of the listeners
- 54:22questions so guys if you do have a
- 54:24question and I just want to emphasize
- 54:26that there's no such thing as a dumb
- 54:28question so no matter how how basic it
- 54:31may seem uh don't be shy please do ask
- 54:33it where is the best place Delany to
- 54:36submit those
- 54:37questions uh yeah so we'll have a link
- 54:40set up by the time this episode uh goes
- 54:42out if you go to quantopian
- 54:46dcoms uh we'll have a form there you can
- 54:49put in any question you want uh and you
- 54:52can just kind of we'll we'll take a look
- 54:54at them and and answer as as many as
- 54:56possible especially if we find ones that
- 54:59have you know the same question as many
- 55:00other people um you know because that we
- 55:03get the most bang for buck but um if we
- 55:06don't get to your question um I I'll
- 55:08I'll try as hard as I can to kind of um
- 55:11also even if we can't get to it on the
- 55:12podcast maybe like make a For Thread and
- 55:15respond to it in the Forum thread or
- 55:17something like that so I will I you know
- 55:19really will try to get to everybody who
- 55:22asked a question which I know the
- 55:24listenership of this podcast is quite
- 55:26Broad so uh I may be um biting off a
- 55:29little bit more than I can chew here but
- 55:31uh but hopefully we'll get some good
- 55:33questions yeah so guys please go to
- 55:36quantopian
- 55:37tocom questions the idea of this is that
- 55:40we can just collect all the questions in
- 55:42one place so you know we're not
- 55:44collecting some on Twitter some in
- 55:45forums some in comments um if you do
- 55:48have questions go to quantopian Doom
- 55:51questions we can collect them all in one
- 55:53place and make sure that none get lost
- 55:55so yeah I think uh that brings us to a
- 55:58close for this episode Max thanks very
- 56:00much for joining us man it was a lot of
- 56:01fun yeah thank you for having me
- 56:04[Music]
About this transcript
This page contains the full transcript of Q5: Good Uses of Machine Learning in Finance · Max Margenot by Chat With Traders, generated from the public captions YouTube serves with the video. The transcript has 10,429 words across 1,450 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.