Skip to content

Instantly share code, notes, and snippets.

View stevenRush's full-sized avatar

Eltyshev Evgeny stevenRush

  • Moscow Institute of Physics and Technology
  • Moscow
View GitHub Profile
class DQNAgent:
def __init__(self, name):
with tf.variable_score(name):
self.conv1 = Conv2D(32, 8, (4, 4), padding="same", activation="relu")
self.pool1 = MaxPooling2D((2, 2))
self.conv2 = Conv2D(64, 4, (2, 2), padding="same", activation="relu")
self.pool2 = MaxPooling2D((2, 2))
self.conv3 = Conv2D(64, 3, (1, 1), padding="same", activation"relu")
train = pd.read_csv("train.csv")
test = pd.read_csv("test.csv")
train_size = train.shape[0]
# extract label column before concatenating train and test
labels = train["Survived"]
train.drop("Survived", axis=1, inplace=True)
# concat train and test
# Inception-v3, model from the paper:
# "Rethinking the Inception Architecture for Computer Vision"
# http://arxiv.org/abs/1512.00567
# Original source:
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/models/image/imagenet/classify_image.py
# License: http://www.apache.org/licenses/LICENSE-2.0
# Download pretrained weights from:
# https://s3.amazonaws.com/lasagne/recipes/pretrained/imagenet/inception_v3.pkl
from __future__ import division
import scipy.sparse as sp
from scipy.sparse.linalg import norm
def cosine_distance(vec1, vec2):
norm1 = norm(vec1)
norm2 = norm(vec2)
return vec1.multiply(vec2).sum() / (norm1 * norm2)
params = {}
params['objective'] = 'binary:logistic'
#params['objective'] = 'rank:pairwise'
#params['num_class'] = 3
params['eta'] = 0.2 # 0.02
params['numrounds'] = 150 # 1100
params['eval_metric'] = 'auc'
params['max_depth'] = 12 # 5
#params['subsample'] = 0.7
#params['colsample_bytree'] = .55 #.41 # .41
get_crossword = function(d)
{
for (var t = [],
G = d[0][0] % d[0][3] * (d[0][0] % d[0][3]) + 2 * (d[0][1] % d[0][3]) + d[0][2] % d[0][3],
m = d[1][0] % d[1][3] + d[1][1] % d[1][3] - d[1][2] % d[1][3],
k = d[2][0] % d[2][3] + d[2][1] % d[2][3] - d[2][2] % d[2][3],
ia = d[3][0] % d[3][3] + d[3][1] % d[3][3] - d[3][2] % d[3][3], ja = 0, y = [], x = [], H = 0, B = [], z = [], n = [], q = [], s = 0, ga = 0, F = !1, v = !1, I = -1, J = -1, L = 3, D = 1, C = 1, M = 5; M < ia + 5; M++) {
var ka = d[M][0] - d[4][1],
N = d[M][3] - ka - d[4][2];
t[M - 5] = [(ka + 256).toString(16).substring(1) + ((d[M][1] - d[4][0] + 256 << 8) + (d[M][2] - d[4][3])).toString(16).substring(1), N]
Инструкция по использованию: зайти в задание, скопировать выражение javascript: ... в адресную строку и нажать Enter
Внимание, браузер почему-то убирает "javascript:" из строки, поэтому нужно дописывать самому в ее начале
gap filler: Там, где нужно заполнять пропуски
javascript:for(var i = 0; i < I.length; ++i) { d = document.getElementById("Gap"+i); if (d !== null){d.value = I[i][1][0];}else{d = document.getElementById("Q_" + i + "_Guess"); d.value = I[i][3][0][0];}}
single answer: Там, где нужно выбрать один вариант из предложенных. Нажимаете кнопку "Show all questions" и применяете скрипт
javascript:for (var n = 0; n < I.length; ++n) {for (var i = 0; i < I[n][3].length; ++i) { if (I[n][3][i][3] === 100) document.getElementById('Q_' + n + '_' + i).style.fontWeight = 'bold' }} alert('Just choose bold answers!');
from __future__ import division
import os
import sys
import time
import math
import codecs
import glob
collection_name = 'mailru1'
@stevenRush
stevenRush / gist:3eabd3b957c67edfd1ee
Created May 29, 2014 18:56
Worst-case simplex method example generator
if __name__ == '__main__':
d = 18
c = [str(10**(d-i)) for i in range(1, d+1)]
a = []
b = []
for row in range(d):
a.append(['0'] * d)
for j in range(0, row):
@stevenRush
stevenRush / gist:420e5c8095ec59533d39
Created May 25, 2014 08:33
Permanent calcucator
from operator import mul
from math import fsum
from functools import reduce
from itertools import permutations, combinations
def prod(lst):
return reduce(mul, lst, 1)
def perm_sq(a):
n = len(a)