- EZR
http://www.jichi.ac.jp/saitama-sct/SaitamaHP.files/statmed.html - Anaconda (Python3)
便利なライブラリがほぼ全部入りのPythonディストリビューション
https://www.continuum.io/downloads - Sublime Text
少し気の利いた、美しいテキストエディタです。
https://www.sublimetext.com/3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function matrix_plus(m1, m2) | |
' 行列同士の足し算 | |
ans = m1 ' 同じ大きさのオブジェクトを生成 | |
For i = 0 To UBound(m1) | |
For j = 0 To UBound(m1(0)) | |
ans(i)(j) = m1(i)(j) + m2(i)(j) | |
Next j | |
Next i | |
matrix_plus = ans | |
End Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function vector_plus(vect1, vect2) | |
' ベクトルの足し算 | |
ans = vect1 ' deep copy (たぶん、ディープコピー) | |
For i = 0 To UBound(ans) | |
ans(i) = vect1(i) + vect2(i) | |
Next i | |
vector_plus = ans | |
End Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function my_func(x) | |
' とある関数(数学)の計算結果を返す | |
my_func = 100 * x ^ 2 + 50 * x - 500 | |
End Function | |
Function diff(x, dx) | |
' 1階微分の結果を返す | |
diff = (my_func(x + dx) - my_func(x)) / dx | |
End Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
数値計算の計算結果を評価する | |
""" | |
def flatten(foo): | |
""" 多次元配列を1次元配列に変換する | |
""" | |
series = [] | |
for mem in foo: | |
if isinstance(mem, list): |
ここでは、機械学習の勉強会で使う環境の作り方について説明しています。 もしWindowsの作業途中でエラーが出てしまった場合はノート もご覧ください。
Pythonはバージョン3.6.xの64 bit版をインストールして下さい。
- Python本体:Python公式(rc版以外を推奨)または Anaconda
- テキストエディタ:Sublime Text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# purpose: 重回帰分析用のサンプルデータを自動的に作成する | |
# author: Katsuhiro Morishita | |
# created: 2017-05-18 | |
# license: MIT | |
import numpy as np | |
size = 5 # 説明変数の数 | |
def ndarray2str(val): | |
""" ndarray型の変数を文字列に変換する |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ビタビアルゴリズムに基づくデジタルデータの符号化・復号のサンプルコードである。 | |
# memo: 半端かもしれないが、クラス化した。 | |
# 現状ではストリームデータには対応していないが、拡張は簡単だと思う。 | |
# ref. http://www.mobile.ecei.tohoku.ac.jp/lecture/coding/coding_06.pdf | |
# author: Katsuhiro Morishita | |
# created: 2017-06-12 | |
# lisence: MIT | |
import copy | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# waveファイルを一定の時間毎に切断する | |
# author: Katsuhiro Morishita | |
# created: 2017-06-21 | |
# lisence: MIT | |
import glob | |
import wave | |
import os.path | |
term = 60.0 # 切断後のファイルの時間幅[s] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# purpose: 機械学習用のデータセットに含まれるラベルを整数に置換する | |
# author: Katsuhiro Morishita | |
# created: 2017-07-11 | |
# license: MIT | |
import sys | |
import pandas as pd | |
import math | |
import numpy as np |
OlderNewer