この文章ではCNN実装であるCaffeを用いて,特徴ベクトルの抽出やパラメータの学習を行うための方法について説明する.
以下の作業を行いたいのであれば,Caffeを用いることが望ましい.
- CNNを利用した画像の多クラス分類
- CNNによる特徴ベクトルの抽出
- CNNの転移学習
- Stacked Auto Encoder
# -*- coding: utf-8 -*- | |
from gensim.models import word2vec | |
import MeCab | |
import random | |
model = word2vec.Word2Vec.load("oogiri_gensim.model") | |
tagger = MeCab.Tagger("-Ochasen") | |
def word_and_kind_parse(line): | |
line_word = line.split("\t") | |
if len(line_word) < 2: |
""" | |
This program compares ADAM vs AdaGrad. You can modify the function f and its gradient grad_f | |
in the code, run the two algorithms and compare their convergence. For the simple function | |
f(x1, x2) = (x1 - 2) ** 2 + (x1 + 3) ** 2, (alpha = 0.1 and tolerence 1e-3) | |
AdaGrad converged at 2023 iterations, whereas ADAM required only 83! | |
""" | |
import numpy | |
[alias] | |
grep-add = "!sh -c 'git ls-files -m -o --exclude-standard | grep $1 | xargs git add' -" | |
grep-add-patch = "!sh -c 'git add -p `git ls-files -m -o --exclude-standard | grep $1`' -" |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# This is a simplified implementation of the LSTM language model (by Graham Neubig) | |
# | |
# LSTM Neural Networks for Language Modeling | |
# Martin Sundermeyer, Ralf Schlüter, Hermann Ney | |
# InterSpeech 2012 | |
# | |
# The structure of the model is extremely simple. At every time step we |
package net.mekajiki; | |
import com.ibm.icu.text.Transliterator; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class Hiragana2Phoneme { | |
public static String hiragana2Phoneme(String text) { | |
return romaji2Phoneme(hiragana2Romaji(text)); | |
} |
// Copyright (c) 2013 Hiroyuki Tanaka | |
// Released under the MIT license | |
#include <stdint.h> | |
#include <cstdlib> | |
#include <cstring> | |
#include <string> | |
#include <map> | |
#include <vector> | |
#include <iostream> |
{ | |
"IAB1": "Arts & Entertainment", | |
"IAB1-1": "Books & Literature", | |
"IAB1-2": "Celebrity Fan/Gossip", | |
"IAB1-3": "Fine Art", | |
"IAB1-4": "Humor", | |
"IAB1-5": "Movies", | |
"IAB1-6": "Music", | |
"IAB1-7": "Television", | |
"IAB2": "Automotive", |
#A Collection of NLP notes
##N-grams
###Calculating unigram probabilities:
P( wi ) = count ( wi ) ) / count ( total number of words )
In english..
#! /usr/bin/env python | |
""" | |
Author: Jeremy M. Stober | |
Program: SOFTMAX.PY | |
Date: Wednesday, February 29 2012 | |
Description: Simple softmax function. | |
""" | |
import numpy as np | |
npa = np.array |