Skip to content

Instantly share code, notes, and snippets.

View IanniMuliterno's full-sized avatar
🎯
Focusing

Ían Muliterno IanniMuliterno

🎯
Focusing
View GitHub Profile
library(RemixAutoML)
library(data.table)
###########################################
# Prepare data for AutoTS()----
###########################################
# Load Walmart Data from Dropbox----
data <- data.table::fread("https://www.dropbox.com/s/2str3ek4f4cheqi/walmart_train.csv?dl=1")
@talegari
talegari / recsysr.md
Last active August 5, 2022 01:59
R libraries for recommender systems

R libraries for recommender systems

A list of R libraries for Recommender systems. Most of the libraries are good for quick prototyping.

Maintainer: Srikanth KS(talegari) Email: gmail me at sri dot teach (do write to me about packages ommited)

Package Dev page Description
recommenderlab github Provides a research infrastructure to test and develop recommender algorithms including UBCF, IBCF, FunkSVD and association rule-based algorithms
rrecsys github Implementations of several popular recommendation systems like Global/Item/User-Average baselines, Item-Based KNN, FunkSVD, BPR and weighted ALS for rapid prototyping
library(tidyverse)
library(ggrepel)
library(scales)
results <- read_csv("results.csv")
# add GDP rank, winning candidate, chart labels
results <- results %>%
arrange(desc(GDP)) %>%
mutate(GDPRank = 1:51) %>%
mutate(Win = ifelse(ClintonNum>TrumpNum, "Clinton", "Trump")) %>%
# Martingale Betting System
# initialize parameters ---------------------------------------------------
init_start <- 12800
init_goal <- init_start + 1000
init_bet <- 100 # initial bet value
prob_win <- 0.47 # probability of win
n <- 500000 # simulation count
# run simulation ----------------------------------------------------------
@tomhopper
tomhopper / ggplot2_axis_ranges.R
Last active October 2, 2020 10:36
Get the actual x- and y-axis ranges from a ggplot object. Works on ggplot2 >= 0.8.9 (tested on 0.9.3.1). Code from http://stackoverflow.com/questions/7705345/how-can-i-extract-plot-axes-ranges-for-a-ggplot2-object
library(ggplot2)
#' create a data frame with test data.
my.df <- data.frame(index = 1:10, value = rnorm(10))
#' create the ggplot object
my.ggp <- ggplot(data = my.df, aes(x = index, y = value)) + geom_point() + geom_line()
#' get the x- and y-axis ranges actually used in the graph
# This worked in early versions of ggplot2 (probably <2.2)