teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

8

マジックコメントの追記

2018/10/23 10:34

投稿

yep
yep

スコア45

title CHANGED
File without changes
body CHANGED
@@ -55,6 +55,7 @@
55
55
  ```
56
56
  が同じコードで違うエラーがでます。
57
57
  ```python
58
+ # -*- coding: utf-8 -*-
58
59
  from keras.layers import Input, Dense
59
60
  from keras.layers.core import Activation
60
61
  from keras.models import Model

7

開発環境を記述

2018/10/23 10:34

投稿

yep
yep

スコア45

title CHANGED
File without changes
body CHANGED
@@ -143,7 +143,7 @@
143
143
  autoencoder.fit(X_embedded,X_embedded,epochs=10,
144
144
  batch_size=256, validation_split=.1)
145
145
  ```
146
- poem.txtは、俳句を29000件集め、MeCabで形態素解析しております。
146
+ C:\Users\yudai\Desktop\poem.txtは、webから俳句を29000件集め、MeCabで形態素解析しております。
147
147
  例:
148
148
  朝霧 の 中 に 九段 の ともし 哉
149
149
  あたたか な 雨 が 降る なり 枯葎
@@ -153,4 +153,11 @@
153
153
  若鮎 の 二 手 に なりて 上り けり
154
154
  行く 秋 を す つく と 鹿 の 立ち に けり
155
155
  我 声 の 風 に なり けり 茸狩
156
- 毎年 よ 彼岸の入り に 寒い の は
156
+ 毎年 よ 彼岸の入り に 寒い の は
157
+
158
+ #環境
159
+ Windows 10
160
+
161
+ python 3.7.0
162
+ tensorflow-gpu 1.9.0
163
+ keras 2.2.4

6

内容の修正

2018/10/23 09:19

投稿

yep
yep

スコア45

title CHANGED
File without changes
body CHANGED
@@ -142,4 +142,15 @@
142
142
  X_embedded = model.predict(X_train)
143
143
  autoencoder.fit(X_embedded,X_embedded,epochs=10,
144
144
  batch_size=256, validation_split=.1)
145
- ```
145
+ ```
146
+ poem.txtは、俳句を29000件集め、MeCabで形態素解析しております。
147
+ 例:
148
+ 朝霧 の 中 に 九段 の ともし 哉
149
+ あたたか な 雨 が 降る なり 枯葎
150
+ 菜の花 や は つと 明るき 町 は づれ
151
+ 秋風 や 伊予 へ 流る る 汐 の 音
152
+ 長閑 さ や 障子 の 穴 に 海 見え て
153
+ 若鮎 の 二 手 に なりて 上り けり
154
+ 行く 秋 を す つく と 鹿 の 立ち に けり
155
+ 我 声 の 風 に なり けり 茸狩
156
+ 毎年 よ 彼岸の入り に 寒い の は

5

文法訂正

2018/10/23 09:11

投稿

yep
yep

スコア45

title CHANGED
File without changes
body CHANGED
@@ -19,6 +19,7 @@
19
19
  何卒、ご教授宜しくお願い致します。
20
20
  [スタックオーバーフロー](https://ja.stackoverflow.com/questions/49528/keras%E3%81%A7list-index-out-of-range%E3%81%8C%E3%81%A7%E3%81%BE%E3%81%99)でも質問しています。
21
21
  マルチポストです。すみません。
22
+
22
23
  追記:
23
24
  [https://github.com/keras-team/keras/issues/7602](https://github.com/keras-team/keras/issues/7602)
24
25
  より
@@ -33,6 +34,9 @@
33
34
  しかし、同じエラーが出ます。
34
35
 
35
36
  違うWindows 10のPCでは、
37
+ python 3.6.5
38
+ tensorflow 1.8.0
39
+ keras 2.1.5
36
40
  ```
37
41
  C:\Users\hoge\Desktop\keras_AE.py:62: UserWarning: Update your Model call to the Keras 2 API: Model(inputs=Tensor("in..., outputs=Tensor("de...)
38
42
  autoencoder = Model(input=input_word, output=decoded)

4

文法訂正

2018/10/23 08:15

投稿

yep
yep

スコア45

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,7 @@
1
- 何度もすみません。
2
- 文章を学習する単純なautoencoderを書こうと試みています。
1
+ 文章を学習するdeep autoencoderを書こうと試みています。
3
2
  しかし、
3
+
4
+ ```
4
5
  C:\Users\yudai\Desktop\keras_AE.py:62: UserWarning: Update your `Model` call to the Keras 2 API: `Model(inputs=Tensor("in..., outputs=Tensor("de...)`
5
6
  autoencoder = Model(input=input_word, output=decoded)
6
7
  Traceback (most recent call last):
@@ -11,19 +12,28 @@
11
12
  File "C:\Users\yudai\Anaconda3\envs\pyMLgpu\lib\site-packages\keras\engine\training_arrays.py", line 139, in fit_loop
12
13
  if issparse(ins[i]) and not K.is_sparse(feed[i]):
13
14
  IndexError: list index out of range
15
+ ```
16
+
14
17
  と出力されます。
15
18
  もし原因がわかる方がいらっしゃるならば、
16
19
  何卒、ご教授宜しくお願い致します。
17
-
20
+ [スタックオーバーフロー](https://ja.stackoverflow.com/questions/49528/keras%E3%81%A7list-index-out-of-range%E3%81%8C%E3%81%A7%E3%81%BE%E3%81%99)でも質問しています。
21
+ マルチポストです。すみません。
18
22
  追記:
19
- https://github.com/keras-team/keras/issues/7602より
23
+ [https://github.com/keras-team/keras/issues/7602](https://github.com/keras-team/keras/issues/7602)
24
+ より
25
+ ```
20
26
  autoencoder = Model(input=input_word, output=decoded)
27
+ ```
21
28
 
29
+ ```
22
30
  autoencoder = Model(inputs=input_word, output=decoded)
31
+ ```
23
32
  に直しました。
24
33
  しかし、同じエラーが出ます。
25
34
 
26
35
  違うWindows 10のPCでは、
36
+ ```
27
37
  C:\Users\hoge\Desktop\keras_AE.py:62: UserWarning: Update your Model call to the Keras 2 API: Model(inputs=Tensor("in..., outputs=Tensor("de...)
28
38
  autoencoder = Model(input=input_word, output=decoded)
29
39
  Traceback (most recent call last):
@@ -38,11 +48,8 @@
38
48
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\keras\engine\training.py", line 540, in _standardize_weights
39
49
  return np.ones((y.shape[0],), dtype=K.floatx())
40
50
  AttributeError: 'NoneType' object has no attribute 'shape'
51
+ ```
41
52
  が同じコードで違うエラーがでます。
42
-
43
- すみません。マルチポストをしてしまいました。
44
- https://ja.stackoverflow.com/questions/49528/keras%E3%81%A7list-index-out-of-range%E3%81%8C%E3%81%A7%E3%81%BE%E3%81%99
45
- 気を付けます。
46
53
  ```python
47
54
  from keras.layers import Input, Dense
48
55
  from keras.layers.core import Activation

3

タイトルの改善

2018/10/23 08:12

投稿

yep
yep

スコア45

title CHANGED
@@ -1,1 +1,1 @@
1
- kerasでlist index out of range
1
+ kerasで同じコードでIndexErrorとAttributeErrorがでます
body CHANGED
@@ -23,6 +23,23 @@
23
23
  に直しました。
24
24
  しかし、同じエラーが出ます。
25
25
 
26
+ 違うWindows 10のPCでは、
27
+ C:\Users\hoge\Desktop\keras_AE.py:62: UserWarning: Update your Model call to the Keras 2 API: Model(inputs=Tensor("in..., outputs=Tensor("de...)
28
+ autoencoder = Model(input=input_word, output=decoded)
29
+ Traceback (most recent call last):
30
+ File "C:\Users\hoge\Desktop\keras_AE.py", line 70, in
31
+ shuffle=False)
32
+ File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\keras\engine\training.py", line 1630, in fit
33
+ batch_size=batch_size)
34
+ File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\keras\engine\training.py", line 1487, in _standardize_user_data
35
+ in zip(y, sample_weights, class_weights, self._feed_sample_weight_modes)]
36
+ File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\keras\engine\training.py", line 1486, in
37
+ for (ref, sw, cw, mode)
38
+ File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\keras\engine\training.py", line 540, in _standardize_weights
39
+ return np.ones((y.shape[0],), dtype=K.floatx())
40
+ AttributeError: 'NoneType' object has no attribute 'shape'
41
+ が同じコードで違うエラーがでます。
42
+
26
43
  すみません。マルチポストをしてしまいました。
27
44
  https://ja.stackoverflow.com/questions/49528/keras%E3%81%A7list-index-out-of-range%E3%81%8C%E3%81%A7%E3%81%BE%E3%81%99
28
45
  気を付けます。

2

マルチポストの謝罪

2018/10/23 06:31

投稿

yep
yep

スコア45

title CHANGED
File without changes
body CHANGED
@@ -23,6 +23,9 @@
23
23
  に直しました。
24
24
  しかし、同じエラーが出ます。
25
25
 
26
+ すみません。マルチポストをしてしまいました。
27
+ https://ja.stackoverflow.com/questions/49528/keras%E3%81%A7list-index-out-of-range%E3%81%8C%E3%81%A7%E3%81%BE%E3%81%99
28
+ 気を付けます。
26
29
  ```python
27
30
  from keras.layers import Input, Dense
28
31
  from keras.layers.core import Activation

1

追記

2018/10/23 00:59

投稿

yep
yep

スコア45

title CHANGED
File without changes
body CHANGED
@@ -12,9 +12,17 @@
12
12
  if issparse(ins[i]) and not K.is_sparse(feed[i]):
13
13
  IndexError: list index out of range
14
14
  と出力されます。
15
- もし原因がわかる方やもとこういいのにというご意見がある方は、
15
+ もし原因がわかる方がいらっしゃるな
16
16
  何卒、ご教授宜しくお願い致します。
17
17
 
18
+ 追記:
19
+ https://github.com/keras-team/keras/issues/7602より
20
+ autoencoder = Model(input=input_word, output=decoded)
21
+
22
+ autoencoder = Model(inputs=input_word, output=decoded)
23
+ に直しました。
24
+ しかし、同じエラーが出ます。
25
+
18
26
  ```python
19
27
  from keras.layers import Input, Dense
20
28
  from keras.layers.core import Activation