# Multiclass Classification that includes a Geospatial Element

I am attempting to train a classifier to predict different prices for an item in different suburbs. I have several features, two of which are a latitude and longitude for the centroid of the suburb.

I am attempting to train the model to classify the price of an item in a bin of $10 size. The geospatial element will definitely affect the price of the item, however the training data I have will have gaps in it (i.e. I don't have prices for all suburbs). What is the best way to engineer a feature that will include this geospatial information and be able to fill in the gaps in the training/test data? So far I have tried creating new features for the bearing and distance from the capital city which seemed to work okay, as well as binning the latitude and longitude which performs worse than the bearing/distance. I did consider using a geohash, however I think that this will be too complex a feature for a classifier to understand. • Interestingly combining the binning and the bearing/distance has increased my overall accuracy to 0.82. Aug 13 '15 at 7:54 • Is the price your target variable or a feature ? Aug 13 '15 at 9:14 • Price is my label I am attempting to classify. In my training data I have binned it into$50 buckets Aug 13 '15 at 9:17
• The geospatial element definitely has an impact on the prices that are returned - so I can't ignore it at all. Aug 13 '15 at 10:29

library(noncensus)
my_dataframe['fips']<-zip_codes$fips[match(my_dataframe$zip, zip_codes$zip)]  This assumes you already have a dataframe called my_dataframe with ZIP codes as a column named 'zip'. As a bonus you can use the choroplethr package to create a nice visualization of some scalar value, for example, your item price: library(choroplethr) df_to_plot<-data.frame() df_to_plot['region']<-my_dataframe$fips