Keywords: Java, JDK (Java Development Kit), MacOS, Homebrew, Specific Version
This how-to guide covers how to install different versions of the JDK on MacOS with Homebrew.
Keywords: Java, JDK (Java Development Kit), MacOS, Homebrew, Specific Version
This how-to guide covers how to install different versions of the JDK on MacOS with Homebrew.
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
# My take on Mike's source_for method. | |
# (see http://pragmaticstudio.com/blog/2013/2/13/view-source-ruby-methods) | |
# | |
# (1) I named it 'src' rather than source_for (ok, I'm a lazy typer). | |
# (2) The edit function was broken out as a separate function. | |
# (3) The edit function is for emacs | |
# (4) If the method is not defined on the object, and the object | |
# is a class, then see if it is an instance method on the class. | |
# | |
# The fourth point allows my to say: |
import hashlib, struct, codecs | |
ver = 2 | |
prev_block = "000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717" | |
mrkl_root = "871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a" | |
time_ = 0x53058b35 # 2014-02-20 04:57:25 | |
bits = 0x19015f53 | |
# https://en.bitcoin.it/wiki/Difficulty | |
exp = bits >> 24 |
import hashlib, struct | |
ver = 2 | |
prev_block = "000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717" | |
mrkl_root = "871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a" | |
time_ = 0x53058b35 # 2014-02-20 04:57:25 | |
bits = 0x19015f53 | |
# https://en.bitcoin.it/wiki/Difficulty | |
exp = bits >> 24 |
Picking the right architecture = Picking the right battles + Managing trade-offs
import math | |
import random | |
import pickle | |
import os | |
class NeuralNetwork(): | |
def __init__(self): | |
# Seed the random number generator, so we get the same random numbers each time | |
random.seed(1) |
from numpy import exp, array, random, dot | |
class NeuralNetwork(): | |
def __init__(self): | |
# Seed the random number generator, so it generates the same numbers | |
# every time the program runs. | |
random.seed(1) | |
# We model a single neuron, with 3 input connections and 1 output connection. |
from numpy import exp, array, random, dot | |
training_set_inputs = array([[0, 0, 1], [1, 1, 1], [1, 0, 1], [0, 1, 1]]) | |
training_set_outputs = array([[0, 1, 1, 0]]).T | |
random.seed(1) | |
synaptic_weights = 2 * random.random((3, 1)) - 1 | |
for iteration in xrange(10000): | |
output = 1 / (1 + exp(-(dot(training_set_inputs, synaptic_weights)))) | |
synaptic_weights += dot(training_set_inputs.T, (training_set_outputs - output) * output * (1 - output)) | |
print 1 / (1 + exp(-(dot(array([1, 0, 0]), synaptic_weights)))) |
class NeuralNetwork: | |
def __init__(self, x, y): | |
self.input = x | |
self.weights1 = np.random.rand(self.input.shape[1],4) | |
self.weights2 = np.random.rand(4,1) | |
self.y = y | |
self.output = np.zeros(self.y.shape) | |
def feedforward(self): | |
self.layer1 = sigmoid(np.dot(self.input, self.weights1)) |