Skip to content

Instantly share code, notes, and snippets.

Yusuke Sugomori yusugomori

Block or report user

Report or block yusugomori

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yusugomori
yusugomori / Adabound.py
Last active Jun 17, 2019
AdaBound + AMSBound implementations with Keras
View Adabound.py
from keras.optimizers import Optimizer
from keras.legacy import interfaces
from keras import backend as K
import tensorflow as tf
class Adabound(Optimizer):
def __init__(self, lr=0.001,
beta_1=0.9, beta_2=0.999,
gamma=0.001,
View transformer.py
import os
import subprocess
import random
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optimizers
from torch.autograd import Variable
View main.js
const seedrandom = require('seedrandom');
const print = require('./utils').print;
const math = require('./math');
const LSTM = require('./lstm');
let rng = seedrandom(1234);
function main() {
const TRAIN_NUM = 30; // time sequence
const TEST_NUM = 10;
View lstm.js
const math = require('./math');
class LSTM {
constructor(nIn, nHidden, nOut, learningRate, activation = math.fn.tanh, rng = Math.random) {
this.nIn = nIn;
this.nHidden = nHidden;
this.nOut = nOut;
this.learningRate = learningRate;
this.activation = activation;
View main.js
const print = require('./utils').print;
const math = require('./math');
const seedrandom = require('seedrandom');
const RNN = require('./rnn');
let rng = seedrandom(1234);
function main() {
View rnn.js
const math = require('./math');
class RNN {
constructor(nIn, nHidden, nOut, truncatedTime = 3, learningRate = 0.1, activation = math.fn.tanh, rng = Math.random) {
this.nIn = nIn;
this.nHidden = nHidden;
this.nOut = nOut;
this.truncatedTime = truncatedTime;
this.learningRate = learningRate;
this.activation = activation;
View Dropout.java
package DeepLearning;
import java.util.Random;
import java.util.List;
import java.util.ArrayList;
public class Dropout {
public int N;
public int n_in;
public int[] hidden_layer_sizes;
View HiddenLayer.java
package DeepLearning;
import java.util.Random;
import java.util.function.DoubleFunction;
import static DeepLearning.utils.*;
public class HiddenLayer {
public int N;
public int n_in;
public int n_out;
@yusugomori
yusugomori / LogisticRegression.java
Created Aug 26, 2015
simple logistic regression
View LogisticRegression.java
package DeepLearning;
public class LogisticRegression {
public int N;
public int n_in;
public int n_out;
public double[][] W;
public double[] b;
public LogisticRegression(int N, int n_in, int n_out) {
View utils.java
package DeepLearning;
import java.util.Random;
public class utils {
public static double uniform(double min, double max, Random rng) {
return rng.nextDouble() * (max - min) + min;
}
public static int binomial(int n, double p, Random rng) {
You can’t perform that action at this time.