Skip to content

Instantly share code, notes, and snippets.

View auzaheta's full-sized avatar

Alvaro Uzaheta auzaheta

View GitHub Profile
@mike-lawrence
mike-lawrence / helper_functions.r
Last active April 23, 2024 13:03
Stan vs LME4 for hiearchical within-subjects designs with binomial outcomes
#' Installs any packages not already installed
#' @examples
#' \dontrun{
#' install_if_missing(c('tidyverse','github.com/stan-dev/cmdstanr'))
#' }
install_if_missing = function(pkgs){
missing_pkgs = NULL
for(this_pkg in pkgs){
``` r
library(tidyverse)
iris %>%
count(Species)
#> # A tibble: 3 x 2
#> Species n
#> <fct> <int>
#> 1 setosa 50
#> 2 versicolor 50
@richpauloo
richpauloo / README.md
Last active December 24, 2019 01:43
Cumulative Variable Importance for Random Forest Models

Cumulative Variable Importance for Random Forest (RF) 🌲🌳 Models

Motivation

What does an interpretable RF visualization look like? Out-of-the-box 📦 RF implementations in R and Python compute variable importance over all trees, but how do we get there?

In other words, what would a cumulative variable importance for a RF look like?

Approach

@csgillespie
csgillespie / README.md
Last active August 24, 2022 16:26
Getting the most out of Git

Getting the most out of Git

This GitHub gist contains instructions for the R, git & travis tutorial.

Assumed knowledge

Partipants must be familar with

@emitanaka
emitanaka / ggplot_tutorial.Rmd
Last active March 30, 2020 04:02
ggplot tutorial with kunoichi + ninjutsu xaringan theme
---
title: "ggplot tutorial"
subtitle: "with kunoichi + ninjutsu theme"
author: "<br><br> Emi Tanaka"
date: "<br>2018/09/16"
output:
xaringan::moon_reader:
lib_dir: libs
css: ["kunoichi", "ninjutsu"]
nature:
data {
int N; // number of rows
int T; // number of inidvidual-choice sets/task combinations
int I; // number of Individuals
int P; // number of covariates
vector<lower = 0, upper = 1>[N] choice; // binary indicator for choice
matrix[N, P] X; // product attributes
int task[T]; // index for tasks
@EmilHvitfeldt
EmilHvitfeldt / horizontal.R
Created February 25, 2018 06:35
Horizontal annotations with ggrepel and ggplot2
library(tidyverse)
library(ggrepel)
set.seed(1234)
data <- tibble(x = seq_len(100),
y = cumsum(rnorm(100)))
anno_data <- data %>%
filter(x %% 25 == 10) %>%
@jyuu
jyuu / twitter_tutorial.R
Created November 25, 2017 17:13
Intro to Twitter and R
# Load packages -----------------------------------------------------------
library(twitteR)
library(dplyr)
library(gganimate)
library(ggplot2)
library(bigrquery)
# Twitter Creds -----------------------------------------------------------
consumer_key <- ""
@omoindrot
omoindrot / tensorflow_finetune.py
Last active October 7, 2024 18:58
Example TensorFlow script for fine-tuning a VGG model (uses tf.contrib.data)
"""
Example TensorFlow script for finetuning a VGG model on your own data.
Uses tf.contrib.data module which is in release v1.2
Based on PyTorch example from Justin Johnson
(https://gist.github.com/jcjohnson/6e41e8512c17eae5da50aebef3378a4c)
Required packages: tensorflow (v1.2)
Download the weights trained on ImageNet for VGG:
```
wget http://download.tensorflow.org/models/vgg_16_2016_08_28.tar.gz
@amintos
amintos / btm.py
Created May 2, 2017 13:42
Bi-term Topic Model implementation in pure Python
"""
Bi-Term Topic Model (BTM) for very short texts.
Literature Reference:
Xiaohui Yan, Jiafeng Guo, Yanyan Lan, and Xueqi Cheng:
"A biterm topic model for short texts"
In Proceedings of WWW '13, Rio de Janeiro, Brazil, pp. 1445-1456.
ACM, DOI: https://doi.org/10.1145/2488388.2488514
This module requires pre-processing of textual data,