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 numpy as np | |
from itertools import combinations | |
primes = [2, 2, 2, 5, 5, 7] | |
number = 1400 | |
assert np.prod(primes) == number # sanity check | |
observed_sets = set() | |
n_hips = 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
import random | |
n_start_milk_choc = 2 | |
n_start_black_choc = 8 | |
n_trials = 1000000 | |
n_milk_last = 0 | |
for _ in range(n_trials): | |
prev_pulled_choc = None |
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 numpy as np | |
n_rolls = 10000000 | |
n_sides = 20 | |
min_dice_value = 8 | |
rolls_1 = np.random.randint(n_sides, size=(n_rolls, 2)) + 1 | |
rolls_2 = np.random.randint(n_sides, size=(n_rolls, 2)) + 1 | |
print('-' * 30) |
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 numpy as np | |
n_rolls = 10000000 | |
n_sides = 20 | |
rolls_1 = np.random.randint(n_sides, size=(n_rolls, 2)) + 1 | |
rolls_2 = np.random.randint(n_sides, size=(n_rolls, 2)) + 1 | |
print('-' * 30) | |
print('advantage of disadvantages') |
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 numpy as np | |
import tensorflow as tf | |
np.random.seed(0) | |
w1 = np.random.random((3, 3, 1, 100)) | |
w2 = np.random.random((3, 3, 1, 100)) | |
x1 = np.random.random((1, 256, 256, 1)) | |
x2 = np.random.random((1, 256, 256, 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
from collections import namedtuple | |
def flatten_tuples(values): | |
for value in values: | |
if isinstance(value, tuple): | |
for inner_value in flatten_tuples(value): | |
yield inner_value | |
else: | |
yield value |
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
(defn replace-values | |
[array current-value new-value] | |
(assoc array (.indexOf array current-value) new-value)) | |
(defn swap-balls-in-boxes | |
[box-a box-b] | |
(let [random-ball-a (rand-nth box-a) | |
random-ball-b (rand-nth box-b)] | |
[(replace-values box-a random-ball-a random-ball-b) | |
(replace-values box-b random-ball-b random-ball-a)])) |
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 theano | |
import theano.tensor as T | |
import numpy as np | |
def asfloat(value): | |
""" Convert variable to float type configured by theano | |
floatX variable. | |
Parameters |
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 numpy as np | |
def as_array2d(array): | |
""" | |
Transform any array to 2D. | |
Parameters | |
---------- | |
array : array-like |
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
/*<?php | |
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s", | |
//\u000A\u002F\u002A | |
class PhpJava { | |
static function main() { | |
echo(//\u000A\u002A\u002F | |
"Hello World!"); | |
}} | |
//\u000A\u002F\u002A | |
PhpJava::main(); |
NewerOlder