Skip to content

Instantly share code, notes, and snippets.

@sinhrks
sinhrks / .bash_profile
Last active January 8, 2017 05:24
Macbook設定
#.bashrcを読み込む
if [ -f ~/.bashrc ] ; then
. ~/.bashrc
fi
pub enum Option<T> {
    None,
    Some(T),
}
fn is_some(&self) -> bool 
fn is_none(&self) -> bool
@sinhrks
sinhrks / fortify_forecast.R
Created October 4, 2014 05:11
Allow ggplot2 to handle forecast result
library(forecast)
library(ggplot2)
d <- AirPassengers
d.arima <- forecast::auto.arima(d)
d.forecast <- forecast(d.arima, level = c(95), h = 50)
fortify.forecast <- function(forecast.data) {
require(dplyr)
forecasted <- as.data.frame(forecast.data)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / 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,
@sinhrks
sinhrks / tsplot_freq.ipynb
Last active October 19, 2015 14:33
pandas time-series plot frequency adjustment
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.