What's gone on everyone.
Future Dan here once again and I realized going through the introduction to psychic Loan Section that
there's a lot of warnings that come up.
More specifically let me show you what actually goes on so if we go here we'll instantiate a random
forest classifier CSF.
Now if you don't understand what's going on just yet don't worry this is all covered in the psychic
loan section.
But I thought I'd just show you what actually happens and different ways that we can fix it.
So when these things come up in your own work you might have a way of approaching them.
So if I just shift on enter on this cell shift and enter in this cell and then shift and enter on this
cell you see I get this warning pop up.
So the reason why this warning pops up is because it's telling me the default value of an estimate is
will change from ten inversion zero point to 0 to 100 and zero point to two and now an estimate is is
a parameter in random forest classifier.
So if we go here this is one way to fix it if I set this to 100 because the default is 10.
Right.
That's the default.
I set this to 100.
This little warning this red warning will go away.
There we go.
That goes away.
But if I set that back to what it was the default so passing nothing and then I run it again.
The warnings are going to come back.
Now there's one way to fix this pretty quickly.
It's to do what the warning says we just saying that the other way is if we come here.
Now this goes for all warning so a.k.a. anything that you see in red in Jupiter notebook output.
This is one way to solve all of them will not solve all of them but you will see it happen.
So import warnings so we'll import the python warnings module and then we go warnings dot filter warnings
what we need to pass it some sort of variable.
Now there's one we can do here which is ignore.
So essentially what this is going to do is ignore all of the warnings that appear.
So there's a warning like this red thing's going to just ignore it.
So it won't appear in our Jupiter no book ready gone but that's kind of a Band-Aid solution right.
Like if we're just ignoring the warnings what if the warning was actually telling us something significant
the reason where you use ignore is if you'd been through your notebook if you're doing your work and
you figured okay these warnings aren't very helpful because I know what I'm doing works and I don't
need these warnings.
So that's where you might use warnings not filter warnings and ignore them all.
If you want to reset this you can set it back to default shift and into shift and enter.
Now we'll get the warning back.
So if we read here the default value of an estimate is will change from 10 inversion zero point 2 0
to 100 inversion zero point to two.
So what this is saying is that if we go here we follow this follow this path it goes S.K. loan ensemble
forest stop pi future warning.
So this means from S.K. lone ensemble import random forest classifier which is here S.K. lone ensemble
Random Forests or forest pine.
That's where they write random forest classifier in that python module.
And now this will be different depending on what warning you're getting right.
We're getting this specific warning because we're dealing with random forest classifier.
And again if this looks confusing I understand it might be at this time.
But when you go through the introduction of psychic loan section you'll see these warnings come up.
What we're sort of going through here now goes for any type of warning.
So you can follow the path here and or output some kind of warning.
These are all ways that you can approach it to fix it.
So what if if we check our psychic learn version so import SBA loan and then we go SBA loan dot get
version
has no name.
So if we get here how to tell what version of socket loan you're running should be something like get
version
installing socket learn check the socket loan documentation Mac OS conduct.
So that's me here.
So like it loan or show versions I'm seeing what version of psychic loan I have so if you guys show
versions wonderful so if we go through it Python dependencies.
So we're running Python three point seventy five.
Yep.
And we have SBA loan version zero point two one point three and so where this error is arising where
this warning is coming from is because inversion zero point two up to zero point to two of psychic loan.
It's going to raise this warning.
So in zero point two two of psychic loans a version zero point to two above our version.
This warning will go away because the default number of an estimate is for random forest classifier
will be 100.
So how would we upgrade our version of psychic loan and thus get rid of the warning.
Mm hmm.
So we've seen how to create a condo environment but how would we upgrade a package that's in our condo
environment.
Well let's go back to terminal.
So see here we've got our notebook server running going to open up a new terminal window.
What I'm going to do is I'm going to change directory so actually see a current project.
So a middle course sample project.
Wonderful.
And if I ls there I can see all of the notebooks that I've been working on.
Wonderful.
And there's my environment folder there.
So what I'm going to do is because I want to upgrade something within the content environment I'm going
to activate com to activate and it's gonna be uses for me.
Slash Daniel slash desktop slash MLK course slash sample project slash and uniform.
So now we've activated our environment we've seen this done before so if going on the list that's gonna
show me all the packages I currently have psychic learn version zero point two one point three.
Now how would I get that if we come back to the notebook.
How would I get that to version zero point two to so what we might do is check out the of documentation
condo package management guy here managing packages beautiful so this is the condo documentation for
how we might manage our packages in our environment which is what we want to do in this case we want
to see if we can upgrade socket learn and again this will go for any package that you run in this case
specific case we're just using psychic loan as an example so here's some documentation for managing
packages there's a fair bit here what we might do is go straight down to updating packages beautiful
so if we read the documentation now this is again one of the first steps you might take is if you're
facing a problem like this you might search something like this future warning Google search that and
it might tell you something like you might need to upgrade your package and this is where you might
come after that is that you'd go to the con documentation these are all workflow steps that in the beginning
they seem like a lot and they seem like wall there's so much going on here but as you sort of practice
and practice and practice you get really good at searching for the answers for yourself so to upgrade
a specific package kinda update by a python so maybe we just try that in our case we want to upgrade
socket learn so if we come back so if we go condo update sidekick learn and see what happens
let this run its thing Okay so we'll expand this window so we get everything on the same lines that's
gonna be added slash updated specs socket learn the following packages will be updated it doesn't list
socket learn there that's interesting but let's run that with a Y and see what happens
okay now if we go condo info know we can just go conduct list.
And if you want to see the specific information about one package you can just write its name.
We want to find out about psychic loan.
We're still running version zero point two one point three.
Mm hmm.
Now what could we do with that.
Well we're looking here.
If we wanted to find more information about what psychic loan packages are available from condo we might
go condo.
And the reason why I know what to look for is because I've had practice with this but you might need
to do a little bit more searching if you're not aware of this.
But I'll just tell you in this case.
So if we go searching for packages to see if a specific package such as PSI pi is available for installation
run this.
Okay to conduct search Cypress what we might do is go conduct a search psychic line and what this will
show us the condo search function is what versions of psychic loan are available from condo because
what are we after we come back to our notebook we're after version zero point two two let's figure out
how to get that wall.
Okay.
So we've got a whole bunch what we might do is there's a better way of finding this severe condensed
search psychic line.
We want some info about that so we can pass it the info tag conduct search psychic line dash dash info
diesel output the same thing but with a bit more information so we can see here it's printed out psychic
learn version zero point to two and that's the one we're after.
So what it's going to tell us here is a different dependency.
So what this version of psychic learn relies on.
So unless our environment has these packages we won't be able to install zero point to two.
And in my case I've figured out that my python version.
So see here what this is saying is that you need to have the python version greater than three point
six but less than three point seven.
So if I check my current environment and I go conduct the list python I can see my version of Python
is three point seven point five.
Okay.
So that is the reason why when I install psychic learn using Conda I don't get version zero point to
two because I'm using a version of Python that is incompatible with this version of psychic learn does
that make sense.
So when you're setting up an environment the way Conda works is it kind of makes sure behind the scenes
all of the packages and dependencies all of these tools that you install work well with each other.
So it's really saving us here by not letting us install psychic learn zero point to two because the
developers of psychic line of upload it to Anaconda and said hey these versions here between these two
numbers are the only versions that will work fully and properly with this version of cyclone.
So one way we can do this is to uninstall some of the dependencies that cyclone relies on and then reinstall
them with specific version numbers.
That's a fair bit of talking there but let's see it in action.
So that's what we're going to do.
We're going to uninstall some of the things that cyclone depends on.
So like none py in Python and then reinstall them with specific version numbers so conduct uninstall
to uninstall the package we go conduct uninstall and then the package name so we're gonna uninstall
site get learn and then we're going to uninstall python.
And that should actually be enough.
So Honda and install socket learn uninstall python.
Let's see what happens when we do that.
Yes
wonderful.
So what that's done is it's we can read up here.
So the following packages will be removed a fair few because we've removed python and cyclone at the
same time.
So panders gets removed Nan pi gets removed because as I said Conda will behind the scenes make sure
that your dependencies all work with each other.
So if we remove Python we don't have access to num PI because num pi requires Python even though we
didn't type in conduct uninstall num pi it gets removed because what it depends on got removed.
So now we go back to our notebook and we try to run our import functions they still work because our
kernel is still active but if we were to go here restart.
So basically just restarting our notebook from scratch and if we would hit shift enter here we're gonna
get some errors because our current active environment we've just uninstalled all of these num pi Pande
is mapped plot lib etc et cetera so here we're getting a kernel error.
So what we'll do is we'll come back here and we'll go conduct install.
Now we want a specific version of Python.
We want to go condo install Python 3.0 six point nine.
Wonderful.
And we want sidekick loan version zero point two 2.
And we want to reinstall that plot lib num pine pandas as well as Jupiter because a lot of different
packages got removed here.
So essentially we're rebuilding our environment with specific versions of packages that we want
so we're gonna hit yes.
And again this may take a little while while the environment Condor installs these packages so we'll
fast for the video until this is done
wonderful.
So that's reinstalled certain packages with certain values.
So now what we'll do is if we go conduct list psychic learn we'll check the version that we have not
even made a typo and kinda smart enough to realize what I was after beautiful so now because we've passed
the version number that we wanted to install by setting cyclone equal to zero point two to Conda has
installed version point to two for us.
But the reason it did that was because we also did the same thing for python.
Now we installed a version of Python in our environment 3.0 six point nine that was compatible with
version zero point to two.
And so the way to check this we can come back to our notebook.
We'll see if we restart our kernel.
We may have to reactivate our Jupiter notebook server because we've reset all the parameters for actually
we might know we might get away with this so if we try to import all the standard inputs here might
take a little while because we've uninstalled them and reinstall them beautiful.
So that took about a minute or so because we just reinstalled all of these packages.
So when you're first importing them into a given notebook it would take a little while.
So then if we run these cells for now don't worry too much if you don't know what's going on we're gonna
go through this in the entire cycle loan section.
We don't want to filter any warnings so we'll comment that out we want to import.
Remember we ran this cell before and this one again and we don't need to run this cell anymore so we'll
escape that and press x to remove it.
And now this is saved from before so previously when we ran this cell it produced a warning.
But now since we've upgraded to version zero point two to cross our fingers that warning shouldn't be
there and we're kind of waiting for these cells here to run.
So.
So if we run this one
this is going to import the random forest classifier or we've set an estimate is equal to one hundreds
and might have to delete that okay.
So we're gonna rerun these three cells as you can see the warning is not there but we did run this one
with an estimate is equal to 100.
So if we run this past nothing there run this and now previously we would have got a warning if we ran
this cell but we don't see because now we're using psychic lone version zero point to two if we hit
shift tab on this we can see that an estimate is has changed to equal 100 it was a fairly in depth video
there's a fair few steps there but the takeaways here to remember is that when you're experiencing warnings
a couple of different ways you can deal with them.
You can use the warnings package and you can either ignore them hitting that will ensure that there's
no warnings that pop up when you run you do it a notebook sells but sometimes warnings can be helpful
so maybe you want to reset it back to default and then the warnings will show up as they come in.
And then if you figure out maybe you need to upgrade or change some of the dependencies the packages
that you're using within conduct you can do that.
So managing packages in the kind of documentation that's where you want to go next.
And if you run condo update bio Python or cyclone in our case and it doesn't work it may be because
some of the other packages the other tools that you're using and Conda are using different version numbers
and we saw that in here before when we checked the version of Python that we were using and we had three
point seven point something which was incompatible with version zero point to two of psychic learn.
So the way to fix that was we did conduct uninstall and then packages.
So whichever packages you wanted to remove and then to fix it we did conduct install package and then
set it to a specific version number.
So in our case it was psychic line and we wanted version zero point to two.
So we set it to zero point to two.
That's one of the workflows that you can use when you're running into dependency issues is first of
all check the documentation.
Try it out see if it works.
And then second of all it's not working uninstall the package that's broken and reinstall it.
So now once you go through the introduction a like it loan section if you come across warnings you know
how they appear why they appears because something is going on you know how to filter them using the
warnings module and you know how to upgrade and change different packages using conduct if need be.