duplicates = multiple editions
A Classical Introduction to Modern Number Theory,Kenneth IrelandMichael Rosen
A Classical Introduction to Modern Number Theory,Kenneth IrelandMichael Rosen
package transactions | |
import com.twitter.finagle.exp.mysql.{Client, OK, Result} | |
class Db(mysqlClient: Client) { | |
val insertOrder = "INSERT INTO orders (ref) VALUES(?)" | |
val insertOrderItem = "INSERT INTO order_items (order_id, item_id) VALUES(?, ?)" | |
def persistOrderWithItems[T](order: Order)(whenDone: (OK, Seq[Result]) => T): Future[T] = { |
package lib | |
import fly.play.s3._ | |
import java.io.OutputStream | |
import scala.concurrent.Future | |
import scala.concurrent.Await | |
import scala.concurrent.duration.Duration | |
import play.api.http.ContentTypeOf | |
import play.api.libs.concurrent.Execution.Implicits.defaultContext | |
import play.api.libs.concurrent.Akka |
import math | |
import random | |
def get_random_neighbour(state): | |
neighbour = [house[:] for house in state] # Deep copy | |
i = random.randint(0, 4) | |
j = random.choice(range(0, i) + range(i+1, 4)) | |
attr_idx = random.randint(0, 4) |
""" | |
Possibly correct implementation of an all conv neural network using a single residual module | |
This code was written for instruction purposes and no attempt to get the best results were made. | |
References: | |
Deep Residual Learning for Image Recognition: http://arxiv.org/pdf/1512.03385v1.pdf | |
STRIVING FOR SIMPLICITY, THE ALL CONVOLUTIONAL NET: http://arxiv.org/pdf/1412.6806v3.pdf | |
A video walking through the code and main ideas: https://youtu.be/-N_zlfKo4Ec |
# Time Series Testing | |
import keras.callbacks | |
from keras.models import Sequential | |
from keras.layers.core import Dense, Activation, Dense, Dropout | |
from keras.layers.recurrent import LSTM | |
# Call back to capture losses | |
class LossHistory(keras.callbacks.Callback): | |
def on_train_begin(self, logs={}): | |
self.losses = [] |