Skip to content

Instantly share code, notes, and snippets.

@sinhrks
sinhrks / plot_ore.py
Last active August 29, 2015 14:22
spyre sample
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# https://github.com/adamhajari/spyre
from spyre import server
import numpy as np
import pandas as pd
pd.options.display.mpl_style = 'default'
@sinhrks
sinhrks / plot.html
Last active August 29, 2015 14:22
Plotting with pandas plot method
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Untitled1</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
@sinhrks
sinhrks / multicol.html
Created March 29, 2015 09:34
expandas: Allow multiple target columns
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Notebook</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
@sinhrks
sinhrks / stockjp.py
Last active April 26, 2016 14:12
Retrieve Yahoo Japan Finance Info and Draw Candlestick Chart
# coding: utf-8
from __future__ import unicode_literals
import numpy as np
import pandas as pd
import pandas.io.data as web
import pandas.tools.plotting as plotting
def get_quote_yahoojp(code, start=None, end=None, interval='d'):
base = 'http://info.finance.yahoo.co.jp/history/?code={0}.T&{1}&{2}&tm={3}&p={4}'
@sinhrks
sinhrks / environment_setup.sh
Last active June 27, 2017 03:57
EC2 g2.xlarge with NVIDIA GRID Environment Setup
#!/bin/bash
# --------------------------------------------------------------------------------------
# Preparation
# To execute this script, please follow:
# wget https://gist.github.com/sinhrks/ba9876e7aa2a18a601f8/raw/environment_setup.sh
# chmod +x environment_setup.sh
# ./environment_setup.sh
# --------------------------------------------------------------------------------------
@sinhrks
sinhrks / hnn.py
Last active August 29, 2015 14:12
Hopfield Neural Networks
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division
import numpy as np
np.random.seed(1)
from matplotlib import pyplot as plt
import matplotlib.cm as cm
class HopfieldNetwork(object):
@sinhrks
sinhrks / MRF.py
Last active July 29, 2019 06:35
Markov Random Field
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import defaultdict
import numpy as np
np.random.seed(1)
import networkx as nx
class MRF(object):
@sinhrks
sinhrks / vis_dA.py
Created December 14, 2014 11:15
Animate Denoising AutoEncoder
# -*- coding: utf-8 -*-
"""
This code uses "dA" class defined in:
http://www.deeplearning.net/tutorial/dA.html
"""
import os
import numpy
import theano
@sinhrks
sinhrks / vis_ml2.py
Created November 30, 2014 08:40
Animate Multilayer Perceptron using 2D XOR Data
# -*- coding: utf-8 -*-
"""
This code uses "MLP" class defined in:
http://deeplearning.net/tutorial/mlp.html#tips-and-tricks-for-training-mlps
"""
import os
import sys
import time
@sinhrks
sinhrks / vis_mlp.py
Last active March 8, 2016 14:06
Visualize Multilayer Perceptron Example in deeplearning.net
"""
This code is used to visualize
http://deeplearning.net/tutorial/mlp.html#tips-and-tricks-for-training-mlps
Usage: put the following on 389th line
title = "whatever you want"
plot_pca(classifier, x, train_set_x, train_set_y, index=epoch, title=title)
"""
def plot_pca(classifier, x_symbol, x_data, y_data, index=0,