機械学習・自然言語処理の勉強メモ

学んだことのメモやまとめ

2017-11-21から1日間の記事一覧

Pandasで結合

使い方のメモ df = pd.DataFrame(np.random.randn(50,2),columns = list("AB")) c1 = df[(df['A'] > 0.5)&(df['B'] > 0.5)] c2 = df[(df['A'] < 0)&(df['B'] < 0)] x = pd.concat([c1, c2], ignore_index=True) A B 0 1.471791 1.663181 1 1.484363 1.313088…

Pandasで行・列抽出

使い方のメモ。3 行目を取得 df.iloc[3] A 0.168538 B 1.550001 C 1.002619 D 0.518160 Name: 2013-01-04 00:00:00, dtype: float64 1,2,4 行目と 0-2 列目を取得 df.iloc[[1,2,4],[0,2]] A C 2013-01-02 0.496579 0.745850 2013-01-03 -0.220238 0.405202 2…

TheanoでRNN②

RNNの続きkento1109.hatenablog.com前回で、elman.pyの__init__部をまとめた。 今回は、elman-forward.pyのRNNインスタンス生成後のコードを呼んでいく。前回の内容で rnn = model(nh = s['nhidden'], nc = nclasses, ne = vocsize, de = s['emb_dimension']…

TheanoでRNN①

下記のdocumentationについて整理する。Recurrent Neural Networks with Word Embeddings — DeepLearning 0.1 documentation タスクについて assigning a label to each word given a sentence. It’s a classification task. とある通り、文章の各単語のタグ…

Pandasでcsvを扱う

Pandasでcsvを扱う場合のメモ。 Read import pandas as pd df = pd.read_csv('D:\python\data\wine.data') print df # show all column test_df = pd.read_csv('test.csv', header=None, skiprows=1, names=['番号', '数学','英語']) #ヘッダがない場合はhea…