of run away from everything or it can be a super heavy creature so that no one


Conversation about Population-Based Methods (Re-upload)

can attack me and so these are kind of the dimensions that you can solve the


problem of reproduction and survival and within so that what map elites does it


it would segment this area so let's say size and speed it would segment this


into a grid and then in each grid it would kind of maintain the best


solution so far that is within that grid and then what they see is when they then


kind of evolve this over time and improve each each grid is that inventions


let's say inventions algorithm discoveries in one grid say for a very


fast creature they would then kind of be adapted to the very let's say the very


heavy creatures so it's like fast creature kind of discovers or longer


legs make me even faster maybe the longer legs can be combined in the


heavy creature to do something else so this kind of goal switching it's think


of like feathers being first kind of developed or evolved for warmth for


temperature regulation then being goal switched over to adapt it for flight so


in the in terms of multi class classification I guess it's a bit of a


different problem if you just have one classifier you can definitely make the


argument that since you know you're learning maybe to classify one class


really well the low false positive rate you have learned very good features for


that class and if some other class kind of like the zebra is a horse with


stripes and then the horse is a horse but with the feature stripes being


really low you can probably classify that better something making stuff up


here but it's a bit of a different context I feel the if you have a single


classifier do multi class classification but definitely the logic applies in the


feature space I would say where you learn features for one class and they


might become useful for another class yeah I had this other thoughts sort of


when you're discussing that is like what about like multi-class multitask learning


like maybe my intermediate features get mapped to a classifier I get mapped to a


segmentation get mapped to again like could goal switching improve


multitask learning yeah I would definitely say so I think that that's


exactly what we're seeing when you look at for example pre-training so if you


think of like this whatever these newest big language models like BERT or


something they're really good at tasks I don't know what it was an NLP task


labeling of sentiment sentiment classification if they evaluate on that


because it's so easy but let's say BERT is really good at sentiment


classification but if you were to just to train it out right on sentiment


classification it's probably not gonna work because there's just too little


signal but then what happens is you pre-train it as a language model as this


masked language model and it kind of gets really good at simply comprehending


language and that skill can then be kind of adapted over into the into the cement


sorry into the sentiment classification realm so I think if you look at yep


something like pre-training or multitask as you say then definitely one what the


addition of a task might give rise to certain features that then all of a


sudden can be adapted by another task whereas if you just trained the latter


task by itself that maybe would have been too difficult so yeah there's


definitely an analogy so then what I think about is so I'm going from my


pre-training language model into sentiment classification and maybe I


also add like question answering document summarization named entity like


this like vector of tasks that it can go do I'm then curious like when your goal


switching it's like how do you then combine the features later on or do you


just like take it as if I need this task I'll go to this model likes yeah well


the question here is do you whether or not you implement this as a single model


and kind of refer to the goal switching of features within that model or whether


you also do this now as a population based method where basically you


maintain you you maintain different neural networks for different


combination of these tasks then you did actually need a method to kind of


combine and reproduce the neural networks themselves which I yeah I I see


that's that's gonna be a bit of a difficult task like some cross


distillation or some something crazy yeah I don't know how that will work


exactly yeah I just wonder about two things it's like do for my population


based search could you have like the weights be the population like different


sets of weights or would it necessarily need to be like taking apart the layers


and designing new internal like cells as in the architecture search like because


if I just have the weights maybe I could treat the diversity search or goal


switching as like stochastic weight averaging and just like mesh them all


together when I'm finished with my goal switching at the end but if it's yeah


it's definitely be if you wanted to if you yeah if you wanted to if you wanted


to implement your multitask multitask tasking as a population based approach


where yeah you could def it would definitely give you an easier time if


you keep the architecture of your neural networks the same and simply have


different weights and then you could indeed consider something like weight


averaging or or yeah I guess a more modern approach will be like distillation


from it the two teacher models into one child mode it's actually a good metaphor


for a for reproduction kind of a distillation from multiple teacher model


don't know if anyone's done that yet but yeah I guess that that might be the way


to do it if you also maintain different architectures for different problems


that might be a bit of a yeah yeah that's an interesting thing too if you


have the goal switching and then you model distill it all into one model that


is yes well if you think of map elites right you'd simply you'd simply distill


it into the the appropriate I don't even know what the what the axis would be


probably I can imagine okay you have like three tasks so you have three axes


and then you'd mix the task maybe in accordance on how far up your of these


axes you are or something like this could be it's not exactly map elites


because your actual objectives are on the axis but I don't know yes pretty


close but just to backtrack one step I want to talk about like diversity


centric search novelty like when I was thinking about that I was like can't you


just initialize it such such that it has maximum diversity like can't you just


initialize the population such that they're all like uniformly spaced and


then search locally from there so I just wonder what you think on that and how


this is different from that so yeah in this in this diversity search algorithms


basically what you're you're doing is your your only goal is or your main goal


depends on the album but let's say your only goal is to find diverse behaviors


or diverse solutions diverse whatever I think the main problem with that is is


that the search space is so extremely large that you're gonna have a hard


time even even defining what a kind of a uniform distribution is because it's


such a high dimensional space that even if you sample uniformly it it's it's


almost empty like you're almost right you're not you're not getting anywhere


because you have finite a finite computer you need to implement an


algorithm even if you even if my computer can hold a hundred thousand


different members of a population in high dimensions that is nothing so to me


yet the initialization might be definitely important but I don't think


you'll you get around some sort of iterative procedure and carry them


around weeding out weeding out things such that you have space for interesting


things because ultimately what you want to find is something interesting in the


robot maze example the novelty search basically is here is a robot you started


right and then you want to do something that you haven't done yet right so if


the robots crashes into a wall the first time that's a good thing you say oh cool


you haven't done that yet but if it crashes into the wall the second time


you're like you've done that already right so you you you basically need a


measure of saying how close two behaviors are but if the robot has


crashed into every wall once the only thing it can do if it wants to do


something new is actually go around the wall and then you're like oh cool you've


done something new but the space of behaviors often is so large that you


can't simply enumerate all the all the behaviors so you I think that's the the


main problem why you can't just make it diverse from the beginning yeah when I


think about that I was thinking that maybe the like reward function if you're


like navigating the maze it needs to be more refined so if it crashes into the


wall that needs to be like I don't know plus three some some like unique signal


I feel like in order to create that kind of because like thinking of if it's just


like reward zero everywhere but one if you hit that a finish line and then


maybe some kind of like discounting for how long it takes you to get there it's


like I don't see how it could interpret that it's done a new behavior if all it


has is it so to me it feels like it's all about the design of the reward space


now to implement such a thing yes absolutely so the that definitely if you


wanted to do novelty search you would need to implement a measure of how close


to behaviors are so there's no way around and I think that's kind of crux of


the of this method is that by specifying how close to behaviors are so what what


constitutes novelty and what doesn't you already implicitly kind of telling the


robot something about the nature of of the world so I think that the kind of


the objective because they now say oh we don't give the robot the objecting of


reaching the target we simply give it the objective of not doing the same


thing twice I think the kind of objective sneaks in in there like again


through the specification of how of you how close are to behaviors but definitely


this is just kind of a really simple example what they want to say is that


these methods really become important when you have ambitious objectives right


in the maze we can all agree if we just design the reward crashing walls bad you


don't have to actually go straight to the goal you can you know but go around


walls good and so on then it's easy right but in really ambitious objectives


like I don't know flying reaching the moon in the in the 1960s designing


general AI curing cancer and so on we don't actually know how to design the


reward right because we don't know which steps need to be fulfilled in order to


to fly to the moon I guess now we do in hindsight right but we couldn't have


predicted we don't know which steps need to be discovered in order to cure cancer


and it's very very probable if you look at history that the fundamental


discoveries that lead to us cure and cancer will not directly come from


cancer research that's that's their entire point right it's not like you can


have a goal go straight towards it if it's like a really ambitious goal very


probably the solutions will come in part from extremely non-related fields and


they and you kind of have to make advances everywhere and in order to


solve that problem so the the the question of it's all designed it's all


about designing the reward yes but we would have to know how the reward must


be must look and in these really ambitious objectives we don't and that's


that's where they argue well the best thing actually you can do is to just


explore and you just find interesting things along the way and you kind of


hope that these interesting things will come no you know the interesting things


will combine to form new interesting things right but you just don't know


where you're gonna end up right yeah I guess maybe you could just keep a trip


like the trajectory of states and use that as your signal of novelty but then


I think like if you've got like a robotic arm with like X degrees of


freedom it's like the state space would be too infinite to really like say oh


this was significantly this is a significantly different sequential


procedure of states and this other thing so then the next thing yes I think this


is a good transition into their pick breeder experiment and so anyone who


listens to this who hasn't watched their talk the pick breeder is like they've


got these generator neural networks with sets of weights and they have like


humans go on and they pick two of the generated images to blend together and


derive a new image and so this repeats on and on until it goes from like just


like a spiral pattern turn into like a skull face drawing or a butterfly


drawing or something like that and they so this idea is supposed to represent


open-ended miss in an environment and not so it just generally I I just found


it to be really interesting I think it's one of the things in their talk that you


look at it and you're like oh that's interesting what what is going on here


but it's like the the mutation is really guided by the human search which is so


complex I feel like I was just wondering what you thought of that pick breeder


experiment yeah it's really cool and it's it's it's actually the basis for


their entire books I've read the the book the hum my greatness cannot be


planned I believe I forgot the title so that this they actually they kind of


start out with this as a motivational example of what if what if the only goal


is to do something interesting and without any objective so all you do is


kind of choose slight variations on a current picture and you see what you end


up with and I thought I thought it illustrates their points extremely well


so it illustrates for example goal switching is that so if you were done


with your sequence of image manipulations you could then save it


into the database and someone else could pick up from it and then kind of


continue it and since every human finds slightly different things interesting


right you could take someone else's final result and say ah you know that


that kind of looks weird but then you your modifications to it will be


different than hat that human continued breeding the picture so what you you end


up is that and they show this for example one picture ends up being a car


and it had been adapted from an alien face where the eyes of the alien face


became the wheels of the car and so that the first the first person might have


been like oh this this this looks more and more like an alien face I'm gonna


you know make it more like an alien face and then the second person is like oh


that kind of looks nice I'm gonna modify it in a different so they they basically


they basically give this example of if you have an ambitious goal like getting


to a car just from these very simple picture generation networks then the


stepping stones to get there have nothing to do with cars and the people


that did it didn't have a car in mind while going there and the second thing


is that if you try to get a car from the beginning I believe they've they right


they've done this if you try to you you can't like it's just the sequence of


things that you have to go through is so complicated and convoluted if you were


to try to end up with a result it's it's basically impossible so these kind of


illustrate their points very very nicely and I mean it's a cool experiment in


itself but they use it kind of as a basis metaphor for then going on jumping


off yeah yeah I just think it's so interesting this idea that it's like you


can't design a car unless unless you don't try it unless you just happen to


come across that it's sort of like I think about like if I was to fire up


GarageBand and start trying to make a song it's like I don't know exactly what


it's gonna sound like I'm just gonna kind of explore until I come across


something so then I was thinking about like with the GANs and the way that the


GANs design images like so this is like sort of a design I I drew up that I'm


curious what you think of it's like what if the generator just like tries to make


some object and then a pre-chain classifier says oh I think it looks like


this maybe and then you send it to like a refining network so the GAN just sort


of searches for objects and then some classifiers like I think it looks like


sort of like how the pick breeder sort of like how we're like I think this


looks like a skull or whatever so I'm gonna try to you know refine it now do


you think that would be an interesting thing or you'd have like a two-stage


process first you do something general and then it gets classified and then


you'd have like a special generator just for the skull class and the special


discriminator just for that yeah I don't see why not


might be hard it might be hard to get the first generator to to be


sufficiently diverse so you might might need some kind of discriminator signal


at the even at the beginning so yes yeah like how do you think the pick breeder


experiment could become fully automated such that there's no human in the loop


yeah that's that's a thought I had as well because it to me it seems that the


the kind of of course the resulting pictures the fact that they look like


human objects or recognizable objects is a result from them being being bred by


humans like the fact that it looks like a car or a skull or something like this


is it's very much but also I guess that that could be abstracted in we just not


expect the results to be like human recognizable objects but maybe


something else the much more deeper construction in pig breeder is the fact


that the measure of interestingness is provided by the humans right so the


humans they they click on a picture and then they get variants of that picture


and they click on the one that they most like this this sense of interestingness


of I like this one this that's what's that's the fundamental core that's


provided by the humans as an input to the system that's what drives the entire


thing that's exactly the same as before it's when you right when you teach the


robot which two behaviors are close enough like oh no that's too close to


before that's not novel or yes that's sufficiently different than before that


is novel right this this sense is somehow you either need to specify it or


yeah you need to have the human in the loop to provide it I feel it's very very


hard to capture that in an algorithm as as of today yeah like something I think


about is like maybe I'd have like my thousand class image net classifier and


then maybe I'd have like like a style classifier like a neural style transfer


network that I've like chopped off the I like some intermediate feature I'm


gonna take that as my style and so maybe I'm like classifying I think it's like


an airplane and then I kind of like this style for it that's sort of like my like


how I would think about trying to automate that like I don't know I guess


like I don't know if I I guess it's interesting but I also feel like when


you're doing the pic breeder you're kind of like oh I'm gonna try it now now that


I see this vision I'm gonna try to make it like look like that now I suppose


like yeah yeah yeah yeah like I think I could make this into a skull and then


you start doing yes yeah yes they're very much so they're not they're not


advocating random exploration what they're advocating is basically if you


have an ambitious goal then you basically don't know the stepping


stones but from stepping stone to stepping stone that's where objectives


are very handy so when you want to say I this already kinda looks like something


I want to make it more like that when I make it more into a skull right already


has like two circles and kind of the shape but I'm going to drive it there


that that is very that can be very objective driven but in the grand scheme


of things you don't know then once you have the skull right someone else can


develop that into an even new thing so yeah indeed if if you if you are in kind


of a local search in this space then an objective driven behavior like what


you're saying like I want to make it as much this as possible that's very that's


actually a thing they're advocating for but then from their end result yeah you


would need to then restart again do the same thing with like something else huh


yeah it's really interesting I just thinking about


yeah I think about like the stepping stones and like is how would you define


the space of stepping stones to such a to any kind of thing I guess it's like


you could still design some kind of maybe it's discreet or maybe you have


some kind of signal you can get back from it and I guess it's it's just a lot


to think about how to direct that take away they give this they give this great


analogy I feel like if you have a really ambitious objective it's like crossing a


lake but the lake is covered in fog so you basically can't really see very far


but you can always kind of see the next stepping stones right and you can then


you can then try to go from stepping stone to stepping so but you don't know


which one to take if there's like a fork and there's two ways positive you don't


know which one right so all you can do is basically go the most interesting one


and they relate this to scientific research so yeah if we want to


accomplish some really great research goal like artificial general


intelligence we don't like we don't know but we can see the next stepping stones


right we can see oh from what we have right now what interesting combination


could we make that's still kinda it's still kind of makes that's not total


garbage right so in in the local search I can try to say I want to I don't know


I want to do this I want to do multiple generators and it's multi-stage and then


this thing right just this is kind of a stepping stone and maybe that will then


lead to something more interesting and so on so yeah that's that's kind of how


they relate I like this metaphor of the lake yeah yeah I just like could like a


meta controller try to put the stones down and then the objective it's like or


is the space too enormous that that idea of having a meta controller guide the


stepping stone placement is just like absurd and that and there's no way that


that would work that's sort of where I'm thinking with this now is like so they


actually that's that's exactly the the question right of what I so I believe


you need such a meta whatever because the space is too large you somehow need


a way to choose the the stepping stones in the first place right you somehow


need a way to do this now what they're saying is that if you're if your goal is


really ambitious then a meta controller that simply wants to reach the goal is


bad because right because what we discussed before you might need a lot of


inventions from other fields in order to make goal happen and if you simply go


your field maximum power towards your goal that's not going to happen now if


your meta controller is actually just something that wants to produce


interesting things then that's actually something they they advocate for that


is exactly what their algorithms are trying to capture they're trying to


capture locally yeah we want to get better at a particular thing what those


particular things are and the order of these that should be novelty driven


instead of gold ribbon yeah yeah yeah the interesting component I guess I'm


sort of biased towards liking the objective design and now I'm thinking


like okay well let's abstract those meta controllers one level up and have a


meta meta controller and just repeat this into a hierarchy makes sense and


that if you if you if you're if you're a bit cynical that is what you will also


hear out of here out of and they have to argue in the in their book a lot of


guests that like isn't the question isn't the kind of isn't the


implementation of a meta controller that just searches for novelty in itself an


objective again and then they give some good reasons why actually you don't you


it is different it's more like a constraint on your search if you think


of natural evolution for example it isn't really doesn't really have an


objective and and if you think reproduction and survival is the


objective of natural evolution it doesn't really the good the good reason


they give is the objective has already been fulfilled by the very first


organism to ever live right why didn't it stop there right why didn't it stop


very first cell okay done we fulfill the objective it's it's more of a it's more


of an actually a constrained optimization where the constraint is you


need to be able to survive that's kind of the minimum bar of to being on this


planet and then but I'm saying constrained optimization but it's it's


not it's not an optimization it's more of like a constraint constraint search


okay yeah I think yeah I guess it's just like I definitely think I'm closed in


this world of trying to think of these constraint problems and I haven't really


like thought more generally about just like exploration as a whole but but


anyway so I just wanted to ask you generally like you're deep learning


researcher I want to ask like what areas of deep learning are you really


interested in right now and what do you think is promising in the near future so


I'm currently working in adversarial examples that is a really interesting


topic there's lots of questions still still open but I'm generally interested


in pretty much any anything that is not I'm not too interested in like the


newest the newest fine technique on getting the latest state-of-the-art


numbers even though that's probably super important for practitioners


basically agreeing more with the authors of this tutorial of that let's just try


to do interesting things and to me these these actually these these areas in in


terms of open-ended open-ended search open-ended learning are very


interesting I think reinforcement learning still has a long way to go I


think actually NLP still has a long way to go because I don't believe it's the


current models are the end of it so I think it's really exciting time and yeah


I love think about adversary examples because it definitely flips the CNN idea


on its head and and then I so I have one other thing about adversarial examples


that I'm interested in is there is like an interview with Elon Musk and this


Lex Friedman researcher where he asked him about adversarial examples on his


self-driving cars and he seems dismissive of it he says he thinks


basically you could just average different patches of like test time


augmentation to overcome adversarial examples so like in your research do you


think that like the example where they add the noise mass to the panda and


they're like oh it's a given now if they just perturbed it like nine more times


do you think the prediction would average out to pandas still that is a


that is a very difficult question and in from experience simply adding noise and


then feeding it to the classifier even if you average after that usually will


it will defend against adversarial examples to a point but it will also


degrade your your classification performance because so maybe I


understood it wrong but my understanding is I have in my input right I simply add


noise to it and then feed it through the network and I could do this many times


right and then average the prediction but usually this will help against


adversarial examples but it will also also degrade the the accuracy of that


classifier so it might actually make your self-driving car worse in the in


the overall because how often is it going to be attacked against a


adversarial example it's going to be attacked maybe I don't know once or


twice a year maybe drives by some some hackers house right some sticker on the


stop sign or something but the rest of the time I would actually like to


retain retain the best possible classifier and if I always have to add


noise then that that's not possible so that the research we're doing is


actually into the direction of can we retain the original accuracy while still


kind of detecting these these samples it's I mean it's you somehow have to get


a trade-off somewhere but just adding noise isn't the isn't the the final


solution yeah I was like so with these adversarial examples they're only gonna


make misclassifications like that if it really is adversarially sought after it's


not just like the noise perturbation would be such an enormous space to find


it otherwise so yes you really need to try so it's very unlikely that that some


random thing of course these networks can be confused by random noise but as I


think one of the self-driving cars once drove into a big white truck because it


was large and white so it thought it was sky but other like like other than these


failures yeah you really have to try to find another serial example really cool


yeah thanks so much for doing this anybody watching you listening


definitely check out yannick's YouTube channel he has really great paper


Mean Shift Intro - Practical Machine Learning Tutorial with Python p.39

What is going on everybody and welcome to part 39 of our machine learning tutorial series.


In this video, in the coming videos, we're going to be talking about mean shift.


And mean shift is another clustering algorithm, but this time rather than the flat clustering


methodology of the k-means clustering algorithm, mean shift is what is known as a hierarchical


clustering algorithm.


Now among other things what this means for us is that unlike k-means where we had to


tell the machine hey we want two clusters or five clusters or whatever, with mean shift


and hierarchical clustering the machine actually figures out how many clusters there ought


to be and where those clusters actually are.


So to exemplify this first I'll just draw a really simple data set and then we're going


to have some data points here.


Okay and if you recall with k-means for example when we started the algorithm we just we said


okay we've got k let's say k equals two we're going to select randomly two or select randomly


k feature sets and call those centroids or cluster centers for now.


Okay with mean shift instead what we do is we say every feature set is a cluster center.


So this is a cluster center, this is, this is, this is, this is, this is, and this is.


And what you have here is a cluster, never mind.


Anyway so you've got all of these as center clusters so then what's the next step?


So mean shift has one thing that the scientist might supply but as we go through it I'll


show you a way that you can kind of determine it automatically and that is called the radius.


So the radius also sometimes referred to as the bandwidth but they really are not totally


interchangeable so basically what's going to happen is you're going to have a radius


around a data point so we're just going to start with one but understand that this is


going to apply to every single data point.


So let's, we're going to work first with this data point here but imagine this process is


applied to every single feature set data point whatever you want to call it.


So every data point has this bandwidth around it so let's say this feature set that we're


working with has a bandwidth and it's like this.


It would be a perfect circle.


So that's your bandwidth and then really your radius is basically this distance right all


the way around that's your radius.


So the bandwidth is really everything within that radius and the radius is that distance


okay.


So for example this starting cluster has three feature sets within its bandwidth which is


determined by its radius.


So again people like to interchange those I really feel like that's not interchangeable


but anyways I could be wrong.


So each keep in mind though again every single cluster center goes through this process so


this is just for one cluster center.


Okay so then once you have your bandwidth and all the data points within the bandwidth


you're going to remember with like k-means for example you're then going to take the


mean of all the data points that are within that cluster.


So in this case you've got three data points what would be their mean?


Well it's probably like right here okay.


So now your new cluster center is actually this point right there okay and then with


it comes a new bandwidth.


Okay so there's your new bandwidth okay and then again we take all of the feature sets


or data points within that bandwidth and then we take the mean of all of those so that would


be basically right it would be this one this one this one and this one and then we take


their mean and I don't know it's probably something like here okay.


So then you got your new cluster center which is there okay and then again you take the


bandwidth which would probably not change too much but it would be like you know like


this okay and then again at this point it would be all of the same data features within


that bandwidth and that or I guess this time maybe within the radius and so that cluster


would not move and when that cluster center does not move anymore it is it's optimized


okay it's done.


The same thing is going to happen though remember we started this entire process with this data


point right we said that was a cluster center so then if we were to do this exact same process


with this data point knowing what we know from what we went through with like k-means


and what you just saw now what is that new the second data point right what is that data


point where is that going to have a cluster center well when you run this it's going to


most likely within one step reach this exact same cluster center and what you have there


is convergence I guess I'll write it all out convergence and when you have convergence


you're done right so when you have convergence you just say okay well both of these became


the same cluster centers so they are the exact same cluster center so just even though you


started as all data points are their own cluster centers as you continue to run the mean shift


algorithm you're going to be whittling away cluster centers and then you're also at the


same time going to be slowly moving the cluster center to a point of convergence and basically


if you recall kind of like with k-means once you have a bunch of cluster centers that are


done moving they're fully converged nothing new is happening you're done you're optimized


and you're good to go okay so as you might guess as you did this to basically all of


these other cluster centers they would all at least down here go to that exact same cluster


center and then up here they would probably all converge about right there and they would


all be within their own little radius there and you're done you've got convergence now


sometimes that's not going to work like just with a simple radius and bandwidth and that's


kind of what we're going to be showing when we actually go through with python but just


as a quick example let's say you've got a data set like this okay this obviously doesn't


really appear to have any clusters but I just wanted to show a really quick example but


with the bandwidths you're going to have you might have different levels of bandwidth so


maybe the first level is this and then you've got a secondary level which is going to be


this and then a tertiary level like this and so on and then the the if you find feature


sets within this first level then maybe they have a weight of three assigned to them and


then out here these are data points that exist but they only have a weight of two and then


these will have a weight of one and so that way you're you're you're encompassing basically


all data points for the most part or a larger range of data points but you are penalizing


for distance away you could also penalize in some sort of squared error fashion or something


like that alright so I'm just going to show a really quick example here there's really


nothing new being covered here besides maybe 3d graphing I'm not really sure if we've used


that yet but if you want to know more about 3d graphing we haven't talked about it yet


you can check out the matplotlib series and learn more about it mostly I just want to


show a really quick example and some sample code but really there's nothing new here so


I think it'd be kind of a waste of time to be rewriting this script when we've covered


basically all of this stuff so anyways we're just creating some starting centers here so


that we can create some sample data these centers are not used in the rest of the code


or the mean shift algorithm or anything it's just simply so we can create this starting


sample data also it'll be interesting to compare since this is where the data started from


we can grab the cluster centers and compare what mean shift found to be the cluster centers


with what the random data was generated from and they should be pretty darn close right


otherwise something went wrong so that's that basically that's pretty much the only thing


I think worthy of mentioning because basically what we're going to do is we just we fit to


x whatever x is from make blobs from scikit learn we get the cluster centers which are


attributes the number of clusters hopefully three plenty of colors to choose from we're


just multiplying this list by ten to cycle through so in theory we can find like 70 colors


creating the graph 3d graph graphing it scatter show cool okay so let's go ahead and just


pop up an example real quick and see what k-means does for us so sure enough we get


this beautiful 3d graph and we've got three clusters here beautifully colored and everything


got this one little outlier interesting I wonder I wonder which cluster generated this


little guy came me or mean shift says it was the blue group but man does that not look


closer to the red in basically all examples maybe in this one I don't know anyway you


guys probably aren't seeing the same thing okay so then we can compare so here are the


cluster centers so maybe not in the same order but we can see this first one right we got


a one one five five five or one one one five five five three ten ten well this is obviously


the one one one pretty close there's a little bit of deviation from that but not more than


would be expected because this is just these are centers to start from and then they're


just randomly created from there and then you've got three ten ten obviously and then


this is your five five five so pretty close to where the random data was you know generated


from and probably if we made like I don't know a thousand samples would be even closer


to those starting numbers so if you're on a laptop or something like that I wouldn't


recommend running running this is going to be like a pain on your on your computer but


anyway so then in this case we've got now a thousand examples and here are new clusters


so even closer to one one one closer to five five five and even closer to three ten ten


and probably we could do like ten thousand or something but even this is going to be


like probably really hard for my computer to shift around sure enough yeah okay anyway


so there's a really quick simple example of mean shift at work but again like kind of


like I was trying to explain before the clustering algorithms are really not so much for you


might use them for visualization but really they're for like some sort of research structuring


data that kind of thing so in the next tutorial what we're going to talk about is applying


mean shift to that titanic data set that we were working with because we were under the


impression that hopefully it will find two groups but maybe that's the wrong the wrong


I suppose thought on that data set maybe that data set actually has five groups or something


like this that we haven't really you know in our head we know it should be two groups


but really maybe in reality these are separable into more groups like for example we already


know right out of the gate that there are three classes of passengers on the ship first


second and third class right that's for sure so so maybe three classes is actually what


the true the true number of groups is on the ship and then from there we can do some more


interesting research and so that's what we're going to kind of start toying with in the


next video so if you have questions comments concerns up to this point before you leave


them below otherwise as always thanks for watching thanks for all the support subscriptions


Shortcut Learning in Deep Neural Networks

Hi, today we're looking at shortcut learning in deep neural networks by a number of authors from


the University of Tübingen, the Max Planck Research Center, and the University of Toronto.


So I'm not going to read all of them, but all of them are either joint first authors or joint


senior authors. I just... what is this? Like, it's just a team of people who did this work together,


this whole I have a star, I don't have a star, I have a cross, whatever. Okay, sorry, bit of a rant.


All right, so this paper discusses what they call shortcut learning, and they actually,


they don't, like, propose something new here, they discuss this phenomenon, and they try to link


several things together under the name of shortcut learning, which they claim is a problem in current


deep learning, and they discuss why it happens and what can be done about it. And I just want to jump


into this example real quick, right? So in this case, you can see you have a training set of images,


and the training set is these four images here, along with these labels, and also these four


images along with the these labels, right? So you can think you can train a machine learning model,


let's say you have a bunch of those, and then you're going to test them on the IID test set,


right? On this test set. And what you'll find is that if you let a human do this task, right,


the the human would give this an A, this an A, this a B, and this a B, which is what you can


think of is probably what a human would do is like, these are the stars, and these are the moons,


right? And the human would see the stars, and the humans would see the moons. And if you do this by


the neural network, also, you'd get the labels A, A, B, and B. And now you go about this out of


distribution test set, and we'll go over it, why that is out of distribution in a second. Again,


you'll see that the human will classify this as the A's because it has the stars, and these as B's,


but the neural network will classify these as B's and these as A's. So I'm not saying this is what's


going to happen every time, but imagine that happens. And this is a conceivable, a conceivable


situation. And you can think of what happens here. So you see in the training set, all of the stars


were either on the bottom left, right? Or in the top right of the image, where if I, you know,


whereas the moons were either in the bottom right, or the top left, right? You see that,


so the neural network might have learned that this is moon, and this is moon, and this is star,


and this is star. Star. And then if it applies that rule to this new test set, right, then you


can see that it'll classify these as moons and these as stars, which is incorrect. So this might


happen, for example, if the person that wrote the generator for the, for the data set, for some


reason, it, it, it produced only data here that had this property of the bottom left, top right,


being a star and otherwise being a moon. So what generally happens if we do machine learning test


set is we collect a data set, a big data set, but we collect it in a single pass, right? So this is


our data set. And what we'll do then is we'll split it, right, into a fairly large train, and maybe a


bit of a smaller test set, right? But this, it's important that we first collect the data, and then


second, we randomly split it. Now, this out of distribution test set, what that might be is that


might be a second person, right, so this was done in the first step, but then later, right, a person


collects another bunch of data. So this is data two. And, and they think it's, it should be the


same as this data, but then you apply the, the, the classifier that you learned in train and test,


you apply that here, right? So what is different in this case, is the data collection process that


happens beforehand, right? So somewhere here is the real world, I'm going to draw the real world.


This is a globe. This is the real world. And you draw data sets from the real world. And you draw


this data set first, and then you split it in train and test, and then you draw this data set


second. So the second data set has a fundamentally is a different sample of data than this data,


whereas these train and test, you can think of them, they are closer together. Then these two


data sets are here. I think that's, that's all that's kind of intuitive. So what we usually do


is we train here. And then we evaluate on the test set, right? But the train and test that they've


they've just been they're just like randomly split versions of the same data set. And that means that


if there is some kind of bias in the training set, it's probably also in the test set, like we saw


here with the moons, right? So this training set is this, this test set is this and both have this,


this moon moon star star property, because that was introduced. So this pattern here by accident,


in this case, was introduced when the data was produced, right? Whereas the OOD test set now is


maybe a second person writing their own generator that doesn't have this property. And then that


will lead to this data. And of course, since we train on the this training, then evaluate on IID


data, this is now the IID assumption, and evaluate on the IID test data, we're going to do fairly


well with our, you know, crooked decision rule, because it has the same bias. But then if we once


we evaluate on the on the out of distribution data, then we we will fail, right? Because now this


doesn't have this this bias in it, right? This, this is not here. So shortcut learning refers to


the phenomenon that there might be features in the training set that the model starts to learn,


such such that it learns something else that we want it to learn, right, we want it to learn the


shape here, but it learns something else, it learns the position. And usually these things will


not be recognized by generalizing to this test set, right? Because the test set being an IID


split from the same training set will have the same biases. And therefore, they will only become


apparent once we do out of distribution, generalization, evaluation. So this is shortcut


learning. And this paper goes into the origins and kind of descriptions of this. And while I think


this is a good approach and paper, and it says many correct things, I think the framing is a bit


off at times, and we'll go through it. So first of all, they say they give some examples in


biological neural networks. So they have this one example, where they have a rat. And the rat


learned to navigate a complex maze, right? Based on color differences of the walls. And this was


surprising because rats don't really have color vision, or it was kind of known that rats don't


have super good color vision. So it was very surprising. And then they discovered that the


rats did actually not use the visual system at all. They simply discriminated the colors by the


odor of the color paint, right? So if you painted the wall red or blue that smelled differently,


and the rats could smell it, once they controlled for the smell, the remarkable color discrimination


ability disappeared. Right? So the second example they give here is, so Alice loves history. And


Alice had spent weeks immersing herself in the world of Hannibal and his exploits in the Roman


Empire. And now the exam questions are just like how many elephants did Hannibal employ in his army?


So the exam questions are multiple choice, not focused on understanding. And Bob had just learned


it by heart and is now doing much better than Alice who has actually understood the topic,


right? So they give this as examples of shortcut learning, where the model learns something that


we don't intend it to do. Right? All right. And I, I think this is the crucial point, right? The model


learns something that we don't intend it to do. Right? And so here, and this seems this, this,


this might be pretty clear to when you observe it. But what do we want? We want, we want shape.


And the model learns something else, right? Just something else. And the crucial part here, and I


think this paper isn't putting that much, as much emphasis as it deserves, is the two words we and


want. So my, my, basically, my answer to this is, first of all, the word want, we want shape. And my


answer, my comment to this is, you can't, you can't formulate that. You can't formulate it. This,


this is very crucial. And I think the paper almost ignores this point, you cannot formulate


what it means to classify things by shape. And this seems so oblivious to us, because we're so


used to it as humans, right? We're just like, oh, just use the shape, right? This is the shape,


right? But you cannot, you cannot program a computer to do this. That's why we use deep


learning in the first place, right? Because we have no freaking idea how to program an algorithm


that extracts the shape of something. It might be possible for like a star and the moon, but not for


a cat or a car or anything, right? So you cannot formulate your objective. That's the problem,


right? And it's easy to then say, oh, the model doesn't do what we want it to do. It's like,


you can't even formulate what you want it to do in a precise way. So basically, all all you're,


you're saying here, what you're saying here is, I'll train a shape classifier, right? Once you've


gone through this process of training and evaluating, you you say, ah, now I have a,


now I have a shape classifier. Right? So say you haven't, you hadn't done this OOD evaluation.


You've gone through this and you, you now, you now claim, you proclaim, I have trained a shape


classifier. No, no. You have trained something that given the entire process of how you create


your data, can classify these two images, right? So at here is your generator. This is your little


program that you wrote to produce these images and your generator assigns either the star,


right? At random, it produces these things, the star or the moon. It does these two things and


then it creates the image from it and that will give you your data set, right? What you have


trained is not a shape classifier. What you have trained is a classifier that can distinguish data


that comes from this data generation process, right? The entire notion of calling it a shape


classifier is because you as a human have, have thought of shape when you programmed this generator,


right? When you collected the data set, that's what you thought of. But this isn't the case. You


can't call it a shape classifier. Just because you like this is what your intent was. You have


a classifier that that classifies images from this particular data generation process. And you can't


actually formulate a shape classifier, right? Okay. The second word is we, we, sorry, we humans,


right? We want a shape classifier. Now, I've I've said this before, and this, this very much refers


back to the to, for example, the paper about the contrast sets in NLP and so on. Humans have


grounded knowledge, right? Humans, sorry, humans have grounding. This is very important here.


Grounding means that the humans live in a world of physics and culture, sorry, physics and culture,


and the need for food, biology. Humans live in this world. And this, this generated our brain,


right? So what that means is that humans live in a world of objects and of, of people, sorry,


of people and of being eaten, right? Being eaten, or needing to eat food, right? Humans grew up and


live in this world, your brain was literally structured according to these things. And thus,


we understand everything with an eye to this grounded knowledge of reality, where there is


such a thing as objects. Now, if you have ImageNet, and you train a classifier for objects, right?


This is what I find so crazy, right? And in the, you know, you collect this thing, and there's a


car and you say, that's a car, right? You know, this is a car because there is an object of a car.


And, but the neural network is not, does not have a bias for object, the neural network simply sees


these pixels. Same here, what you will do immediately here is you'll recognize the


object of the star, right? You will transform this into a 3d scene, right into a 3d cube, where you


are here watching in 3d space, and there is this star object somewhere here. Right, and then you


understand that the star could move around, then it would still be the same star. But that's because


you have the inherent bias of there being objects. And shape, for example, the word shape is nothing


more than a property of an object. And the neural networks simply do not have a inherent bias for


objects, right? Or people or intent, or what it means to eat, right? This, this becomes super,


super obvious if you ever try to solve, for example, a jigsaw puzzle, you know, like these,


these things here, I'm terrible at this. If you solve this on its head, right, say this has like


a face on it. And you try to solve it like this, and you try to solve it on its head, like try it,


you'll do it's the same task, you simply need to match the the border shapes, right? And you need


to make sure that the lines are continuous of the picture, it becomes so much harder just because


you have this brain. And so that is my my entire criticism. And it will, it will pull through this


entire paper. And we'll go through it for now relatively quickly, because we've already like


touched touched on it. Keep in mind, this is my commentary on it. This is not superior, superior


knowledge or something. That's just me. Alright, so what they do is they have this taxonomy of


decision rules that they they point out, what they're saying is, okay, you're you, these,


there's a set of all possible decision rules, right? And this is the this is the outer set here,


all possible decision rules that one could think of to discriminate data. And let's say we will


talk about images here, right to, to discriminate images, most of them will just be crap. And these


will be using these uninformative features, what they say, but then there are some decision rules


that perform well on training data, right? This is this big circle here, right? So that there are


some decision rules that perform well on the training set. And they call these overfitting


features. So these are all the features that perform well on the training set, only on the


training set, sorry, the overfitting features. But to me, it's a bit unclear. I think they only call


this band the overfitting features, but they call the entire circle, the all possible training


solutions. Any case, so there are decision rules that perform well on the training set, but some


of them are overfitting, as you know, that problem, right? Then the next circle inside of that are all


decision rules that perform well on the training set and the IID test set. And this would be our,


our location classifier from before would fall into this category, right? And now, there, these


are still a much larger set, as you see here, as this inside set of the intended solution performs


well on training set, IID and all relevant out of distribution test sets. And they draw this in here,


the out of distribution test sets are subsets of the IID test set, or the, sorry, the solutions that


work on the OOD test sets are subsets of the solutions that work well on the IID test sets.


And I don't have a problem with this characterization of decision rules, right? Here,


specifically, these are decision rules. What I have a problem of characterization with is the


fact that you cannot specify what the intended solution is, you cannot. And therefore, this


diagram, I think, is misleading, because you have, ultimately, you have no idea where this dot is,


right? You can't, you can't specify it beforehand. You can't even specify the rules, how you get


there, all you can do is give better data. And they kind of advocate for this here with these


OOD test sets. But again, I think when they say all relevant out of distribution test sets,


I'm a bit, I'm a bit wary, because they, they suggest this as one of the measures to assess


whether or not a model has learned these shortcut rules is to measure its performance on out of


distribution test sets. And this is very much like the contrast sets in, in, in the NLP. But I,


I think actually, this is a pretty, pretty, pretty, pretty bad solution. In most cases,


and let me explain why. So if we go back to here, right, what we saw is that these, these


discrepancy, it comes about, because here, from the real world, we produce the data in a very


specific form, right? And then this other out of distribution test set is produced in a slightly


different form, right? Now, what you can think of this is, if you look at your cost function that


you train, right, what usually says my cost function is some sort of a loss for my data


points and my labels, right? But this is often left out. I mean, you write it in your introductory


classes, what is important is that this is an expected loss that you're minimizing here,


over a data distribution, right over x and y, sampled from a particular data distribution. Now,


when you talk about this, this out of distribution classifiers, what you'll have is you'll have a


slightly different data distribution d prime, right? So, but if you simply have one out of


distribution, think of this as the contrast set, right? If you haven't seen the video about contrast


sets, it's basically an out of handcrafted out of distribution test set, right? My problem with this,


it's just one, it's one, it's a single one. And I think even if you try 10 of them, 10 of those


sets, you won't even get close to a true measure. Because, so the cool thing about an IID test set


is at least it is precisely the same distribution, right? So it kind of gives you an unbiased number


that for this particular data generation pipeline, you get this number. If you evaluate on an out of


distribution test set, you now have two effects. You first have this generalization effect. And you


have the effect of having produced this in a different fashion here. But you only have one of


them. What you would like to do is you would what you would like to assess is your loss of x and y in


expectation with x and y coming from data in expectation, let me a different color in expectation,


with your data distribution coming from all possible data distributions in the real world,


right? That's what you would like to, to say to do. If you only have a single contrast set,


it is akin you can think of what if, like how how well how well of a machine learning engineer would


I be if my test set here only had one sample? Right? So, so I give you a train and the test set,


and I'm saying your performance will be even make a kaggle challenge. And I say your performance will


be evaluated on this one single sample test set. Right? That's basically what you're doing. If you


have a single OOD test set is you're saying, I'm going to give you one out of distribution data set


that I have biased in one particular way, right? And we'll measure how well you capture our intent,


right? Our shape classifier intent will measure how well you capture that using this one single


out of distribution thing. I think what that will do is right, you say, I want to approximate this


by a sum of i equals one to one. That will just pump the variance beyond what beyond any reasonable


meaning that the upcoming number will will be able to give you. What you'd have to do is you'd


have to have this entire process and sample train and test sets according to this day, or at least


test sets according to this data distribution, this underlying data distribution, which you have


no clue what it is, because if you could specify this directly, you could get the solution for free.


Right? If you could specify the underlying mechanism, you could you would already know


the solution you would need machine learning. Um, so I think the model puts, like way too little


emphasis. Sorry, the paper puts a bit too little emphasis. Suffice to say they with their taxonomy,


they can say, if you use, for example, only the overfitting features, right, then you will do well


on the training set, but not on the iid and OOD test sets. If you use the intended features, again,


intended, no one knows what that is. No one can specify it, you'll do well on all the OOD test


sets. If you use the shortcut features, you will do well on the training and iid test set, but not


on the OOD test. This is valid, right? I'm not discrediting this paper here. And they do allude


to a lot of the things I'm saying, but not, not all. And I don't think they frame it correctly.


So they ask shortcuts, where do they come from? And they say a lot of the things that I've been


saying here. But for example, they ask, what makes a cow a cow? And they give this example here,


where they say familiar background can be as important for recognition to deep neural networks,


where the deep neural networks will misclassify this picture because they used to seeing a cow


in grass. Now consider this in our framework, right? If let's say this is an ImageNet classifier,


ImageNet is not an object classifier. It is not right. That's what we say. That's our intent. But


what it is, it is a classifier. If you go through the pipeline, what how do you generate the data?


ImageNet is a classifier of naturally taken images, right? With a certain camera cropped,


center cropped to a particular object labeled by human radars filtered in some capacity, right,


from Flickr. And for that particular data set, we train a classifier. It is not an object


classifier. It is a classifier for that. And it doesn't has no clue of objects. So in fact,


and also what you have to see is that the output isn't even if the output is shape,


it isn't shape, it is actually probability of shape. Right? Or probability of object or


probability of something. Right? And it is completely conceivable, right? That if it's


not grass in the background, it's probably not as much a cow. Now, I see the problem here. This


is clearly a cow. And this is actually a conceivable natural image. But imagine a


picture of the cow. Oops, what happened on the moon, right? This is the moon. And here's the


cow. Cow moo. This is terrible. Horns, tail. A cow on the moon. Like who can fault the neural


network it and I would say that's not a cow either. Because it in terms of the data generation


process, if you ask me, please classify this as a natural image that has been taken, blah, blah, blah,


blah, blah, right? I'm gonna say there's no way there's a cow on the moon. So I don't know what


this is. But it is very improbable that this is a cow, right? Because all the training examples


I've seen, cow on grass. So yeah, so I mean, they do, they do actually allude to this, right? They


call this data set biases and so on. But I'm pretty sure that the interpretation is just a


bit off, where they say, the point of this is like, ah, it's, you know, we want an object


classifier, but this we want. The second I find even more kind of strange is they say shortcuts


from discriminative learning. And they allude to this picture here. And they ask, what makes a cat


a cat? And they basically their argument is that the neural networks, they don't understand things,


they just discriminate, right? They have these 1000 classes, and the output layer, this is the


neural network. And they just need to discriminate. So they just need to learn what is different from


one class to the other class. And they will often rely on features such as texture, like here. So


they rely on detection, they classify this as an elephant, right? So they say, what makes a cat a


cat to standard DNNs, the example image on the left clearly shows an elephant, not a cat. And


again, I agree. If you tell me, this is data from naturally to taken images with standard cameras,


right? Then I will, I will have two possibility, I will say, is this a cat? There's no way that if


you take anywhere in the universe, a picture with a, like a phone camera of anything of a cat, it


will look like this? No way. I just not possible, right? However, is it possible that there is an


elephant that as a skin fold pattern, by random chance, elephant, big ears, raw trunk, as a skin


fold pattern? Looks like a cat, like looks like the shape of a cat? Yes, that's possible. So if you


ask me, according to the data generation process, this is way more likely to be an elephant than a


cat. Right? And the paper here makes it makes it seem like it is so obvious that this is a cat. But


what do these standard stupid DNNs think it's an elephant, not a cat. And the DNN Oh, it's just


looking at object text and other local structures and not that shape, right? What we like what we


wanted to do. And this, this is I find, is just stop calling things object classifiers, if they're


not object classifiers, that classifier between images of a set of a data generation process. If


you want them to be object classifiers, make up a data set that actually has different objects, but


you can't specify that. So yeah, and then they go into some sort of adversarial examples. And I find


this to be, I also find this to be a bit maybe not belonging here, like, where they say, Oh, look,


here, the DNNs predict guitar with high certainty. Again, it's just a discriminator. But this this


pattern, why not a guitar? If you had to, you know, if you had to get one of the 1000 classes


out, why could this not be most likely a guitar? But I have a further problem with this is I see,


I kind of see this in. So what what do you have is I ID data, let's go with their taxonomy and


say I ID data has from from the same generation process. And then there is OOD data. Now, I think


there are a number of effects here that they try to lump together with this thing, where they just


say, Oh, OOD date, whenever my model doesn't work on OOD date, it has learned a shortcut, but it's


very, very weird. So first of all, there, I would say the OOD data, you can probably divide into


what I call unnatural OOD data, let's say our task here is to build an object, an object detector,


whatever that means for natural images. So then there's unnatural OOD data, which, which in here,


you'll find something like adversarial examples, right? Adversarial examples are constructed,


at least if you go by the interpretation of modri. And the other serial examples are features,


not bugs, then you'll go into the direction of adversarial examples actually constructed by


combining features that don't naturally go together. So you'll you'll get the low frequency features of


a cat and add the high frequency, for example, features of a dog. So much with this with this


lambda factor here so high, that it to a DNN, it looks like a dog because it has many of the


features, but to a human that kind of ignores the high frequency features, it'll look like a cat.


Right? But these are unnatural, because the features in actual nature in the real world,


they never occur in this combination. So it seems like this is a very, very, very different phenomenon


from what I would call natural OOD. OOD data, where simply the the features that you're seeing


have never occurred in the training data set. But there is there is if you go from the real world,


and you construct in different ways data set, there is some data set where where the where


the data actually occurs in the way that you have here. So natural OOD data is what most of the


examples for now were were about like a cow on the beach. It's just because you've never you've


never seen that because your data generation here always good cow plus grass. Right? So I think these


are very different. And then the last thing they also lump in here is fairness, like the the


fairness and bias literature, where, for example, you have a resume classifier, and the resume


classifier ends up being biased by gender or something like this. And again, so I, I kind


of struggle with this, although they say not all the fairness problems come from here. But I would


also like to stress that some of the fairness problem goes exactly here. It occurs because


your data generation process is different from what you want. For example, if you do this, this


hiring classifier, you have to understand what that is, what your training is a system that will


tell you how would my human data set creators have decided on this particular application. Now,


of course, there is this problem of bias amplification and so on. But it is not it is


not an infallible system. It simply tells you how the humans would have predicted if you collect the


data set in a biased way. Of course, the the machine will inherit that. But on the other hand,


the fairness, why I don't think this really belongs in here, because in fairness, you have a, you


actually have kind of an alternate world, draw this in green, prime world prime, right? Where in


this OOD and IID setting, you always assume that the world is is the world and you want to kind of


really learn a system that understands the world, where in fairness, you this here, this is your


super world. So actually, for the fairness literature, it doesn't really matter if in the


real world, two, let's say two groups of people are equal in some respect or not equal in the true


world, right? What they care about is that they are treated equally by the system, right? So they


will impose, they will impose some restrictions or some, some some condition on their model. And


they don't, they don't naturally, like, this sounds bad. But it is the mathematical formulation is


such that you start with the super knowledge of two things must be equal. And then you, this is


how you imagine your world, you think I know the world. And then I try to learn the model, such


that that happens, right? Whereas over here, you do something different. Now, some of it is in, as I


said, is in the same category. But it is, I think, a different, different take. And a different


literature. So I would, I would focus on, let's say this part, right here. Sorry, on this part,


and not on the adversarial examples. And also not in the fairness literature too much. Alright,


so yeah, you can see here, like, like, no wonder this, this, and this screws up and this screws up


an image net classifier. Yeah. And even even this, like, how do we know that that is naturally


natural, though, I can see that that is, that looks pretty natural, but still, it's probably,


like really specifically constructed such that the probability that someone would take this


picture with a camera in the real world is zero. Cool. So they give some examples, where they say,


okay, shortcut learning exists in computer vision, for example, adversarial examples,


you see shifting the image by a few pixels, though, you have to say shifting the image very


precisely by a few pixels, such that the probability of this occurring in the data


generation pipeline is zero, and so on. Then they call it domain transfer. That that, of course,


is I think that's the, that's a good example. They say natural language processing, where BERT has


been found to rely on superficial keywords. For instance, it learned within a data set of natural


language arguments, detecting the presence of not was sufficient to perform above chance in finding


the correct line of argumentation. Again, this is like, all we can do is construct data sets,


we cannot, if we could tell the model what to look at, we would, we would, we would just program the


solution. So the solution is there's only one solution program, better data sets, get better


data sets, or, I mean, okay, the second solution is get better inductive biases. But if we knew


the correct inductive biases, we wouldn't have the problem. Yeah, I like that there is a, in NLP,


this is very, this is very, very prevalent, even more than in vision, right? This, this fact of,


hey, these spurious correlations in NLP, the models usually just learn kind of correlation


between some words, and then they, they don't learn to understand the sentences at all, right?


But this, this is because in NLP, we have even more problems with constructing data sets that


force the model to learn to understand the, the text. Again, I could not tell you what understanding


the text means. They go in, by the way, humans do that too. Humans, most, in most of NLP that


happens in humans, humans do this, right, in many, many, many forms. This is simply because the cost


function is not aligned with what you would want. What is the specific, oh, well, a specific example


is that news stories nowadays, right, you have a news, you say news, what do people expect? What


is the intent of news? The intent of news is to inform you, maybe, but the cost, right, the cost


function is clicks. So what do you do? You, news story, and very on the top in the title, you say


orange man bad. And then people, you highlight this, right? So a news story, I don't know, Brad Pitt


had a new baby, you just append, but orange man bad, people click on it much more, your cost goes


up, and sorry, your clicks go up, your cost function goes up. And so I think this happens


everywhere, right? You can't even do this with humans, right? How do you expect neural networks to


to do that? All right. Agent based reinforcement learning. I find this pretty funny. Where is it?


Where it learned how to play Tetris? Yeah, instead of learning how to play Tetris, an algorithm


simply learned to pause the game to fix it. Come on, is genius, right? Like, it is objectively


genius. And then, of course, fairness and algorithmic decision making, right? So they say,


understanding these shortcuts, and they, they touch on a lot of the things that I've touched on,


including these, what I find, what I find well is, for example, this Morgan's cannon for machine


learning, where you say, probably a machine learning system will learn the easiest feature it


can. And that's oftentimes not what you want, right? So this, this even now amplifies things.


They also touch on this thing of anthropomorphism, where you view everything through a human lens,


and that is not correct. If you look at these neural networks, they're not humans, and we


should never attribute humaneness to their solutions, never attribute to high level abilities


that which can be adequately explained by shortcut learning. Yes, I agree with this, like, I


agree with this paper in in all the things it says, right? Except this detecting shortcuts, making


OD generalization test a standard practice for the reasons I specified before, I think that is


counterproductive. And yeah, I think I've already said enough, right designing good OD tests, this,


you can only design good OD tests, if you know the real underlying data distribution, which you


don't. And let's go through Yeah, again, the principle of least effort, they say, why are they


learned? Because it's just easier, right? To, it's just easier to write a new story with just the


words you know, people will click on, right? Like, or these top 10 things of blah, blah, blah, number


seven will surprise you. You don't actually have to come up with 10 relevant things that the entire


title is enough to get you the clicks. So it's the least effort to solve the cost function might not


align with what you want. And also the inductive biases, as I said, we are humans, we have some


inductive biases, the neural networks don't have them. And we need to take this into account. But


the solution is to make training data sets that take this into account. Alright, they say, beyond


shortcut learning, this is kind of an outlook, and then a conclusion where they remind, but we're


already at some 45 minutes of video. And if you're still here, like respect, or maybe you just have


this in the background and have some company during this time, I will finish with saying thank you for


watching and leave your comments since this is mostly opinion, I would be interested in hearing


MEMES IS ALL YOU NEED - Deep Learning Meme Review - Episode 2 (Part 1 of 2)

Yanni just kidnapped me and now I'm and he told me okay Antonio just pretend everything is fine


Just tell about the papers tell about the memes


What's going on Yannick? We're gonna look at pictures and go home


All right, we're back


Antonio's back. Welcome back to meme review


Antonio never left


Oh, I'm going the channel's going fine. It's like 60 some thousand subscribers


60 million subscribers


This is not financial advice


He uses machine learning machine learns me Oh


It's still a bit like magic machine learning honestly like you understand everything it's still a bit like magic


I don't


I don't I don't even watch Yannick. I mean what I don't even watch my own videos. So yeah


Mom


Can we have to fight or we have pie to chat at home? Hi torch at home


I could learn I was always the best after math level course and you know every time every time we do this


Actually, there's a there's a math lab email coming up now just for me and the email just just says just for me


There's a new math lab


2021 a three release that's gonna be hard for them for all the math lab users to make individual releases


There must be at least like seven math lab users in the world Jim just unsubscribed yesterday


Major right major revenue drop. Yeah, they have to fire a half the team under people


Oh, so you're a human. Yes


Every picture


Picture I was like, I think that's genius I feel enslaved


Yeah, it's genius. It's so genius to do that. The first time I saw that I was like


I


Don't have glasses literally anything if


Is this interpretable AI? Yeah, what is this thing fuzzy logic?


What is that? I think that's right if you if you write your code on wool if you sew it on the wall


Speaking of wool. Oh, yeah, of course. Oh, yeah


This is it's Christmas. It is Christmas at this Christmas. We're gonna do a copy the additional later when are there cold with machine learning?


That was the effect of COVID or machine learning


We have conferences in Gathertown. Yeah


Also the also the virtual pretzels that made me laugh in New York. What's a virtual?


there was like an event okay at


For we're gonna have virtual drinks and pretzels


So in in Gathertown, so there's a function to follow someone if you click on the name of someone you can follow them


So I stalked a bunch of people


If someone walks by you just follow them and it's super creepy because it's like walking and you'll just be always walking


Have to say I have to say I quite enjoy Gathertown. Yeah, I liked it


I stopped a bunch of people. It was like I was at my poster. I wanted to talk to


James Martens now you're watching James


And every time he was like, oh


I


What I have to go. Sorry. Sorry. I have to I have to go a little pee. I have to go pee. Yeah, sure


It would be funny if there's toilets in Gathertown, you know


Are there so I don't know there are you can also you can only you can only like, you know


The things you pee like the things how's it called a urinal the urinal?


Yeah, and then you can only talk to the two on the left and right


It could be the connection by the way, uh, thanks to all the discord members who are largely


Responsible for these memes. Thank you very much of criminals


double-blind review


gpt3 paper


It's open AI


No, oh my god, that's how you do papers. Yeah. Well gpt3 is now the best paper at nerfs


Like yeah, it was a new ribs. Mm-hmm


I remember still last last last year in Europe's but you have this banjo person, you know, you know that guy


The boxing the boxing


Does boxing professional boxing nice and even though he does boxing people just you know, yeah, they're very close to him


Yeah, just I mean desire to die, you know the society desire to die


They asked him question and he was like, I don't care. I just want to do a fight


Anyone you had AI any new AI technology can it beat the stock market?


I think I think yeah, I think I think this one this one this new one this one you are able to beat the stock market


Transformers will beat the stock market. You know that gpt3 you just ask it. What's the price tomorrow?


It will tell you really it won't be correct, but it will tell you


We do have a channel on our discord about stock market prediction. It's easily the most exciting channel. I


Will check it out


Hmm. No, you can't just not say prayer work. You have to give proper recognition


What about artificial curiosity? What about predictive university?


Ah ha


I


Next layer wx plus b smaller than zero


Really stop, please please please enough good guy enough of you good guy really


I am state of the art. Do you have the slightest idea how little that narrows it down?


Okay, so I watch all the videos and I know them all by heart all of them by heart and also I know them in reverse and


Basically, I was wondering how much does improvement over state of the art mean like really it means


one paper


but like percent would it's it's if you have if you write the magic letters s o t a


With the first and the last capitalized. Uh-huh


The reviewers magically


Will lift from their chairs and up to the sky where they'll be treated to a massage


Come back down. Their hand will be guided to the accept button


Researchers often obtaining sota performance by replacing rns with transformers


Future is now old man. Yeah future is now


Yeah, the funny part is this is already old. It's already old. Yes


Now people are replacing convnets with transformers and getting state of the art


And never quoted a transformer. Yes


Never did you? Um


From scratch no see no also I meant from scratch


What do you think about multi-head attention? Ah, that's the best


The best kind of attention the best kind of attention between any kind of attention


And also like the way you're doing it


Best kind of attention between any kind of attention. Yeah, and uh also like sometimes I I


I think it's better than I don't know eating


Sleeping. What's your favorite transformer multi-head attention?


I would also count bumblebee


What


Bumblebee it's from the movie


It's a car that can also be a robot transformers


I


Optimus prime


Sheila beck megan fox megan fox


Response letter


I have been


This guy and I have been this guy. Yeah, but sometimes i'm very like on some papers


I must say


But i'm very very very


Um, how's it called bloody? Yeah, don't but yeah. Yeah, I'll do anything


There's a little bit of a joy, right? Yeah, and just being once once the last review I did it was like, okay


Ah, this was already done in and I cited I I took the time to put the citation of like 10 papers that do this


one two


All of them just to destroy them. Yeah, so yeah


But yeah, it was not a good paper that is from xkcd


And when you train predictive models on input from your users, it can leak information in unexpected


Ways the person types in long live the revolution our next meeting will be at and the model completes it


To the docks at midnight on june 28th


See


See the interesting thing is that this the meme is about or that the comic is about


I'd say six months old at least


But just this week a paper came out doing exactly this


Yeah, crazy. Yes. Yeah, this is like perfect prediction. Where should I find a paper? Is there a video link to that?


Uh, it's going to be yeah, there's going to be a video on that paper. Why are you late? I um, had to pee


On gabbertown


Oh, okay. So this is this is cat or croissant and I have actually made for you a


Presentation where i'm going to test you first one


Cat or croissant that was a cat. It was definitely a cat indeed a cat. Okay next one


That was a croissant damn you're good. Okay


That was a croissant it was a cat


Okay, that was a croissant that was a croissant, okay next one


Was either a very good croissant or a cat a very good croissant though


It was a cat normal people can't go to the gym to work out because of lockdown me and ml


Phd students new rips reviewers


A well-written research paper


Our model is simple and easy to implement


When you hear someone still referring to new rips as nips now that's a name I haven't heard in a long time


The the question is why is that do you say I was at nips 2016 or do you need some sounds weird now?


Now it sounds I know it sounds


Yeah, yeah, I've had the same experience. Why yeah, we did it we time traveled but


To what year?


Let's ask that guy over there. Hey, what's the coolest deep learning framework?


Tensorflow we're in 2016


Paddle paddle 2021. It's going to happen. I believe it


paddle paddle 2021


Best framework when you're a pytorch user and it's been five minutes since you haven't told anybody


How it's better than tensorflow


I don't even know what you use


I mean, I I have to say I'll I'll just not ask just not to get angry at you


Otherwise and you'll stick with matlab


Well, this one can also be applied to other things. Yes


We'll make the title of this video


Meme review is all you need


There's a paper on your desk saying like logarithmic bounds and where to find them. Yeah. Yeah


No, it's like, ah, yeah, yeah


Yeah, that is no it's like ah, yeah is like a fantastic generalization measures and where to find them


You should be like electro shocked when you submit this to archives like ah


I think I think they got very accepted clickbait. Oh, it's also by benjo the the brother. Okay


pytorch google


tensorflow enable


eager execution


This was a disaster a disaster. I didn't know tensorflow eager mode


So pytorch was is always like dynamically constructing your graph you explained it to me


Yeah, yannick, you don't remember but you explained it to me probably I actually gave summer schools on this topic


Summer schools. Yeah, the best kind of summer school


If you actually look at the tensorflow source code it is littered with if statements


if eager


Then this part piece of code if not eager then this piece of it's like two frameworks just bumped


Together into one because they wanted to copy pytorch so much


And uh, so in a weird statement


At that time ai was actually full of if statements now I understand the mean better


It gives it a new meaning


Theoretically well understood the deep learning practices


All the pieces are the black what the fuck?


No, yeah, the deep learning is is not a thing. This is me. This is totally it's gonna be it's gonna be fuzzy logic. I told you


[ML Coding Tips] Separate Computation & Plotting using locals

Hi there, so today I just wanted to bring you a quick coding tip that I often encounter in my


daily machine learning research or life that might not be super common in let's say traditional


software engineering or elsewhere. So often I have a bunch of, let's say I have a bunch of models,


right, and they use these IPython notebooks or collabs to analyze my data, plot things and so on.


So I have a bunch of models, let's say they're called M1 and M2, and I'll usually run my big


jobs on a cluster, so let's say I have run some jobs, one for each model and have some logs that


I want to analyze. So I'll go through my models and here I, you know, load a bunch of logs and


I'll also compute some stuff, some statistics and some just things, right, that I want to have


computed and maybe these things are called A and let's this and B, right. So now I've computed these


things now, I want to analyze them and let's shortcut and say printing is plotting. So think


of these, this might be numbers, right, and now I want to plot them here out, let's just print them,


which I do this. Now every time I want to, you know, change something here in my printing, maybe


I want the separator to be that, I'll have to load all the logs and compute all the stuff, right,


each time I run this cell, which is not super cool, right. So I usually would like to factor


out the plotting and stuff like this from the computation. So I could extract one of them into


like a function, but then the point of these notebooks is that I can run each of the cells


and they'll run right there, right. So functions aren't really cool in these notebooks. So what


I'll usually end up doing is you'll have some second loop in here, right, and let's see, you'll


have some data dict up here and you here at the end you'll say something like data for this model


is A and B or something like this, right. And then down here the first thing I do is I'll get my data


and then I'll unpack again. So D A D B, either I'll unpack or I'll just address them in dictionary


notation like this and then I can do my plotting, right. Some people use tuples here, right, they


could just go A and B, but then you'll have to do this unpacking. The problem is now if I want to


add something here, right, I compute something new, I now need to add something here, right,


I need to remember to store it in the data array and then I need to here remember to unpack it in


the same order, right, and then I need to produce to put it in in the plotting, right. So this is


very cumbersome, this line here and this line here, they're very, because you kind of duplicate


your own variable names all over the place just because you want to compute them here and use them


here. Now a software engineer would usually tell you let's do something like a data class or in


its most simplest form is say of a class and you know there are multiple ways of achieving this,


but let's just do A and B here. This is probably the most verbose, you can also do name tuples,


adder classes, data classes and so on, but ultimately you produce a class like this and


then here you say this is a data class A and B and then here down here you can at least address


them like this, right, and you don't have to do the dictionary notation or remember the order.


But now again if you want to add the C, now you know not only do you have to add it here,


but you have to add it up here and you have to add it here and beware if there's a doc string


and then you can use it here, right, this is just too cumbersome. So here is a trick and please only


use these in like notebooks like this, this will lead to so much memory problems and everything and


if you work with a software engineer you might have to get them chocolate for doing this, but,


but, all right, so what you can do is you can save your local variables in this dictionary,


right, so this is a built-in that saves the local variables, that's already, that gives you a dict of


the local variables, the local variables here are A, B, C, M and all a bunch of other things,


right, it's not clear in these IPython notebooks, they have a bunch of stuff around them such that


the meaning is slightly different depending where locals is, but in essence you'll get the A, B and


C what you want. Now the locals dict refers, in order for this to go through, the locals dict


refers of course to the same objects not newly constructed, so we're safe here to make a copy


of that, right, like this and then down here we simply retrieve these local variables and update


the current local variables using the local variables we stored and voila we can use A,


B and C without ever having to find them, right, if this doesn't work that means that the locals


here are, is a copy basically and this is a Python optimization and I read, I don't have to use it


because in these IPython notebooks it appears to work, but you might want to have an empty exec


statement here such that the Python interpreter can never be sure which variables are created in


here and therefore can't optimize away, so that is a horrible, horrible trick, again don't build


anything serious upon this, but it is very duper super easy, you can just add any variable here


and then use it down here, so easy, right, and so wrong, alright this was it, I hope you enjoyed


this, I want to bring these kind of tips every now and then as an intermix into the research


mixup: Beyond Empirical Risk Minimization (Paper Explained)

Hi there, today we'll look at Mix-up beyond empirical risk minimization by Hongyi Cheng,


Mustafa Sis, Jan Endauphin and David Lopez-Paz.


So this paper is actually pretty simple, but it introduces a technique that apparently


helps with training classifiers and I haven't seen it used in practice, so there must be


at least something to it.


It is ultimately very simple.


So usually you input a data point x into your neural network in deep learning.


So f of x, that's your neural network, your neural network has parameters theta, you get


some output y hat, and along with the x, you also have a y, a true label, and then you


have a loss function that compares what you output with your true label.


And then you just try to make that loss smaller, you want to adjust your parameters.


So next time you see data point x, its output will be a little closer to the true label


y.


And we call this empirical risk, empirical risk minimization, because you don't actually,


what you think is that your x comes from some distribution, from some data distribution


D, like the space of all natural images or the space of all of language.


But what you actually have is you have a data set of a finite amount of data that you can


put, that you can sample x and y from.


And so instead of your minimizing your true risk, you minimize your empirical risk, the


empirical misc-minimization right here.


Now what's the problem with that?


The problem is that you can get overly confident about your data points and nothing else.


And that will hurt your generalization.


So if you have a data point, let's say right here, and another one right here, your network


is basically, so this is class one, this is class two, your network is going to maybe


make decision boundaries like this, and like this, where it says, okay, here's class one


and here's class two.


But it could, you know, it's very conceivable that here it says, oh, here is class four,


and over here is class seven.


And right here through is class nine.


And by the way, here, class four again.


So the empirical risk minimization leaves everything in between the data points open.


Now what this paper proposes is that we should not only train our classifier on these data


points, but on all the data points, sort of in between the two.


And this is the mix up data points.


So this data point here might be constructed if this is a and this is b from 0.1 times


b, right, and plus 0.9 times a, because it's mostly a, and it's a little bit b.


And now you think, what are the labels here if a belongs to class one and b belongs to


class two, then of course, the label of this data point is 0.1 times the class of b, which


is two plus 0.9 times the class of a, which is one.


Ultimately, because what you do is you input a class like class number two, if you want


to input this into a machine learning model, you just you don't say it's class number two,


what you input is a distribution that is basically has zeros everywhere.


So these small things, they're 0, 0, 0, 1, 0.


And this here is at class number two.


So this would be class number one, class number two, class number three, right, you input


a distribution like this, if you want to express class number two.


Now in our sample right here, what we would input as a label is simply a mix between class


one, so 0.9, so 0.9 of class one, 0.1 of class two, and then zero everywhere else.


So this would be our label for the data point that we construct right here, this would be


our sorry, the top one would be our data point.


Formally, you take two data points and you mix them using this lambda mixing factor,


that'll give you a new data point that's in between the other data points.


And you take the two corresponding labels and you mix them accordingly as well.


And that will give you the label for that data point.


And now your model will learn to basically smoothly interpolate.


So you will teach your model the thing on the left here is class number one, right,


that's class number one.


The thing on the right is class number two.


This here is half of class one and a half of class two.


So the model basically learns a smooth interpolation where the situation that's here on top is


probably not going to happen anymore.


But what it would do is it would sort of create these ISO lines around class two, and then


around class one where it's sort of smoothly getting less and less sure about the class


of the data points.


But on the way, it is always either class one or class two.


And they say that can help the generalization performance and it's visible why right?


It's just the only thing that's not, it's not clear from the beginning is that this


kind of interpolation actually makes sense because if this means we sort of linearly


interpolate between two images.


So if we have two images, we just take half of one and half of the other and that will


be not a natural image, it will be kind of a blurry thing.


Otherwise, you know, all our problems would be solved and we could just linearly classify


things.


But in any case, in practice, it actually seems to help probably because interpolations


of two images, linear interpolations are still much more like something like a natural image


than any random noise you could come up with.


So they say this in code right here, code is pretty simple, simply want to mix the two


things and the mixing factor, this lambda here comes from a beta distribution.


And they use a beta I believe of 0.4 or something.


Just want to quickly show you this is the red line here.