Welcome everybody; you're watching mr fugu data science. Today, we're doing the
fourth installment of our data science interview questions.
As always i'd like to say thank you to the recent subscribers and viewers, i
greatly appreciate it. So the first thing you're asked are what
are eigenvalues and eigenvectors? The eigenvalue is a
scaling factor denoted by a lambda. This is something that comes up a lot for
correlation matrices or covariance matrices. i'll let you
see for instance in a singular value decomposition example.
Now, the eigenvector will describe a direction.
And the amount that you are stretched in that direction will be your
eigenvalue. Now the next thing ,that you may be asked
this game came up for me and kind of threw me off.
Because, I understood it was a transformation. But, i wasn't sure what
kind. So box cox transformation: first thing
you got to realize is that when you're dealing with the transformation of your
data what's really going on? You're trying to
normalize your data. You're trying to make that bell curve
for example. And common things that you can do for transformations or like a log,
transform or a square root. Now, the box cox, backup if
we're trying to do this what are we trying to achieve? We're trying fix
variance. Now the box cox isn't always going to work
but it may help and it's worthwhile to try. We're trying to figure out
a parameter for our lambda here, all right. If this parameter ends up
going to zero. You end up just with a normal natural
log. And we're trying to figure out a parameter
that will deal with our non-linearity for this context. And the lambda will be
estimated from our data, okay. Let's kind of see what's going
on. I made up some data here in this array.
And basically i wanted to create something that was kind of skewed to
illustrate our purpose here. So we start with our initial data: i'm
using a density plot and i did this because i wanted to have
you know basically show a proportion of our data that's held
within some continuous interval. And i didn't want to use a
histogram because our data will be affected by the
number of bins. So we see that this is skewed to the
right it's positive it's kind of goofy, doesn't look too bad
and we want to try to normalize this some.
And see if we can get there with the box cox
transformation. So using python we throw in our skewed data
and we see that we get more normalized it's still a little skewed
and looks a little off. We can normalize this and set it to zero
if we wanted. But, in this case we could see that we got a little better than
what we were at. If you see the two. Now something that
comes up a lot when you see job applications especially in the
business sector. You see A|B testing, A|B testing all over
indeed.com A|B testing. You say okay, cool. What's
going on with this A|B testing? If you haven't used it before, or
you need to fake funk for your job application.
Just realize that it's a hypothesis test. We're using two
variants to see which one is more effective, okay.
So you have some single variable and you're giving two examples of it.
There's a lot of use cases for this in marketing, advertising,
for example or like if you're giving coupons.
Assume that we're sending out some kind of coupon; and we're saying that we
have a situation where one of the coupon says it expires in like three days
and the other coupon says it expires soon. And you have a group of people
and you're determining within this group of people
what type of engagement are we getting from this coupon distribution?
Is it that people more prone to act when they say you have three days versus
you know act soon? Let's say we look at our google analytics and we
are looking at gender and at most we can have a 50/50 split. But, for instance for
me i'm noticing when i have a 15.4 female to male
ratio, and i like to figure out well how could i look at my audience
and market it towards female viewers? And you could look into that. And then
you could do further analysis instead of looking
at one variable you could depict how this affects
gender and age and do some kind of marketing towards that.
We can figure out hey, i have this thumbnail that's working for this
particular video let me make one or two additional thumbnails
and see how this affects the traffic towards this video. To see if i get it
increased click-through rate, all right. That's a very good example of
something that we could do towards youtube.
Now, facebook has a whole thing you could look at for the business section
for all of these A|B testing use cases. We have a kernel trick or
method: this comes up quite a lot. In interview
questions as well as the real world. Consider if we were looking at
transforming non-linear data using a linear classifier. Where we're
trying to use a modified dot product to take in our vectors
as input from the original space and return
our values in the new feature space.
And we have to consider something: if we're looking at some data that's in a
high dimensional space we have issues with being
computationally heavy or intensive, okay. And you can use this
kernel to basically change the dimension of
your data you may be increasing the dimension of
your data and you think to yourself initially: well, this is this is getting
from bad to worse. You know because, now i'm trying to
interpret my data by increasing the number of dimensions. But,
now how is this kernel trick actually making this effective and
decreasing the complexity of our data? Well you have to think about
a few things. We have this notation for our kernel
where we're changing it into this formatting. Where we're taking our dot
products, all right. And we can work with this in
any R dimension space. And we're trying to find basically
some kind of patterns within our data. That's what is great about these kernels.
Now why would we really use this when it's expensive to change our data
from some given high dimension to some higher dimension,
okay. Well you don't really need to calculate all of the dot products that
are going on within your data. For instance, when you're dealing with
the kernel you have to consider a few things: to avoid overfitting. All right, we
need to consider the kernel function itself what we're
going to use with its parameters and the regularization that we will use
for that mapping. Now if we're interested in working let's
just use this simple example of three dimensions:
where we have our x and our y that we're trying to map.
We end up moving into nine dimensional space,
okay. So let's get a little closer into this
so we can see. Because, you have to go from
x1 squared, then you're going by x1 times x2,
x1 to x3, and so forth. And you're doing this for x and y
and you say oh my gosh this is getting ridiculous. Because, now i'm going from a
vector into something let's a scalar. But, now you have an
n square time complexity, and you say well how is this kernel going to get me
to where i want to go? Well you could still end up with the same result
in the end. And here's why we don't need to do
a computation for every single dot product.
For instance, if we're using the kernel trick on our example currently
with our three dimensions. You could do your x1 times your x2,
plus your x 2 times your y2 ,plus your x3 y3
and square all of that. And you end up getting the same result. But instead
you're dealing with linear time complexity,
Which is great. The next thing that we need to look at is called
ensemble learning: and there's a lot going on with ensemble learning. The
simple explanation for this would be to say
you're using multiple models and you're combining them to form a
result. You're trying to basically reduce the bias
and the variance in order to improve your accuracy
of the predicted values. That's the short end of the stick that you can give
if you're asked this question. But, this assume that you're asked some follow-up
questions. You know and you have to be a little
prepared. Such as why would i even consider this anyway,
right? Well if i'm given a model and i train it
and i end up with some lower than expected accuracy and some high variance
then you have to say well huh how could i fix this?
This is one situation like this would occur, or
you would benefit from using it right. You know you don't want to train a model
and just have all your eggs in one basket, right? Where you're just training
on one specific model and hoping and praying that this will be your
your godsend and you end up with some fantastic result. That's not exactly a
realistic scenario. So think of actually training on
multiple models for your training data and then
averaging them together to get a general finalized model. Think of it like that.
And don't be fooled into thinking that your decision tree is like
the only type of on some ensemble model, okay. We can think of
having three types here, right. We could have bagging which is a
bootstrap aggregation, all right. Which is actually pretty good for performance
and it's using different training data subsets
that are randomly drawn with replacement from your entire data set.
Now, each subset is used to train a a different classifier of the same type.
Now the individual classifiers are combined by taking a majority vote
of their decisions and then the best result will be taken as what you know
you could just call your ensemble decision.
But then you have to consider something: since, we're using replacement do we
have overlapping of our data? Well yes you do. You have quite a bit of
overlapping. So in order to deal with this:
there's extra steps that are used like using the subset for each training
classifier or using a weak classifier. Which could
get later converted into a strong classifier
for your data. Now boosting on the other hand
is interesting because, you're using like a weighted sampling
you know to see how it changes over time, all right.
But, we need to be aware that resampling is different here.
And it's essentially using iteration to create three-week classifiers.
Where the first classifier will be trained on a random subset,
the second classifier is taking the output of the
first and only using the most informative one,
all right. But, it is only using half of the data
from the first classifier for that second
and the other half is basically considered
misclassified. And then what you do for the third classifier is you're taking
your discrepancies of the first and the second or
disagreements and you're taking a majority of that and taking that
in for your third. Kind of confusing but,
the stacking i'll just mention that briefly here.
So basically think of using stacking as like it's using multiple model types.
Where you can use several base learners where you're taking your original data.
You can at this point you're taking different techniques such as boosting or
bagging; and then from there you're creating a
new data set. That you learn from your first step, where you're taking the
classifiers that'll be used for your features and you can use the
probability of these values instead of the labels.
And also use varying activation functions
that you can create to see how this will affect everything,
alright. So you have some flexibility and then whatever you learn from the second
step now at the third step you take whatever
you learn from the prior step in number two
and create a new classifier. And you're just basically doing like a
plug-and-play. I know this is oversimplified and
generalized but, in a pinch this is what you can give for
a brief explanation. Now, what about weights for your
initialization of our neural network. Well,
you only have two options: do you set it to zero or do you randomly assign it?
If you set it to zero you're basically no better off
than if you use the linear model because, at each
layer that you're going through. You're having no changes.
So you're basically not learning anything that's useful. If you're
randomly assigning your weights, you know then you're better than zero.
But, now do you have a case of do i choose: small weights or
do i choose really big weights? And there's a problem here: let's call it
vanishing gradient. Okay, so for instance if i was using a
sigmoid function and i map everything pretty big for my weights
it'll go close to one. But, anything that's relatively small for
my weight to go towards zero. And that's where you end up
with this issue with the slope and your learning rate over time, okay.
Some extra bit of information: if you're asked to give like hey, what
would be better than using a sigmoid function?
Or what other activation functions can i use?
Suggest using the Relu. You know because it's pretty new and it's really
informative and great to use because,
it's avoiding issues that you may have with the
gradient or with the time it takes to solve your
problems while you're running a neural network or
doing deep learning. Okay ,so the last thing i would like to
say is: what's the difference between
extrapolation and interpolation? Well extrapolation think of like when
you're doing some kind of time series modeling such as stock
market pricing. And you say i have you know all this
existing data. What's the future price going to look like
for this? That would be using extrapolation where you
extend on your current data to do an approximation for the future.
Interpolation is a little different where you're taking two values from a
list of values and you're trying to make an estimation.
I would like to say please like share and subscribe and if you
subscribe turn on that notification bell. I hope this brought utility to someone.
Thank you for watching and i'll see you in the next video.
Bye