Skip to content

Instantly share code, notes, and snippets.

View Yevgnen's full-sized avatar
🔥

Yevgnen Yevgnen

🔥
View GitHub Profile
'''Test of stateful LSTM.
This trains a LSTM to convert a frequency-modulated signal to a sine wave.
The period of the signal is greater than the temporal dimension of the LSTM,
so in theory the stateful version should have an advantage.
'''
from __future__ import print_function
import os
os.environ['KERAS_BACKEND'] = 'tensorflow'
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@Integralist
Integralist / Python3 HTTP Server.py
Last active May 2, 2024 12:35
Python3 HTTP Server.py
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
HOST_NAME = 'localhost'
PORT_NUMBER = 9000
class MyHandler(BaseHTTPRequestHandler):
def do_HEAD(self):
self.send_response(200)
@barrachri
barrachri / proxy_server.py
Created November 9, 2016 10:44
Proxy Server with aiohttp
import logging
import sys
from urllib.parse import urljoin
import asyncio
import aiohttp
from aiohttp import web
TARGET_SERVER_BASE_URL = 'http://127.0.0.1:8888'
@akiross
akiross / Convolutional Arithmetic.ipynb
Last active October 24, 2024 07:04
Few experiments on how convolution and transposed convolution (deconvolution) should work in tensorflow.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bzamecnik
bzamecnik / lstm_with_softmax_keras.py
Created December 24, 2016 07:04
LSTM with softmax activation in Keras
"""
When classifying upon a sequence usually we stack some LSTM returning sequences,
then one LSTM returning a point, then Dense with softmax activation.
Is it possible instead to give the last non-sequential LSTM a softmax activation?
The answer is yes.
In this example we have 3 sequential layers and one layer producing the final result.
@taogashi
taogashi / How-to-use-cmake-externalproject.md
Created December 29, 2016 12:44
正确地使用ExternalProject_Add添加外部项目到本地cmake项目

官方文档
其中PREFIX决定了所有缺省的路径

TMP_DIR      = <prefix>/tmp
STAMP_DIR    = <prefix>/src/<name>-stamp
DOWNLOAD_DIR = <prefix>/src
SOURCE_DIR   = <prefix>/src/<name>
BINARY_DIR   = <prefix>/src/<name>-build
INSTALL_DIR  = <prefix>
@shagunsodhani
shagunsodhani / Addressing the Rare Word Problem in Neural Machine Translation.md
Created January 8, 2017 16:42
Summary of "Addressing the Rare Word Problem in Neural Machine Translation" Paper

Addressing the Rare Word Problem in Neural Machine Translation

Introduction

  • NMT(Neural Machine Translation) systems perform poorly with respect to OOV(out-of-vocabulary) words or rare words.
  • The paper presents a word-alignment based technique for translating such rare words.
  • Link to the paper

Technique

@tejaslodaya
tejaslodaya / apply_df_by_multiprocessing.py
Created February 3, 2017 09:12
pandas DataFrame apply multiprocessing
import multiprocessing
import pandas as pd
import numpy as np
def _apply_df(args):
df, func, num, kwargs = args
return num, df.apply(func, **kwargs)
def apply_by_multiprocessing(df,func,**kwargs):
workers=kwargs.pop('workers')
@t-vi
t-vi / validation_set_split.py
Last active August 18, 2017 16:08
Torch validation set split (MNIST example)
import torch.utils.data
from torchvision import datasets, transforms
class PartialDataset(torch.utils.data.Dataset):
def __init__(self, parent_ds, offset, length):
self.parent_ds = parent_ds
self.offset = offset
self.length = length
assert len(parent_ds)>=offset+length, Exception("Parent Dataset not long enough")
super(PartialDataset, self).__init__()