Skip to content

Instantly share code, notes, and snippets.

View unnonouno's full-sized avatar

Yuya Unno unnonouno

View GitHub Profile
@unnonouno
unnonouno / gist:e46d11c05fa59050326a
Created December 6, 2015 09:18
with py3.4, cython 0.22
$ python --version
Python 3.4.3
$ pip install chainer
Downloading/unpacking chainer
Downloading chainer-1.5.0.3.tar.gz (864kB): 864kB downloaded
Running setup.py (path:/tmp/pip_build_root/chainer/setup.py) egg_info for package chainer
Unable to find pgen, not compiling formal grammar.
warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests'
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
@unnonouno
unnonouno / adagrad_test.cpp
Last active August 29, 2015 14:03
AdaGrad with SSE
#include <sys/time.h>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <iostream>
#include <vector>
void ada_grad(
float eta,
@unnonouno
unnonouno / dot
Last active August 29, 2015 14:02
sse inner product
vmovss (%rax), %xmm1
vmulss (%rdx), %xmm1, %xmm1
vaddss %xmm1, %xmm0, %xmm0
addq $4, %rdx
addq $4, %rax
decq %rcx
jne LBB0_2
@unnonouno
unnonouno / gist:b482b9526ea4a6433d1d
Last active August 29, 2015 14:01
string_featureの変更点

今までのspiltterインターフェースでは、入力された文字列情報を分割し、その部分文字列を特徴情報として利用していた。この方法は、

  • 部分文字列以外の文字列情報を利用できない。そのため、例えば自然言語処理でよくあるような、原型に戻したりstemmingしたり、といった処理が行えない
  • 特徴の重みを任意に変えることができない。そのため、たとえば文書長のような特徴を利用できない

といった欠点があった。 そこで、2つの欠点を克服できるようなstring_featureインターフェースを作成した上で、従来のsplitterはstring_featureのサブクラスとして、自然に拡張できるようにした。従来のsplitterとsplit関数はそのまま残し、過去に作成された資源は再コンパイルによって利用できる。

string_featureは、入力された文字列に対して、特徴表現文字列とそのスコアのペアの集合を返す。これにより、上記の欠点は以下のように克服できる。

@unnonouno
unnonouno / gist:9603213
Created March 17, 2014 16:50
msgpack test
#include <map>
#include <iostream>
#include <msgpack.hpp>
int main() {
std::map<int, int> m;
msgpack::sbuffer sbuf;
msgpack::packer<msgpack::sbuffer> pk(&sbuf);
pk.pack(m);
@unnonouno
unnonouno / abstest.cpp
Created February 15, 2014 15:31
absはコワイ
#include <iostream>
#include <stdlib.h>
int main() {
double x = 1.0e+100;
double y = abs(x);
std::cout << x << ' ' << y << std::endl;
}
#include <iostream>
#include <msgpack.hpp>
struct T {
int a;
MSGPACK_DEFINE(a);
};
struct S {
@unnonouno
unnonouno / gist:6353602
Created August 27, 2013 13:37
jeneratorのインストール方法

jeneratorのインストール方法

opamのインストール

opamはOCamlのパッケージ管理ツール。

http://opam.ocamlpro.com/

@unnonouno
unnonouno / gist:5617024
Last active December 17, 2015 13:29
Jubatus Casula Talks #1 タイムスケジュール
13:00-13:15 @unnonouno 開会、諸注意
13:15-13:50 @unnonouno 機械学習チュートリアル
14:00-14:25 チームJubahiku
14:25-14:50 @katsyoshi
15:00-15:25 @komiya_atsushi
15:25-15:50 @07c00
16:00-16:25 @kumagi