This file contains hidden or 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
| for i in range(1,101):print"Fizz"*(not i%3)+"Buzz"*(not i%5) or i |
This file contains hidden or 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
| from __future__ import print_function | |
| from Queue import Queue | |
| import json | |
| def subdivide(posn1, posn2): | |
| """ | |
| Accepts two Tuple2 and returns a generator that produces the four new boxes. | |
| Args: |
This file contains hidden or 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
| package learning | |
| object LinearAlgebra { | |
| class Row(r: Double*) extends Seq[Double] { | |
| val row: List[Double] = r.toList | |
| val length = row.length | |
| def * (that: Row): Double = { | |
| require(that.length == length, "Sizes don't align") |
This file contains hidden or 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
| \usepackage{listings} | |
| \usepackage[numbered,framed]{matlab-prettifier} | |
| \usepackage{color} | |
| \usepackage{geometry} | |
| \geometry{verbose,tmargin=1.0in,bmargin=1.0in,lmargin=0.5in,rmargin=0.5in} | |
| \definecolor{dkgreen}{rgb}{0,0.6,0} | |
| \definecolor{gray}{rgb}{0.5,0.5,0.5} | |
| \definecolor{mauve}{rgb}{0.58,0,0.82} |
This file contains hidden or 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
| from itertools import product | |
| from itertools import permutations | |
| from random import sample | |
| cards = filter( | |
| lambda _: all( | |
| [ | |
| # look at all unique values of each property and see if there is 1 or 3 | |
| len(set([a[i][1] for a in _])) in {1,3} for i in range(4) | |
| ] |
This file contains hidden or 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
| from __future__ import division | |
| from tqdm import * | |
| import chainer | |
| from chainer import functions as F | |
| from chainer import links as L | |
| import numpy as np |
This file contains hidden or 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
| library(pROC) | |
| df = read.csv("...") | |
| ## 75% of the sample size | |
| set.seed(123) | |
| smp_size <- floor(0.75 * nrow(df)) | |
| train_ind <- sample(seq_len(nrow(df)), size = smp_size) |
This file contains hidden or 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
| from chainer.links import caffe | |
| func = caffe.CaffeFunction("../bvlc_alexnet.caffemodel") | |
| # construct a correctly sized chainer variable | |
| x = chainer.Variable(...) | |
| # outputs is a list of layers to extract and it will return | |
| # each layer seperatly | |
| fc7, = func(inputs={"data":x}, outputs=["fc7"]) |
This file contains hidden or 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
| function [Q,R]=BandQR(A, p) | |
| [n,n]=size(A); | |
| R=A; %Start with R=A | |
| Q=eye(n); %Set Q as the identity matrix | |
| for k=1:n-1 | |
| x = zeros(p+1,1); | |
| j=min(n, k+p-1); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.