Skip to content

Instantly share code, notes, and snippets.


evalparse xiaodaigh

View GitHub Profile
View cpu_bitonic_sort.jl
shared = rand(16)
bisort(shared) = begin
NUM = UInt(length(shared))
k = UInt(2)
while (k <= NUM)
j = div(k,2)
while(j >=1)
for tid in UInt(0):UInt(NUM-1)
xiaodaigh / benchmark_2048.jl
Created Oct 15, 2018
2048 Simulation challenge
View benchmark_2048.jl
using StatsBase
const DIRS = [:left, :up, :right, :down]
function init_game()
grid = zeros(Int8,4,4)
grid[rand(1:4),rand(1:4)] = rand2_1()
grid[rand(1:4),rand(1:4)] = rand2_1()
xiaodaigh / ctree_kmeans_iris_model_assessment
Created Oct 15, 2017
ctree vs kmeans on the iris dataset
View ctree_kmeans_iris_model_assessment
# data prep ---------------------------------------------------------------
iris_copy <- copy(iris)
iris_copy_ctree <- copy(iris_copy)
# ctree model -------------------------------------------------------------
xiaodaigh / 1_forwardflag.r
Last active Dec 20, 2017
Fast implementation of binary (true/false) forward looking flag
View 1_forwardflag.r
forwardflag <- function(bools, ...) {
if(typeof(bools) != "boolean") {
warning("input variable not of boolean type, the only other accepted type is 0 & 1")
forwardflag_(bools, ...)
forwardflag_ <- function(bools, period = 12) {
stopifnot(period > 0)
View infix.r
`infix_fn` <- function(left, right) {
#...some code
xiaodaigh / feeatherc.r
Created Aug 28, 2017
Some R to read .feather data chunkwise
View feeatherc.r
# featherc
options(future.globals.maxSize = Inf)
split_feather <- function(feather_file, by = NULL, parts = parallel::detectCores()) {
system.time(inputdata <- feather::read_feather(feather_file))
xiaodaigh /
Last active Aug 25, 2017
A SAS macro to split a dataset (.sas7bdat) into datasets where each resultant dataset contains exactly one column of the original data
data a;
do i = 1 to 10000;
b = i;
%include "path/to/";
libname outlib "path/to/output/dataset/";
View gist:2a01b284377cb189369a
Top 5 Underdog Stories
1. Zhou Jun Xun wins LG cup
No one from outside Japan, South Korea, China has ever won an international title until Zhou Jun Xun from Taiwan. He was the first 9 dan from Taiwan and he has an unmistakable large red birth mark on his face. On his way to LG cup victory he defeated Lee Chang Ho and Lee Sedol. His most famous win was against Lee Sedol where he played a new move in the avanlanche
2. Ear-reddening
Shuwa was the up start who nobody expected could challenge the pre-Meijin
3. Go Seigen vs Shuko
When Go Seigen won the competition to ear the right to challenge Shuko. No one expected Go to win or perhaps come close to winning. Shuko played white and since there is no komi at the time, the only adavantage he had was that he could adjourn the game at any time. Go lost the game by 2 points.
View hd_binning
High Definition Binning {#HD_binning}
The process of binning (or discretization) of variables is a well-established practice in building credit scorecards. The binning process involves taking raw values e.g. income and cutting that data into bins (discrete ranges) such as 2000-3000, 3000-4000. Typically we would see an upward trend in terms of Good/Bad Odds as the income levels go up.
In this blog post I would like to explain a novel approach to binning that can produce very fine binning.
Automatic Binary Binning Algorithm (ABBA)
You can’t perform that action at this time.