Skip to content

Instantly share code, notes, and snippets.

View xxyjoel's full-sized avatar
💙

Joel xxyjoel

💙
View GitHub Profile
@xxyjoel
xxyjoel / US Zip Code Geolocations from 2018 Government Data
Created July 13, 2020 03:39 — forked from abatko/US Zip Code Geolocations from 2018 Government Data
All US zip codes with their corresponding geolocations (latitude and longitude coordinates). Comma delimited for your database goodness. Source: https://www.census.gov/geographies/reference-files/time-series/geo/gazetteer-files.html > ZIP Code Tabulation Areas > Download the ZIP Code Tabulation Areas Gazetteer File
This file has been truncated, but you can view the full file.
ZIP,LAT,LNG
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.455183, -67.119887
00606,18.158327, -66.932928
00610,18.295366, -67.125135
00612,18.402253, -66.711397
00616,18.420412, -66.671979
00617,18.447538, -66.557681
00622,17.991245, -67.153993
@xxyjoel
xxyjoel / state_shift_model.R
Created January 16, 2020 00:50
rudimentary state shift probability model
require(lubridate)
require(quantmod)
require(forecast)
require(alphavantager)
require(dplyr)
require(plyr)
require(purrr)
#stock.data <- filtered.data[1:1000,]
#output <- price.shift(stock.data)
-- Code came from the article here:'
-- https://www.mssqltips.com/sqlservertip/4054/creating-a-date-dimension-or-calendar-table-in-sql-server/
--Declare temp table to drive later tables
DECLARE @StartDate DATE = '20000101', @NumberOfYears INT = 30;
-- prevent set or regional settings from interfering with
-- interpretation of dates / literals
SET DATEFIRST 7;
require(dplyr)
require(stats)
require(data.table)
require(RODBC)
require(DBI)
require(RODBCext)
#PULL CONNECTION
my_connection <- odbcDriverConnect('driver={SQL Server};server=SERVER;database=DATABASE;trusted_connection=true')
#functions for altering your peceptions of standard daily OHLC values
price.diff <- function(stock.data) {
price <- stock.data$adj
output <- vector()
for (i in 1:length(price)) {
if (i < 2) {
output[i] <- 0
require(arules)
require(arulesViz)
require(reshape2)
require(gender)
require(plyr)
require(dplyr)
require(ggplot2)
transaction.data <- read.csv('fact table; transaction data with first and last customer names')
customer.data <- read.csv('dim table; Customer information')
require(zoo)
require(lubridate)
require(forecast)
require(RODBC)
require(DBI)
require(RODBCext)
FN_ExecuteForecast <- function(myDataSet, myConnection) {
#browser()
@xxyjoel
xxyjoel / xgboost_binary.R
Last active June 5, 2018 23:47
Initial XGB model outline for Kaggle competition
require(rlang)
require(rlanf)
require(tibble)
require(tidyr)
require(tidyverse)
require(xgboost)
###############################
## XGB OVERVIEW ##
###############################