hello welcome back
next up on the data science and
analytics track here at pycon australia
2021
is coming from london a alcazine who's
an ex-cosmologist turned data scientist
without
over 10 years experience in machine
learning statistical inference and data
inside visualizations
ayal's claim to fame is having lived in
four different continents within the
span of a decade including three tennis
grand slam cities like new york where he
obtained his phd in astrophysics
melbourne where he did a post postdoc
stint at swinburne and london where he
now resides
ayal's topic today is one that has a
direct relationship to real life
how do we optimize for multiple
objectives especially when they are in
conflict for example how can one best
overcome the classic trade-off between
quality and cost
in this talk ayal's willing yell will
introduce us to multi-objective
optimization using pareto fronts for the
data-driven decision makers in the
audience which i honestly hope is all of
you
we'll hear about the advantages and
shortcomings of the technique and be
able to assess applicability for our own
projects
welcome back to melbourne hey y'all
everybody a yel casin and improved
decision making with pareto france
hi good morning
hi good morning i just want to mention
that there is a technical difficulty and
i cannot hear anything so xavier if you
have anything to say please put it in
the chat at the moment and we'll just
have to communicate that way i hope
that's fine
um so i'll just give you one second to
give me that feedback otherwise i'll
just start
okay you hear me that's great okay great
uh so hi everyone um hello from london
uh my name is ayal i'm a senior data
scientist at babylon and i'm very happy
to be here at
in this
conference to talk about optimizing with
pareto fronts um and any other things
javier i should you mentioned before
should i just start
okay all right great so i'll start
we're now living in an era of
data-driven decision-making and there's
always an interesting challenge that
arises is how do we make decisions when
dealing with multiple parameters
normally these are not um there are
trade-off decisions to be made making
this a very
challenging procedure what sort of
trade-offs do i mean well you can always
think about the classical trade-off for
example between price and quality that
we experience not only in our work lives
but also in our everyday lives uh
sometimes the relationship between
quality and price is not that clear and
so we have to make a trade-off decision
and this also manifests in just about
any industry that you can think of
you could probably imagine in your own
industry different considerations that
you have to make
for example you can imagine uh in the
case of home food delivery services on
the one hand they want to optimize the
experience for
people ordering food at home but also
they have to take that optimize for the
kitchens as well as the delivery
personnel you cannot focus on one and
neglect the others uh i got exposed to
this in the field of drug discovery i
worked in a biotech lab and uh with
protein engineers and what i learned
there is that uh in order for um a
protein
to be considered a viable drug
for our health
it has to pass
rigorously many tests here i'm just
listing a few characterizations that a
protein has to abide by and it takes
only one for a drug to fail the test and
before the days of covid um these sort
of processes would take um
take up to a decade and these are very
expensive like millions of billions of
dollars so if something like toxicity
doesn't pass you want to learn about
this as soon as possible and hence the
need to optimize for multiple parameters
simultaneously normally when people
think about optimizing for two or more
parameters or objectives what they do is
not multiple objectives they combine
things them together into this heuristic
one heuristic uh which actually in the
literature is called single objective
optimization and so one thing you'll
take away from this talk is the
limitations of this common practice and
how this is resolved by a technique
called pareto fronts um
and why do you yield better solutions
and then i'll talk about applicability
and for those who are interested i'll
provide you free on the material where
you can gain hands-on experience
to really master this topic
this is for you if you use data to make
decisions and you're interested in
improving your optimization skills
there's no real maths background needed
and python knowledge can be fairly basic
so just about a bit about myself thank
you for the introduction javier
i currently work as a data scientist in
health tech um as heavier said i spent
the end of my extensive academic career
in swinburne university in melbourne
australia um so very glad to be here in
conference in australia
and most relevant for this talk is two
years that i spent in lab genius a
biotech company in which i learned the
trade of multi-objective optimization in
the context of drug discovery
um so i'll show like a use case from
there uh this is uh uh and the agenda
that i prepared for today in which uh we
already covered the motivation uh next
we'll talk about the basics of the
concept of pareto fronts why are they
useful uh then i'll give
real world example with an emphasis on
applicability how can you
is this relevant for the projects you're
working on and um this this this last
part if there isn't time you'll have
online material in which you'll be able
to use something called genetic
algorithms
for those who are interested in applying
in practice
so with that uh i'll i can start with
the talk um optimization means different
things to people so for practitioners i
like this um
uh this definition by professor deb as a
procedure of comparing feasible
solutions until really there's no more
that can be found
either practically or just in terms of
resources
um you know a topic is interesting if
the creator of the um illustrations of
xkcd actually has a cartoon about it so
i like this one over here and which is
useful to understand the concepts of
multi-objective optimization so imagine
that you're
so what you see here is um the creator
randall just uh subjectively distributed
his um how tasty he finds fruit and so
let's just imagine you're an office mate
of his and you want to treat him with
the most tasty fruit according to him so
of course you can't going to hand him a
peach but let's say
he also um you want him he's leaving the
office and you want to provide him with
the most easiest fruit to eat
on on the go so then you'll give him
seedless scrapes but then the question
arises and this i actually want you to
answer in the chat is
which is the optimal fruit if you want
to optimize both for taste and easy so
just take um a few seconds to think
about it and just pop in the chap which
one fruit do you think would be optimal
which one should you give them to it
here both for ease and taste i'm not
seeing anybody write in the chat yet
so i'll give you a few more seconds i
was told actually that it might be a
delay in some countries
um
so remember you want to optimize for
easy and tasty
okay
chris you say bananas
i'm not sure about that
i see one for peaches okay
so while you're thinking about it i'll
just give you the answer actually it was
a trick question there's no one fruit
that's optimal uh but rather we have to
consider and this a set of optimal
solutions called an optimal front or
pareto front and the purpose of this
talk is to have you understand why these
are all considered
equally optimal and
how we can make use of this when we're
doing multi-objective optimization
so what is optimize and what does
optimizing look like so imagine that we
have in a parameter space in which we
have two objectives uh very creatively i
call them here objective one and
objective two and
this then this imagine that you're this
is like as an analogy like a dark room
you know nothing about the pro about
these objectives this could be quality
and price or this could be
characteristics of a protein or this
could be on the user experience of the
the uh in home delivery service the
experience of the people who ordered
food or people who are creating the food
in the kitchen so any two parameters
that you can imagine you don't know what
to expect so what does optimization look
like so normally what
what's common practice what i refer to
as single objective optimization is you
is is um
what a lot of analysts do they just
do some sort of multiplication for
example and so what they're doing
they're tunneling um let's say with the
flashlight they're just going through
this tunnel of space just optimizing for
this one direction right there
and then they'll conclude that this
solution is the most optimal and so of
course there's different algorithms you
can add you can take the mean and let's
say you want to that's when you're
maximizing both but you can imagine
maximizing one minimizing the other then
you can take
the difference or or divide okay
when i was working the biology lab i
learned that actually some processes is
what's called i call linear one id
optimization in which they choose one
objective they maximize that one
direction and then they turn around for
the second one and then in this case
like they say oh this is optimal
you but that was that was
a subjective choice why did they take
objective one they could have just as
easily take objective two
uh go maximize in one direction and then
maximize the other direction say well
this is optimal
right three different methods three
different choices um and so imagine
again this is using a flashlight in the
dark room what do you really want to do
well you want to turn on the light in
the room and take have a full absorb the
full solution space so here i'm
highlighting
um these three
uh solutions that we chose that's
optimal
in this highly curated distribution but
if we had the likes turned on then we're
most likely you know subjectively just
looking at and say um well this one is
more likely to be more optimal than the
rest of them
that was very subjective but there's a
whole lot of others which we can um with
some mathematical rigor we can say well
all of these are considered equally
optimal they're called up a pareto front
solutions and you can see of the three
ones that are in red this one is not in
this pro in its optimal set why is that
well that's the purpose of the next
size that we'll get to
but before that we have to talk about
subjectivity i mentioned the word
subjectivity a few times and um why is
that important um well i like to think
of this quote by muliel
which says that um
in other words it says that if you think
you truly believe that you understand
something without exploring it then
you're just fooling yourself so that's
my takeaway from the statement and what
does that have to do with what we're
talking about is the fact that in any
analysis as objective as we want to be
we're going to make a subjective
decision at some stage the question is
when are we going to make this so when i
talk about single objective optimization
then normally
we're creating an ad hoc heuristic not
ad hoc sorry we're creating a heuristic
before we're actually doing the search
the purpose of this talk is to convey
that with the pareto front method you
actually want to hold on to that
decision not make it be open for
anything that comes and make that
decision only after you start exploring
the data
and that's what we'll see in the next
few slides so that's the importance of
subjectivity and when you think about it
what do i mean by analysts making
subjective decisions in general well
anytime you have a distribution and you
want to quote it by number let's say do
you decide the mean
mode or um or median well if you have a
perfectly symmetric bell curve shape
then they're it's all the same it
doesn't matter but most real-life data
is skewed and so that's important maybe
it's bimodal right so
you have to learn the data and then make
a subjective decision and the good
analysts make sure that's a sound
decision that can be justified the same
thing when you decide the bins of a
histogram the same things when you
decide should i present data in a linear
scale or a a log scale right so these
are subjective decisions that we make
and it all depends on context uh same
here when you decide what's optimal
first look at your parameter space and
then make that decision
so with that in mind we're ready to
define what pareto front is um so
beforehand um in order to define that we
have to um
when we look at a a scatter plot we have
to differentiate between two types of
solutions so these are two objects you
know two dimensions of objective space
and um
we have to
define all parameter uh all solutions
either as what we call dominated or
non-dominated uh with a non-dominant or
what's called pareto optimum so what do
we mean by that so let's learn by
example
for example this solution k over here so
it's it's classified as dominated
because there's at least one other
solution
that
um that
is is better that has better performance
both in objective one and objective two
assuming that we want to maximize both
in that case for example we have n
and e the reason n is called is is also
called dominated is because e dominates
n both in objective 1 and objective 2.
the reason that e
is considered non-dominated is because
there's nobody over here that dominates
it both in objective 1 and objective 2.
you can say well f dominates it in 1
right in this direction but it doesn't
dominate it in objective two in in the
horizon in the vertical direction same
thing but the opposite for d d performs
better in objective two but not in
objective one so that's why e is
considered non-dominated and hence what
we call pareto optimal and the same goes
for all of these
solutions a through through h so again
the definition of a pareto front is a
set of non-dominated solutions
and then you can ask the question
well
which is optimal so that's where the
subjectivity comes in so we haven't made
that subjective decision um
and they're still considered equally
optimal and then once we have this look
of the space then you take then you or
where the domain expert is then you
create a subjective ranking you can
either focus on these over here or maybe
you're more interested in the ones over
here it really depends on context as
we'll see another thing that's worth
highlighting is the nice thing about
this approach is we do not care about
the units of scale
right um in this this could be anywhere
between you know milligrams to kilograms
it doesn't matter because you're going
to get mathematically you're just going
to get uh the same
differentiation between dominated to
non-nominate
so that's what um that's what pareto's
fronts are
um so before we look at applicability
we'll talk about um
uh we'll talk about um
sorry we'll just summarize
um okay so a pareto front is a set of of
of trade-off non-dominated solutions and
this should be all considered equally
optimal uh throughout this talk i'll
i'll show you uh um in two-dimensional
space but this is also relevant for any
n-dimensional space this extrapolates uh
to many dimensions
and
remember that the context of
subjectivity we don't make any prior
constraints before looking at the um at
the distributions you if there are
limitations of course you put them in
but otherwise there's no if there's no
good reason to put constraints you won't
use them and um
and the reason that perhaps optimization
as you see is better than the single
objective optimization is because you're
really getting a broad like a bird's eye
view of the solution space as opposed to
putting on horse blinders
um okay so with that
in order to practice this concept i
created an app and here's the link so
feel free to go into the link and i'll
just quickly i'll demonstrate it
cool so i call it pareto because
just like in wekamo the objective is to
look at a distribution and try to guess
of which um
uh which
which solutions are actually pareto
optimal uh so javier i will ask for you
in the chat to give me a number um so
this will be the same number of a
distribution that i'm not aware of i
cannot see um 705. okay so i will put in
705. thank you for that very
thoughtful of you okay so this is a new
distribution i have not seen before um
okay so
and i want to maximize let me make sure
i want to do max max because that's
easier to understand you can do any
combination but we'll do max max in this
case that's what i'm asked for how many
of the 50 solutions are pareto optimal
so my understanding and something you'll
gain with time that's the purpose of
this sort of app is to learn that one
two three hopefully i'm right i'm not i
don't always get it right but i think
that it's three so i answer it here
and in this case i'm correct
okay have you ever give me another
number quickly if you have one
i just want to see if i can
five
okay so that's a five
okay
five new distribution
okay that that's a bit easy this is two
but yeah but i i i so i don't always get
it right that's that's my that's the
point i wanted to make uh cool so feel
free to play around with that app you'll
have the link again
if you want to see it um maybe i'll just
put it in the chat as well
okay
cool so
um yeah so feel free to play around with
that
uh just to understand the topic okay so
we're nearly there i i i'm nearly there
in which i can talk about real world so
i'm gonna
share my screen like this
okay we're nearly ready to present it in
the real world but beforehand i have to
talk about two different spaces so we
talked about objective space uh but now
we're talking about something called
decision space and what does that mean
um so far we were focusing on pareto
fronts in the objective space how do we
optimize for it but there is this other
set of parameters which is what yeah
which is called a decision space and
what do i mean by that the objective
space is what we're interested in right
that's the price versus quality that's
what we're interested uh at the end of
at the end of the pipeline but we don't
have control over that there are
parameters think of those knobs those
are the things that we turn around and
that's what we're actually interested
and we we can just make decisions on
okay um so uh
i'll give a few real a few toy examples
and a few real-life examples this is a
classical toy example called the
knapsack problem and so the objective of
the knapsack problem is you have um a
lot of boxes and they all have value and
they have weight and your objective
your
your you have two objectives you want to
create you have to put them in in a
knapsack in which you want to maximize
uh for let's say you want to maximize
for value of the packages but you want
to minimize for weights okay my axes
here aren't perfect but
but just imagine that you
make these combinations that's your
decision space and then you have your
objective space um
in which again it's value versus weight
okay and so what's also important to
emphasis is you need a mapping between
them the mapping here is quite trivial
right you just weigh the boxes or you
you quantify the monetary in that way
that's the mapping between decision
space to objective space so this is a
very useful toy example and then i'll
show you how you can actually learn this
more in detail but i want to mention
that this i use this as a perfect
analogy for my work in uh
therapeutic discovery and so what i mean
by that is when i was working with
protein engineers they have full
constraint over the dna sequences so
those things that they can easily order
from a lab and they actually construct
it uh within their own settings and so i
was helping them decide what is the best
dna sequence to optimize for what we're
interested in we're interested in
protein function that might be how it
binds to another protein it's potency
that means how effective it is or rather
uh something deleterious like how toxic
is it so um
and so this is what they decide this is
what we're interested in but the real
expense actually is in the mapping
because you know just having a sequence
on your computer screen
to actually measure this well you need
you need a full-fledged laboratory so
that's very expensive and that's what uh
lab genius the biotech company work in
they actually have that so they have the
biological setting and i was working in
a machine learning group and we were
actually creating this
using machine learning this mapping
between sequence to
um to protein function
so we can optimize for um
for for the drug discovery we were
working in the context of crohn's
disease
um so here i'll just show you this
a case study it isn't the crohn's
disease case study this is kind of like
i'm actually using public data as
opposed to their priority data um
as opposed to the proprietary data and
so the data that i'm using is small
proteins called anti antibodies in which
um they're about 200 in length but
they're about 20 locations which uh
we're causing mutations and so 20 to the
power 20 that's a very large space
that's
intractable it's 10 to the 26 10 with 26
digits
10 to the power 26 um and so it's
actually mostly what's called wild type
and that's what i manifest here in this
frequency distribution so here are the
20 locations i just put them all side by
side and here you can see that ninety
percent of the time this first one is t
and ten percent in time it's these other
letters that you can can't see because
they're squashed so that's what i mean
by ninety percent wild type and the goal
was to discover um discover the best
candidate for uh binding and potency and
again i mentioned that we use machine
learning to create that mapping that
link between protein sequence to binding
um so
yeah i don't expect you to fully
understand this in the setup and it's
fine but
but here i just want to show you a nice
way that i visualized on the explo
exploring the decision space so what
you're seeing here is that before i
showed frequency but here i'm showing
the frequency change so the way to read
this is that um
here for example remember i mentioned t
in the first position here it's actually
rejecting it and preferring it for
example t over that as opposed to these
locations here in which it actually
likes the wild type i don't remember
what it is but it actually likes the
it's probably why so it's actually likes
the wild type uh and definitely here it
likes the weld that's what you're seeing
here and this is the decision space but
remember i talked about objective space
this is what we're actually interested
in let's say binding and potency
and so i'll just rerun the video from
the start here and you can see the
solution space started from over here
and here i'm like doing explore exploit
like looking at at the space and the
objective is to get over here and i'm
looking for solutions meaning these sort
of combinations to get to this region
over here so this is one uh way
and the way i'm using it is you see here
this pareto front the um if you start to
get the rift of how to identify
protofronts here they're all marked with
x as i mentioned here so this is the
protofront of this distribution
um so then you write for that okay so
great so you have this you did many
iterations um so how do you decide uh
which proteins to suggest um that they
actually order in
an engineer for well that's really
subjective that really depends on the
domain so the purpose is uh whatever
decisions we made we did it only after
the search remember not before the
search so that's exactly what i'm
talking about in our case um the the
protein engineer told me well we're not
interested in this region this is too
low and this objective these are too
long this objective well you know
definitely take these and then anything
in this vicinity and so what we ended up
doing is testing over here for example
and so this is one way to go about it
so again the purpose of that slide is to
emphasize the subject you have to make a
subjective decision at some stage but
you want to hold that to the end
um this is another case study um
so
if you're familiar with with machine
learning then these these parameters
that are called hyperparameters and so
these are things that again that we can
can control for so here for example
there's this technique called decision
trees and it has one parameter called
learning rate and the number of trees uh
that's what we control for hence our
decision space but that's not what we're
interested in what we're interested in
actually is the precision recall
accuracy and other related metrics and
the mapping is a whole process of
machine learning of training
cross-validation testing etc going
between these parameters to what we're
actually interested in
so this is common practice for machine
learning practitioners most of them do
single objective optimization but i've
one but i i was happy to find this
article online in which this this team
from sas institute they actually use
multiple objective optimization and
meaning pareto fronts in order to do
hyper primary tuning so here i'm just
highlighting uh they have a whole lot of
case studies here i'm just highlighting
just one of them a company called
donorschoose in which they're helping um
um
uh this organization uh provide
materials for
for for for teachers the thing is that
they get many proposals only about 20 of
them are actually
worth their while and so they wanted a
machine learning algorithm to tell them
to maximize uh to minimize
misclassification and minimize uh
simultaneously false positive rates um
yeah so the details don't matter but the
fact that they
had two objectives to minimize four and
that's what i'm showing over here so
here um
so
just using the vanilla parameters uh um
you know without doing any tests they
have you know this misclassification
misclassification about 15
and just about just about three and a
half percent false positive rate and so
they tried single objective optimization
minimize um you know a a few metrics and
you can see it massively reduced
misclassification but actually it did
worse in terms of false pause
false positive rate and the importance
of this and so um and so they said then
they did multi-objective optimization
and here you can see the distribution of
all the solutions they looked at and you
can see highlighted here in green is the
pareto front well now we're at this
juncture well we have all these
solutions how do we make a decision well
what they said well before making the
decision they notice this odd bump over
here so what they said is they'll do a
cut off at miss classification they'll
redo re-run their calculation so here
just focusing on this box they have this
other nice visual which is so well the
green dots are the same as before all
these dots are the same except for these
triangles in these triangles what they
did is what they called a constrained
search so even though they were open for
all parameters before now they're saying
only accept uh solutions that have a
misclassification less than uh 0.15
where this bump is and so hence they got
these triangles and then they get again
at this point well well we have to
decide one of these and this is where
subjectivity comes in just
well i think this one
is the best let's go with that okay
and so that's the idea and the end
result is compared to this initial data
point they show that in terms of false
positive rate um you know to get to this
point they reduce about a relative eight
percent and misclassification they
improve by an absolute five percent
so um if you're a machine learning
practitioner then um
it's extra resources do these
calculations but you might get an edge
by doing so
um so another
so another question for the audience um
i talked about how to identify pareto
fronts i challenged myself i gave you an
app let's see what what you see over
here so let's say what's the which fruit
are pareto optimal for the opposite
before before we want to be nasty
colleagues and we want to provide them
with the fruit that's most difficult and
most untasty so if people can just
answer in the chat what they think it is
before i give the answer
so i'll give you about 10 seconds
which fruit are both
difficult and untasty
according to randall
five more seconds
all right so these are the ones that i
picked up these are all considered
proto-optimal if we want to um yes i
appreciate that the chat is a bit
delayed
um but
okay
cool um
so
so yeah so if you got it great if not
then um in any case you have the app to
play around with it
um is this top is is this um pareto um
is protofronts relevant for the projects
that you're working on that's what we're
addressing over here so you want to look
into this technique if you're dealing
with conflicting objectives the next
thing um
my experience with my conversation with
people i realize that not everybody has
full control over the decision space so
you want full control over that
and then when it comes to the objective
space you need an inexpensive mapping
because sometimes you can make the
decisions but in order to map that to
the actual objective space that might be
very time consuming or might be very
expensive
and so that's another consideration
there's also a further
consideration is how big is your
objective space or decision space for
example when i talked about drug
discovery well the dna sequence space is
astronomical and hence what you need is
a stochastic algorithm in order to
um
in order to navigate the space
and so
uh one recommended technique is genetic
algorithms and that um so with that that
actually is that last topic but i think
uh how much more time do we have for for
um this talk
okay i was asked to
wrap up so that's fine
so
okay
so don't worry about the rest of the
material uh we have um you'll have all
access to
all the material online um so i actually
in the past uh conferences i have a
hands-on tutorial in which if you're
interested to go over this material
again and have getting hands-on
experience with the knapsack problem
with jupiter notebooks so uh you have
all of that over here i'll just very
quickly show you what it looks like
um i see already
14 of you are actually looking at it so
that's great um so just quickly to go
through it
um
okay so what it is is you have basically
videos of me talking exactly about this
topic and you'll have jupiter notebooks
um in which you can actually practice
this um in which um you learn about
genetic algorithms and vast techniques
so you can uh use in your own projects
uh okay so
sorry i'm just going to
share
so i can see
the
[Music]
okay so just um
okay so uh just to summarize uh
multi-objective optimization is useful
when you have conflicting objectives you
have full control over your decision
space and you have an inexpected mapping
to the objective space um
yeah if you have an intractable
objective space you might consider
genetic algorithms again you have all
the material online you have a tutorial
um you can play the pareto wack game if
anybody's interested in more material
online i highly recommend anything by
zitzler it's a great read and there's
also python prototyping
module called deep which i highly
recommend
as well to do prototyping i find it very
useful
so um yeah thank you very much
thank you ayal this has been great and
unfortunately we don't have time for
more questions but i think
you know all these follow-through
materials and follow-on materials are
gonna tide us so thank you yell again
and next up on today's
data science and analytic track at
pyconeu 2021 is a closing session with
lars jenkin systems of the world
cataloging the world's data for great
good please stay on uh he will be on in
another 10 minutes at 4 45 australian
eastern time