<jupyter_start><jupyter_text>Setup<jupyter_code>getwd()
library(data.table)
library(FSelector)
library(rworldmap)
library(rworldxtra)<jupyter_output>Loading required package: sp
### Welcome to rworldmap ###
For a short introduction type : 	 vignette('rworldmap')<jupyter_text>Load Data<jupyter_code>properties <- fread("data/properties_2016.csv")
training.set <- read.csv("data/train_2016_v2.csv")
ls(properties)
ls(training.set)<jupyter_output><empty_output><jupyter_text>Map<jupyter_code>properties$longitude <- properties$longitude/1000000
properties$latitude <- properties$latitude/1000000
newmap <- getMap(resolution = "high")
plot(newmap, 
     xlim = c(min(properties$longitude, na.rm = TRUE), max(properties$longitude, na.rm = TRUE)), 
     ylim = c(min(properties$latitude, na.rm = TRUE), max(properties$latitude, na.rm = TRUE)), 
     asp = 1)

points(properties$longitude, properties$latitude, col = "red", cex = .1)<jupyter_output><empty_output><jupyter_text>Prepare Data<jupyter_code>training.set[is.na(training.set)] <- 0
properties[is.na(properties)] <- 0
properties$censustractandblock <- factor(properties$censustractandblock)
training.set.merged <- merge(x = training.set, y = properties, by = "parcelid", all.x = TRUE)<jupyter_output><empty_output><jupyter_text>Gain Ratio<jupyter_code>gain.ratio.feature.weights <- gain.ratio(logerror~., training.set.merged)
print(gain.ratio.feature.weights)
gain.ratio.top.features <- cutoff.k(gain.ratio.feature.weights, 10)
print(gain.ratio.top.features)<jupyter_output>[1] "censustractandblock"   "finishedsquarefeet15"  "finishedsquarefeet6"  
 [4] "propertyzoningdesc"    "unitcnt"               "garagecarcnt"         
 [7] "yearbuilt"             "taxdelinquencyflag"    "taxdelinquencyyear"   
[10] "propertylandusetypeid"<jupyter_text>Information Gain<jupyter_code>information.gain.feature.weights <- information.gain(logerror~., training.set.merged)
print(information.gain.feature.weights)
information.gain.top.features <- cutoff.k(information.gain.feature.weights, 10)
print(information.gain.top.features)<jupyter_output>[1] "censustractandblock"       "propertyzoningdesc"       
 [3] "rawcensustractandblock"    "parcelid"                 
 [5] "regionidzip"               "propertycountylandusecode"
 [7] "yearbuilt"                 "finishedsquarefeet12"     
 [9] "regionidcity"              "calculatedbathnbr"<jupyter_text>Time features<jupyter_code>date.info <- unclass(as.POSIXlt(training.set.merged$transactiondate))
ls(date.info)
date.feature.names <- c("mday", "mon", "year", "yday")
training.set.merged[date.feature.names] <- date.info[date.feature.names]<jupyter_output><empty_output><jupyter_text>All Features<jupyter_code>training.set <- subset(training.set.merged, select = unique(c(gain.ratio.top.features, information.gain.top.features, date.feature.names, "logerror")))
test.set <- subset(properties, select = c(gain.ratio.top.features, information.gain.top.features))
results <- subset(properties, select= "parcelid")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14304548450889915, 'fraction_numerical': 0.015161502966381015, 'mean_word_length': 5.820224719101123, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '553892', 'license': 'MIT', 'n_tokens_mistral': 1096, 'n_tokens_neox': 1017, 'n_words': 136, 'path': 'python/notebooks/ZillowForecastR.ipynb', 'repo_name': 'tudoriliuta/web_traffic_forecasting', 'size': '3034'}