predictPrice: Predict a price for an Airbnb listing using the...

Description Usage Arguments Examples

View source: R/predictPrice.R

Description

Given a listing ID, predictPrice uses the xgboost package to predict a price for that listing based on its characteristics and data from nearby listings. A listing ID can be found on the end of the URL for the listing on Airbnb's site. For example, a listing URL for Airbnb looks like https://www.airbnb.com/rooms/17634206?s=QAXAT6DD. In this example, the listing ID is "17634206." Passing this value as a character string will yield a price prediction based on its characteristics, implying over- or undervaluation.

Usage

1
2
3
predictPrice(listingID, maxSample = 500, nfold = 10, nrounds = 1000,
  early_stopping_rounds = 50, max_depth = 4, eta = 0.05,
  listing.detail = NULL, trainData = NULL)

Arguments

listingID

the ID that Airbnb has assigned to the listing. This can be taken from the end of a listing's URL. This should be passed as a string (a character vector of length one).

maxSample

The maximum number of nearby listings on which to base the price prediction. There is a tradeoff-a higher value will increase prediction precision, but it will take longer to run.

nfold

For advanced users. The number of cross validation folds used by xgboost.

nrounds

For advanced users. The maximum number of rounds that xgboost will run when finding the optimal number of rounds through cross validation.

early_stopping_rounds

For advanced users. This parameter will cause xgboost to stop training new models after the specified number of rounds if cross validation error does not improve.

max_depth

For advanced users. The maximum depth of a tree fitted by xgboost.

eta

For advanced users. The shrinkage parameter used to control the learning rate for xgboost.

listing.detail

a dataset for the particular listing if you've already pulled it using listingDetails. Note that this should be a dataset of only one listing (as in listing.detail).

trainData

a dataset consisting of listings with details if you've already pulled it using searchLocation and addDetails.

Examples

1
2
3
4
data("trainData", package="Rbnb")
data("listing.detail", package="Rbnb")
price.prediction <- Rbnb::predictPrice("12170773",
       listing.detail = listing.detail, trainData = trainData[1:100])

NoahZinsmeister/Rbnb documentation built on May 7, 2019, 6:19 p.m.