Skip to content

Instantly share code, notes, and snippets.

View ShigekiKarita's full-sized avatar
🌴
I may be slow to respond.

Shigeki Karita ShigekiKarita

🌴
I may be slow to respond.
View GitHub Profile
@ShigekiKarita
ShigekiKarita / combinator.js
Last active August 29, 2015 14:05
不動点コンビネータ
"use strict";
// カリー化関数
const func = x => y => z => x + y + z;
func(1)(2)(3); // きもい
// 不動点コンビネータ
// 参考: http://mew.org/~kazu/material/2012-id-const.pdf
const y_con = f => (x => y => f(x(x))(y))
@ShigekiKarita
ShigekiKarita / TEST result
Last active November 15, 2021 23:28
Convolutional-Pooling Computing in OpenCL
[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from CNN
[ RUN ] CNN.PropConv
[ OK ] CNN.PropConv (59 ms)
[ RUN ] CNN.PropPool
[ OK ] CNN.PropPool (0 ms)
[ RUN ] CNN.PropPoolRandom
[ OK ] CNN.PropPoolRandom (4 ms)
[----------] 3 tests from CNN (63 ms total)
// just FAIL
TEST(CNN, TotalPooling)
{
const std::size_t pool = 2;
const std::size_t stride = 2;
const std::size_t input = 6; // NOTE: this means W_conv.rows(), output from convolution ply
const std::size_t output = (input / stride - pool + 1) * stride; // no overlap
const std::size_t batch = 2;
ASSERT_EQ(4, output);
@ShigekiKarita
ShigekiKarita / 21-haskell.el
Created October 10, 2014 07:03
setup haskell-mode
;; =======
;; Haskell
;; =======
(require 'auto-complete)
(require 'haskell-mode)
(require 'haskell-cabal)
(autoload 'ghc-init "ghc" nil t)
@ShigekiKarita
ShigekiKarita / pipes.d
Created November 1, 2014 10:14
妄想
import std.algorithm
auto deeper(T, U)(U[T][] records, U[][] maxElems)
{
// こういうのはこうかけるが
auto maxRec = records.map!values.reduce!max;
// こういうのはこうかくしか
auto nextRecords = maxElems
.map!(
@ShigekiKarita
ShigekiKarita / descision_tree.py
Created November 4, 2014 18:40
descision_tree.py
from math import log2
from csv import reader
from collections import Counter
from sys import argv
def transpose(xx):
return map(list, zip(*xx))
@ShigekiKarita
ShigekiKarita / matrix_util.hpp
Last active November 12, 2021 12:44
Eigen serialization
#ifndef matrix_utils_hpp
#define matrix_utils_hpp
#include <vector>
#include <array>
#include <type_traits>
#include <fstream>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp>
@ShigekiKarita
ShigekiKarita / CMakeLists.txt
Last active August 29, 2015 14:11
My CMake Project Template
cmake_minimum_required(VERSION 2.8.4)
project(MyCMakeTemplate)
## Configure compiler and libraries : Boost
add_compile_options(-std=c++1y -Wall -Wextra)
include_directories(${PROJECT_SOURCE_DIR}/include)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
@ShigekiKarita
ShigekiKarita / rnn_learner.py
Created February 2, 2015 11:23
Learning auto encoder with RNN
# built in
import random
# previous code
from sdr import to_sdr, to_real_number
# third library : https://github.com/pybrain/pybrain
from pybrain.structure import LinearLayer, SigmoidLayer, BiasUnit, FullConnection, RecurrentNetwork
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import BackpropTrainer
@ShigekiKarita
ShigekiKarita / cmk.sh
Created March 25, 2015 06:49
My CMake-CTest helper script
#!/usr/bin/env bash
# Functions
function usage {
this=$(basename ${0})
cat <<EOF
${this} is a tool for CMake and CTest
Usage:
${this} [command] [<options>]