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
raise ValueError("DEPRECATED/FROZEN - see https://github.com/kastnerkyle/tools for the latest") | |
# License: BSD 3-clause | |
# Authors: Kyle Kastner | |
# Harvest, Cheaptrick, D4C, WORLD routines based on MATLAB code from M. Morise | |
# http://ml.cs.yamanashi.ac.jp/world/english/ | |
# MGC code based on r9y9 (Ryuichi Yamamoto) MelGeneralizedCepstrums.jl | |
# Pieces also adapted from SPTK | |
from __future__ import division | |
import numpy as np |
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
# Based on example here https://trac.ffmpeg.org/wiki/Encode/YouTube | |
text=$(basename $1 .wav) | |
ffmpeg -i $1 -filter_complex \ | |
"[0:a]avectorscope=s=640x518,pad=1280:720[vs]; \ | |
[0:a]showspectrum=mode=separate:color=intensity:scale=cbrt:s=640x518[ss]; \ | |
[0:a]showwaves=s=1280x202:mode=line[sw]; \ | |
[vs][ss]overlay=w[bg]; \ | |
[bg][sw]overlay=0:H-h,drawtext=fontfile=/usr/share/fonts/truetype/fonts-japanese-gothic.ttf:fontcolor=white:x=10:y=10:text=$text[out]" \ | |
-map "[out]" -map 0:a -c:v libx264 -preset fast -crf 18 -c:a copy $text.mkv |
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
# Author: Kyle Kastner | |
# License: BSD 3-clause | |
# THEANO_FLAGS="optimizer=None,compute_test_value=raise" python tanh_rnn.py | |
import numpy as np | |
import theano | |
import theano.tensor as T | |
from scipy import linalg | |
class sgd(object): |
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
# Author: Kyle Kastner | |
# License: BSD 3-Clause | |
# Inspired from blogpost by Justin Sermeno https://justinsermeno.com/posts/cfr/ | |
# Extended with algorithms described by Oskari Tammelin http://jeskola.net/cfr/demo/ by | |
# Particularly, solve has core game logic | |
# http://jeskola.net/cfr/demo/solve.js | |
# basecfr: http://poker.cs.ualberta.ca/publications/NIPS07-cfr.pdf | |
# cfrplus: https://arxiv.org/abs/1407.5042 |
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
# Author: Kyle Kastner | |
# License: BSD 3-Clause | |
# Implementing http://mnemstudio.org/path-finding-q-learning-tutorial.htm | |
# Q-learning formula from http://sarvagyavaish.github.io/FlappyBirdRL/ | |
# Visualization based on code from Gael Varoquaux gael.varoquaux@normalesup.org | |
# http://scikit-learn.org/stable/auto_examples/applications/plot_stock_market.html | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.collections import LineCollection |
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 gzip | |
def gzip_search(query: str, candidate_chunks: list[str], top_k: int=1): | |
""" | |
文字列ベースで類似したテキストチャンクを推定するアルゴリズム. | |
`query`, `chunk`, および`query + " " + chunk`をそれぞれgzipで圧縮し、編集距離のようなものをベースに評価する. | |
Parameters: | |
query (str): 検索クエリとして使用する文字列. | |
top_k (int, optional): 返される類似チャンクの上位k個を指定する (default: 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
# (C) Kyle Kastner, June 2014 | |
# License: BSD 3 clause | |
from sklearn.base import BaseEstimator, TransformerMixin | |
from sklearn.utils import gen_batches | |
from scipy.linalg import eigh | |
from scipy.linalg import svd | |
import numpy as np | |
# From sklearn master |
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
# Alec Radford, Indico, Kyle Kastner | |
# License: MIT | |
""" | |
Convolutional VAE in a single file. | |
Bringing in code from IndicoDataSolutions and Alec Radford (NewMu) | |
Additionally converted to use default conv2d interface instead of explicit cuDNN | |
""" | |
import theano | |
import theano.tensor as T | |
from theano.compat.python2x import OrderedDict |
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
# (C) Kyle Kastner, June 2014 | |
# License: BSD 3 clause | |
import scipy.stats as st | |
import numpy as np | |
class gmmhmm: | |
#This class converted with modifications from https://code.google.com/p/hmm-speech-recognition/source/browse/Word.m | |
def __init__(self, n_states): | |
self.n_states = n_states |
NewerOlder