Skip to content

Instantly share code, notes, and snippets.

View codekansas's full-sized avatar
🏠
Working from home

Ben Bolte codekansas

🏠
Working from home
View GitHub Profile
@codekansas
codekansas / ballpark.py
Last active January 16, 2018 10:56
Adding noise to gradients as a regularizer
from keras.optimizers import SGD, Adagrad, RMSprop, Adadelta, Adam, Adamax
import keras.backend as K
DEFAULT_NOISE = 0.05
def ballpark_gradient(gradient, noise):
return [g * K.random_normal(shape=K.shape(g), mean=1.0, std=noise) for g in gradient]
@codekansas
codekansas / predictions.txt
Created August 5, 2016 06:48
Predictions after training with the Attention RNN model
[>....................]how compare home insurance
Predicted: ([ 0.39381921])in order to calculate your annual premium for home insurance it be necessary answer some basic question about the risk and obtain a quote basic characteristic of the home will include the year build , square footage , type of roof , foundation type , number of bathroom , style of home , prior claim and identify information of the owner you may obtain a quote and buy home insurance online use an online link in multiple state ; it may be use by escrow / closing professional , mortgage professional , real estate agent directly consumer an exemplary online experience for all WEBSITELINK
Expected: ([ 0.38000157])start by talk to your Insurance Professional it be important not only compare coverage offering and policy extension and limitation , but also the company that be offer this protection proposal and suggest coverage shall be base upon the result of a careful Reconstruction Analysis which will determine the amount of recommend covera
// reference: http://codeforces.com/contest/697/problem/C
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Codeforces697ProblemC {
public static void main(String... args) {
Scanner s = new Scanner(System.in);
class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
@codekansas
codekansas / keras_gensim_embeddings.py
Last active July 23, 2018 09:17
Using Word2Vec embeddings in Keras models
from __future__ import print_function
import json
import os
import numpy as np
from gensim.models import Word2Vec
from gensim.utils import simple_preprocess
from keras.engine import Input
from keras.layers import Embedding, merge
from __future__ import print_function
import theano
import theano.tensor as T
import numpy as np
import time
X = theano.shared(value=np.asarray([[0, 1], [1, 0], [0, 0], [1, 1]]), name='X')
y = theano.shared(value=np.asarray([[0], [0], [1], [1]]), name='y')
rng = np.random.RandomState(1234)
@codekansas
codekansas / wireworld.py
Last active July 7, 2016 09:20
My implementation of Wireworld in Python
from __future__ import print_function
from time import sleep
import os
type_to_rep = {
'empty': '.',
'head': 'H',
'tail': 'T',
'conductor': '=',