How simulated deposit works?

I will name the object in car seats over here So this car seat where you see So this is small C and this is capital C So I am luring this car seat deficit which is part of the ISIL are package and I’m staring into a new object and living their object to be car seats Now let me have ah plants That are your asset first So I’ll just type in car seats over here Right to this is my data set Now I love to have a glance at this deal as it properly car seats So we have the description of this day does it over here So as you see this is ah simulated deposit containing seals off child car seats at 400 different stores So we have 400 observations in total or 400 records in total and their 11 variables or 11 condoms in total Now these are the different column.

So we’ve got that sales Call him over here The sales column has basically the unit sales in thousands at each location to this 9.5 would be 9.5 in 2000 so that could be around 9000 seals Then we’ve got comprise column which is the price charged by computer at each location And then we’ve got the income column over here So income column Bird obviously tell you the community income level and thousands of dollars Then they got the advertising column which they know it’s the local advertising budget for the company at each location Then we’ve got the population Call him over here So this will tell you the population size and thousands Then we’ve got the price.

So prize the company charges for car seeds at each side Then we’ve got the shell location So this basically tells you that there are three levels for the shelf location Either it is good bad or medium And this indicates the quality of the shelving location for the car seats at each site And then you’ve got all of these different columns over here So you got the age column EDUCATION COLUMN A and column Angeles COLUMN You can just go through the description of this entirety does it over here So now that we have looked at the details said we will love started by you know are Tom Dayton manipulation purpose over here So now what You see Yes we have the SEALS column So I want to add a new column which is dependent on the SEALS column So let’s say that over the sales is greater than eat so the speed actually means 1000.

So wherever those seals are greater than 8000 I want to denote it with high And where were the seals Is actually less than eight I want to denote it Us Look And that is what I’m doing with this particular command over here So I will use this if-else close And over here I am checking If though seals the number of seals is actually greater than or equal to eight And if the number of sales is equal to or greater than eat then I wanted to be denoted with Yes on the other hand of the number of sales are actually less than it Then I wanted to be denoted with a new and I’m storing this in a new object and even that object to be high Now let me just show you the head off high over here.

So I will type in high dot head So let me go ahead and actually run this again over here So let me check the class of this class off height Right So this is actually your character so I’ll just pretend high over here on the day I’ll get maybe the 1st 5 elements What you see You have Yes Yes yes No and no Now let me compare this with this particular column over here So as you see the number off seals it is 9.5 And since 9.5 is actually greater than if you have a yes value Similarly you have 11.2 over here and since 11 points towards greater than eat you have Yes Then you have 10.6 which is greater than eight again You have a years after that We have seven-point forward and 4.1 fight which is less than it And that is why we have a no value over here right.

So we have basically in created a new object where we are getting yes and no values based on this seals column So now that this is done or will the worst we will add a new object So we will basically add this into this entire data frame Right So I am using the data free in function over here Using this I will basically add this particular object into their car seat data from right So I am attaching this new object as a new column into this data set and I am storing it back to the car seat Data from over here Now let me have a glance that car seats of you off car seats No If you have a glance at the studio said Do you see that we have added this new column.

Right So let me show you the original data set Review off Let me put in Capital C over here So this was the original data set which did not have the high column And if you look at this particularity does it over here we have this high column over here So all of these yes values denote those cases where the seals are greater than it on all of these No values denote where the sales value is actually less than eight So we have done this We have added a new column to this Now this would be our dependent variable Right So are a problem statement for this particular up Unity does It would be We want to understand whether the sales are high or not based on all of these different factors So I have created this column now since this column is actually based on the seal’s column I will go ahead and remove this column.

So let me computers and let me peace it out over here So as you see what I’m basically doing us I am selecting all of the rules from this car seats did us it And I am also selecting all of the columns except the foods Call him That is why I put in minus one over here So when I put in minus one I’ll be getting all of the columns except the first column and I am scoring result back toe The same leaders it over here So this is done Now let me have a glance of this deal Asset view off car seats So as you see I have removed the first call and prayed to the first column was the SEALS column which I have successfully removed from over here Now it’s finally time to build our decision three models so we’ll go ahead and build a decision tree So the bill the decision tree we would require this tree package so for should have to install the packets.

You’ll click on packages he’ll pick on install and you will just type and tree over here and when you click on install the package would be installed And since I have already installed it I don’t need to do that again So I’ll type in the library and go ahead and load this package So as you see I have successfully loaded this tree library So now that this is done it’s time to build my model And as I have told him the problem statement does this I want to understand whether the sales are high or not based on the rest of the column threat If I were to understand where the seals are higher not based on the income out based on advertising a population of prison so one So I will go ahead and will this model So the street back it gives is this three function and inside this, we are giving into parameters So they’re forced parameters.

Basically, the formula where we were given the dependent variable and all of the independent variables So over here are dependent variables Is this hi column over here Right So and the independent feasible So I have put in this dart symbol over here to this dot symbol basically means that I am selecting all other variables as the independent variables except this particular variable over here So let’s take this still a symbol So whatever is given on the left side off the tilde symbol all off those values are corrupt You know also that video ballistic and as a dependent variable and whatever values are given on the right side of the hill assemble all of them would be taken as our independent variables So here I would be a dependent variable and the rest of the cards will be independent variables And I want to build this model on top of the car seeds.

They do it right to This is the second battery meter and I am storing this in a new object and I am naming their object to be tree model So I have successfully built this model Now let me have a glance at the somebody of this model so I’ll use the somebody function and I will pass in this object which I have just built So somebody off tree model on this is what we have So as you seems this basically gives us no formula which we had just given and there are 27 terminal notes.

Leave a Comment