Skip to content

Instantly share code, notes, and snippets.

View xiangze's full-sized avatar

xiangze xiangze

View GitHub Profile
@brendano
brendano / gist:39760
Created December 24, 2008 20:11
load the MNIST data set in R
# Load the MNIST digit recognition dataset into R
# http://yann.lecun.com/exdb/mnist/
# assume you have all 4 files and gunzip'd them
# creates train$n, train$x, train$y and test$n, test$x, test$y
# e.g. train$x is a 60000 x 784 matrix, each row is one digit (28x28)
# call: show_digit(train$x[5,]) to see a digit.
# brendan o'connor - gist.github.com/39760 - anyall.org
load_mnist <- function() {
load_image_file <- function(filename) {
@keijiro
keijiro / about.md
Last active December 11, 2017 11:28
About Me

About Me

Photo

高橋 啓治郎 - 1977年生まれ

コンシューマーゲーム業界にて10年間の開発経験を持つゲームプログラマーです。ゲームプログラミング全般に経験を持ち、中でもグラフィックスプログラミング、AIプログラミングを得意としています。

現在は iPhone/iPad アプリの開発を主軸に置きつつ、技術書への寄稿や、ゲーム開発のコンサルティングなどを手がけています。

from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
import numpy as np
iris = load_iris()
df = pd.DataFrame(iris.data, columns=iris.feature_names)
df['is_train'] = np.random.uniform(0, 1, len(df)) <= .75
df['species'] = pd.Factor(iris.target, iris.target_names)
df.head()
@chiral
chiral / prediction1.R
Last active October 31, 2016 09:58
sample program for category data analysis, made for a challenge in Kaggle.
library(dplyr)
library(ggplot2)
library(reshape2)
train <- read.csv("train.csv")
#test <- read.csv("test_v2.csv")
az <- train %.%
filter(record_type==1) %.%
select(A:G)
@rezoo
rezoo / caffe.md
Last active November 4, 2021 15:28

Caffe tutorial

この文章ではCNN実装であるCaffeを用いて,特徴ベクトルの抽出やパラメータの学習を行うための方法について説明する.

Caffeでサポートされている機能

以下の作業を行いたいのであれば,Caffeを用いることが望ましい.

  • CNNを利用した画像の多クラス分類
  • CNNによる特徴ベクトルの抽出
  • CNNの転移学習
  • Stacked Auto Encoder
@danstowell
danstowell / data_for_nmf.data.R
Last active May 18, 2020 14:15
Implementations of non-negative matrix factorisation (NMF) in Stan
N <- 15
M <- 12
K <- 3
Wconc <- 100
Hconc <- 5
Winit <- structure(c(.056,.111,.056,.111,.056,.111,.056,.111,.056,.111,.056,.111,.111,.056,.111,.056,.111,.056,.111,.056,.111,.056,.111,.056,.063,.063,.125,.063,.063,.125,.063,.063,.125,.063,.063,.125
), .Dim=c(12,3))
X <- structure(c(.032,.032,.091,.032,.157,.264,.157,.139,.486,.257,.709,.934,.036,.036,.08,.036,.255,.192,.255,.1,.638,.171,1.228,.62,.039,.039,.226,.039,.119,.521,.119,.128,.809,.227,.475,1.537,.047,.047,.212,.047,.113,.589,.113,.242,.717,.458,.407,2.002,.02,.02,.058,.02,.07,.189,.07,.107,.251,.203,.293,.705,.033,.033,.062,.033,.128,.268,.128,.208,.325,.403,.549,1.142,.039,.039,.245,.039,.144,.516,.144,.081,.923,.128,.609,1.39,.05,.05,.189,.05,.326,.383,.326,.091,1.077,.136,1.55,1.024,.039,.039,.245,.039,.106,.548,.106,.112,.847,.194,.407,1.565,.023,.023,.134,.023,.072,.301,.072,.065,.486,.112,.291,.862,.04,.04,.145,.04,.205,.352,.205,.131,.726,.233,.938,1.107,.028,.028,.173,.028,.076,.397,.076,.093,.593,.164,.287,1.163,.028,.028,.058,.028,.14,.1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@twiecki
twiecki / bayesian_neural_network.ipynb
Last active February 22, 2022 01:28
Bayesian Neural Network in PyMC3
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.
@rajarsheem
rajarsheem / newton optimization.py
Created June 6, 2016 22:19
Newton's optimization method for multivariate function in tensorflow
import numpy as np
import tensorflow as tf
# Newton's optimization method for multivariate function in tensorflow
def cons(x):
return tf.constant(x, dtype=tf.float32)
def compute_hessian(fn, vars):
mat = []