Skip to content

Instantly share code, notes, and snippets.

View reiinakano's full-sized avatar

Reiichiro Nakano reiinakano

View GitHub Profile
@reiinakano
reiinakano / main.py
Created October 14, 2020 10:56
st petersburg paradox
import random
import numpy as np
def game():
total = 1
while True:
if random.random() < 0.5:
total += 1
else:
break
const hiddenNumNeurons = 20;
const hidden2NumNeurons = 5;
const learningRate = 0.01;
const num_iterations = 200;
const batch_size = 20;
const weights = dl.variable(dl.randomNormal([2, hiddenNumNeurons]));
const biases = dl.variable(dl.zeros([hiddenNumNeurons]));
const weights2 = dl.variable(dl.randomNormal([hiddenNumNeurons, hidden2NumNeurons]));
@reiinakano
reiinakano / dljs_xor.js
Last active March 19, 2018 16:46
dljs xor
const hiddenNumNeurons = 20;
const hidden2NumNeurons = 5;
const weights = dl.variable(dl.randomNormal([2, hiddenNumNeurons]));
const biases = dl.variable(dl.zeros([hiddenNumNeurons]));
const weights2 = dl.variable(dl.randomNormal([hiddenNumNeurons, hidden2NumNeurons]));
const biases2 = dl.variable(dl.zeros([hidden2NumNeurons]));
const outWeights = dl.variable(dl.randomNormal([hidden2NumNeurons, 1]));
const outBias = dl.variable(dl.zeros([1]));
@reiinakano
reiinakano / exercise-web-crawler.go
Last active December 10, 2017 12:37
Quick solution to A Tour of Go Web Crawler Exercise https://tour.golang.org/concurrency/10
package main
import (
"fmt"
"sync"
"time"
)
type Fetcher interface {
// Fetch returns the body of URL and