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
| import random | |
| import numpy as np | |
| def game(): | |
| total = 1 | |
| while True: | |
| if random.random() < 0.5: | |
| total += 1 | |
| else: | |
| break |
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
| 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])); |
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
| 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])); |
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 main | |
| import ( | |
| "fmt" | |
| "sync" | |
| "time" | |
| ) | |
| type Fetcher interface { | |
| // Fetch returns the body of URL and |