Login using Social Account
     Continue with GoogleLogin using your credentials
Sometimes, it may be the case that a single attribute is not very useful while prediction. For example, the total number of rooms in a block is not very useful if you don’t know how many households there are. So, in such cases, we create new attributes by combining two or more attributes.
Here, we create three new features, which are-
rooms_per_household
- We divide the number of rooms in each block by its household value. It tells us on average how many rooms are there in a particular block per household.
bedrooms_per_room
- We divide the number of bedrooms in each block by the number of rooms in that particular block. It tells us the average ratio of the number of bedrooms to the number of rooms in a particular block.
population_per_household
- We divide the population of each block by its household value. It will tell us on average how many people live in a particular house in a block.
Create the three new features as mentioned above with the same name and append them to our dataset train_copy
.
For example, we can create the feature rooms_per_household
and append it to our dataset like-
train_copy["rooms_per_household"] = train_copy["total_rooms"]/train_copy["households"]
In the same way, create the other two.
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...