This file contains 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
#include <bits/stdc++.h> | |
using namespace std; | |
const long long MOD = 1000000007; | |
using ll = long long; | |
struct State{ | |
ll bit, c; | |
State(ll bit, ll c): bit(bit), c(c){} | |
bool operator<(const State& right ) const { | |
return c > right.c; |
This file contains 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
#include <iostream> | |
#include <cstring> | |
#include <memory> | |
using namespace std; | |
class A{ | |
public: | |
int field[10][10]; | |
A(){ |
This file contains 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
# Keras implementation of 'Deep Embedded Clustering.' | |
# https://arxiv.org/abs/1511.06335 | |
# This code doesn't work yet. | |
# There might be something wrong in the code of Stacked Auto-Encoder. | |
# Please let me know if you find any mistakes. | |
import numpy as np | |
np.random.seed(71) # for reproducibility |
This file contains 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 numpy as np | |
np.random.seed(71) | |
import matplotlib.pyplot as plt | |
import Image | |
from keras.models import Sequential | |
from keras.layers.core import Dense, Dropout, Activation | |
from keras.datasets import mnist | |
from keras.callbacks import Callback, EarlyStopping, ModelCheckpoint |
This file contains 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
#include <iostream> | |
#include <string> | |
using namespace std; | |
class CheckCopy { | |
public: | |
string str; | |
// constructor | |
CheckCopy(string astr){ | |
str = astr; |
This file contains 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 numpy as np | |
from keras.models import Sequential | |
from keras.layers.core import Dense, Activation | |
from keras.optimizers import SGD, RMSprop | |
import matplotlib.pyplot as plt | |
from pendulum import InvertedPendulum, video | |
seed = 123 | |
np.random.seed(seed) |
This file contains 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
# refered to https://searchcode.com/codesearch/view/34802371/ | |
def update_state(self): | |
for i in range(self.t_num): | |
costheta = np.cos(self.theta) | |
sintheta = np.sin(self.theta) | |
ml = self.m * self.l | |
total_mass = self.M + self.m | |
temp = (self.u + ml * self.theta_dot**2 * sintheta) / total_mass | |
thetaacc = ((self.g * sintheta - costheta * temp) / |
This file contains 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 numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
class InvertedPendulum(object): | |
actions = [0, 1, 2] | |
M = 8. | |
m = 2. | |
l = 0.5 |
This file contains 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 numpy as np | |
import matplotlib.pyplot as plt | |
from keras.models import Sequential | |
from keras.layers.core import Dense, Activation | |
from keras.optimizers import SGD, RMSprop | |
from keras import backend as K | |
def error(y_true, y_pred): | |
return K.sum(K.square(y_pred - y_true), axis=-1) |
This file contains 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 numpy as np | |
import chainer | |
from chainer import optimizers | |
import chainer.functions as F | |
import chainer.links as L | |
import matplotlib.pyplot as plt | |
class MLP(chainer.Chain): | |
def __init__(self): |