This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import graphlab as gl | |
# Load the data | |
train = gl.SFrame.read_csv('data/train.csv') | |
test = gl.SFrame.read_csv('data/test.csv') | |
sample = gl.SFrame.read_csv('data/sampleSubmission.csv') | |
del train['id'] | |
# Train a model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execve("/home/chris/julia/usr/bin/julia-debug-readline", ["/home/chris/julia/usr/bin/julia-"..., "-bf", "sysimg.jl"], [/* 24 vars */]) = 0 | |
brk(0) = 0x1e1a000 | |
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) | |
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f38696c6000 | |
readlink("/proc/self/exe", "/home/chris/julia/usr/bin/julia-debug-readline", 4096) = 46 | |
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) | |
open("/home/chris/julia/usr/bin/../lib/julia/tls/x86_64/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) | |
stat("/home/chris/julia/usr/bin/../lib/julia/tls/x86_64", 0x7fffcd562cd0) = -1 ENOENT (No such file or directory) | |
open("/home/chris/julia/usr/bin/../lib/julia/tls/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) | |
stat("/home/chris/julia/usr/bin/../lib/julia/tls", 0x7fffcd562cd0) = -1 ENOENT (No such file or directory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
processor : 0 | |
vendor_id : GenuineIntel | |
cpu family : 6 | |
model : 60 | |
model name : Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz | |
stepping : 3 | |
microcode : 0x9 | |
cpu MHz : 800.000 | |
cache size : 8192 KB | |
physical id : 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NU gdb (GDB) 7.5.91.20130417-cvs-ubuntu | |
Copyright (C) 2013 Free Software Foundation, Inc. | |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
This is free software: you are free to change and redistribute it. | |
There is NO WARRANTY, to the extent permitted by law. Type "show copying" | |
and "show warranty" for details. | |
This GDB was configured as "x86_64-linux-gnu". | |
For bug reporting instructions, please see: | |
<http://www.gnu.org/software/gdb/bugs/>. | |
[Thread debugging using libthread_db enabled] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Multi-armed bandit example | |
# Each arm has some (unknown) probability of reward=1. | |
# Using beta priors we can update our posterior after each pull | |
# The following uses Thompson sampling, where we sample probabilities | |
# from our posterior and choose the arm with the largest expected reward. | |
set.seed(2) | |
J <- 3 | |
probs <- rbeta(J,1,1) # True probability |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Chris DuBois | |
# September 2012 | |
# Inspired by: http://vijayinterviewquestions.blogspot.com/2007/07/write-your-own-c-program-to-implement.html | |
function atoi(s) | |
i = 0 | |
L = strlen(s) | |
# skip preceding whitespaece | |
a = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "Fast matrix multiply" written in Julia | |
# | |
# Method below implements the algorithm described in [Gustavson, 1978]: | |
# http://www.cse.iitb.ac.in/graphics/~anand/website/include/papers/matrix/fast_matrix_mul.pdf | |
# | |
# Copyright (C) 2012 Christopher DuBois | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##' Quickly create a named list using one or more variables | |
##' | |
##' Example: | |
##' > a <- 1; b <- 2 | |
##' > listn(a,b) | |
##' $a | |
##' [1] 1 | |
##' $b | |
##' [1] 2 | |
listn <- function(...) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/r | |
library(inline) | |
library(rbenchmark) | |
## openMPCode example from Rcpp/examples/OpenMP/ by Dirk E. | |
openMPCode <- ' | |
// assign to C++ vector | |
std::vector<double> x = Rcpp::as<std::vector< double > >(xs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/r | |
library(inline) | |
library(rbenchmark) | |
## lastly via OpenMP for parallel use | |
openMPCode <- ' | |
// assign to C++ vector | |
std::vector<double> x = Rcpp::as<std::vector< double > >(xs); |
NewerOlder