Professional Documents
Culture Documents
Business
0 0 2869 3600 1 2 4 1
Rooms
Business
1 1 4318 3900 1 2 4 9
Rooms
Business
2 2 6265 2700 1 1 4 2
Rooms
59
Hotel Grand Central by Anuraag Rath - Jupyter Notebook http://localhost:8888/notebooks/Hotel Grand Central by Anur...
Unnamed:
customer_id pay daysSpent bathService RoomType minForService floor
0
Super
3 3 24 4900 1 1 2 3
Deluxe
Business
4 4 9481 3900 1 1 3 4
Rooms
Business
1008 1008 7329 2300 1 1 5 2
Rooms
Business
1009 1009 10286 3750 1 2 1 1
Rooms
Super
1011 1011 1721 4200 1 2 2 5
Deluxe
Executive
1012 1012 1676 18000 2 2 2 5
dataHotel
Out[3]:
Unnamed:
customer_id pay daysSpent bathService RoomType minForService floor
0
0 0 2869 3600 1 2 1 4 1
1 1 4318 3900 1 2 1 4 9
2 2 6265 2700 1 1 1 4 2
3 3 24 4900 1 1 3 2 3
4 4 9481 3900 1 1 1 3 4
dataHotel["Damages"] = dataHotel["Damages"].map(ouiNon)
dataHotel["spa"] = dataHotel["spa"].map(ouiNon)
dataHotel["has_washer_dryer"] = dataHotel["has_washer_dryer"].map(ouiNo
dataHotel["has_personalizedService"] = dataHotel["has_personalizedServi
dataHotel["barservice"] = dataHotel["barservice"].map(ouiNon)
dataHotel["has_dishwasher"] = dataHotel["has_dishwasher"].map(ouiNon)
dataHotel["has_patio"] = dataHotel["has_patio"].map(ouiNon)
dataHotel["has_gym"] = dataHotel["has_gym"].map(ouiNon)
60
Hotel Grand Central by Anuraag Rath - Jupyter Notebook http://localhost:8888/notebooks/Hotel Grand Central by Anur...
dataHotel
Out[4]:
Unnamed:
customer_id pay daysSpent bathService RoomType minForService floor
0
0 0 2869 3600 1 2 1 4 1
1 1 4318 3900 1 2 1 4 9
2 2 6265 2700 1 1 1 4 2
3 3 24 4900 1 1 3 2 3
4 4 9481 3900 1 1 1 3 4
0 3600 1 2 1 4 1 1 1
1 3900 1 2 1 4 9 0 1
2 2700 1 1 1 4 2 0 1
3 4900 1 1 3 2 3 0 1
4 3900 1 1 1 3 4 1 1
61
Hotel Grand Central by Anuraag Rath - Jupyter Notebook http://localhost:8888/notebooks/Hotel Grand Central by Anur...
In [10]: X = hotelDataMain[["daysSpent",
"bathService",
"RoomType",
"minForService",
"floor",
"Damages",
"spa",
"has_washer_dryer",
"has_personalizedService",
"barservice",
"has_dishwasher",
"has_patio",
"has_gym"]]
y = hotelDataMain["pay"]
correlationMatrix = hotelDataMain.corr()
top_corr_features = correlationMatrix.index
plt.figure(figsize=(20,20))
heatMap = sns.heatmap(hotelDataMain[top_corr_features].corr(),annot=Tru
62
Hotel Grand Central by Anuraag Rath - Jupyter Notebook http://localhost:8888/notebooks/Hotel Grand Central by Anur...
plt.scatter(hotelDataMain["floor"], hotelDataMain.pay)
plt.xlabel('Floor')
plt.ylabel('Bill Amount')
plt.show()
63
Hotel Grand Central by Anuraag Rath - Jupyter Notebook http://localhost:8888/notebooks/Hotel Grand Central by Anur...
-------------------------------------------------
Linear Regression
In [85]: Xfeatures = hotelDataMain[["daysSpent",
"bathService",
"RoomType",
"has_washer_dryer",
"has_personalizedService",
"barservice",
"has_gym"]]
yFeature = hotelDataMain.pay
hotelRegression = LinearRegression()
hotelRegression.fit(xTrain, yTrain)
predictPrices = hotelRegression.predict(xTest)
predictPrices
Out[85]:
64
Hotel Grand Central by Anuraag Rath - Jupyter Notebook http://localhost:8888/notebooks/Hotel Grand Central by Anur...
Predict price
In [81]: yourName = "Anuraag Rath"
daysSpentu = 1
yourbathService = 2
yourroomType = 2
washer_dryer = 1
personalizedService = 0
yourbarservice = 1
gymService = 1
predictMyPrice = hotelRegression.predict(myOptions)
65
Hotel Grand Central by Anuraag Rath - Jupyter Notebook http://localhost:8888/notebooks/Hotel Grand Central by Anur...
66