質問編集履歴
4
エラー文を見やすく
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
|
18
18
|
エラー文:
|
19
19
|
Exception in main training loop: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 150 and the array at index 14 has size 149
|
20
|
+
|
20
21
|
Traceback (most recent call last):
|
21
22
|
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/trainer.py", line 319, in run
|
22
23
|
entry.extension(self)
|
@@ -34,6 +35,9 @@
|
|
34
35
|
[array[None] for array in arrays])
|
35
36
|
File "<__array_function__ internals>", line 6, in concatenate
|
36
37
|
Will finalize trainer extensions and updater before reraising the exception.
|
38
|
+
|
39
|
+
####trainer.run()で学習を行う際に入力ベクトルの次元数が揃っていないため学習が行えないというエラー####
|
40
|
+
|
37
41
|
Traceback (most recent call last):
|
38
42
|
File "train_review.py", line 171, in <module>
|
39
43
|
trainer.run()
|
@@ -56,8 +60,11 @@
|
|
56
60
|
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 254, in _concat_arrays
|
57
61
|
[array[None] for array in arrays])
|
58
62
|
File "<__array_function__ internals>", line 6, in concatenate
|
63
|
+
|
64
|
+
|
59
65
|
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 150 and the array at index 14 has size 149
|
60
66
|
|
67
|
+
|
61
68
|
↑のように所々149次元(データセットは全6539件)になったりして次元数が揃ってないことによって学習ができなくなっています。
|
62
69
|
|
63
70
|
```python
|
3
エラー文の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,14 +10,56 @@
|
|
10
10
|
↓
|
11
11
|
bag of wordsでベクトル化
|
12
12
|
↓
|
13
|
-
LSIを用いて次元削減 ←ここで次元数の指定がうまくいかない
|
13
|
+
LSIを用いて150次元に削減 ←ここで次元数の指定がうまくいかない
|
14
14
|
↓
|
15
15
|
学習・推定
|
16
16
|
|
17
17
|
|
18
18
|
エラー文:
|
19
|
+
Exception in main training loop: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 150 and the array at index 14 has size 149
|
20
|
+
Traceback (most recent call last):
|
21
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/trainer.py", line 319, in run
|
22
|
+
entry.extension(self)
|
23
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/extensions/evaluator.py", line 161, in __call__
|
24
|
+
result = self.evaluate()
|
25
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/extensions/evaluator.py", line 216, in evaluate
|
26
|
+
self.converter, batch, self.device)
|
27
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 73, in _call_converter
|
28
|
+
return converter(batch, device)
|
29
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 58, in wrap_call
|
30
|
+
return func(*args, **kwargs)
|
31
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 223, in concat_examples
|
32
|
+
[example[i] for example in batch], padding[i])))
|
33
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 254, in _concat_arrays
|
34
|
+
[array[None] for array in arrays])
|
35
|
+
File "<__array_function__ internals>", line 6, in concatenate
|
36
|
+
Will finalize trainer extensions and updater before reraising the exception.
|
37
|
+
Traceback (most recent call last):
|
38
|
+
File "train_review.py", line 171, in <module>
|
39
|
+
trainer.run()
|
40
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/trainer.py", line 349, in run
|
41
|
+
six.reraise(*exc_info)
|
42
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/six.py", line 693, in reraise
|
43
|
+
raise value
|
44
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/trainer.py", line 319, in run
|
45
|
+
entry.extension(self)
|
46
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/extensions/evaluator.py", line 161, in __call__
|
47
|
+
result = self.evaluate()
|
48
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/extensions/evaluator.py", line 216, in evaluate
|
49
|
+
self.converter, batch, self.device)
|
50
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 73, in _call_converter
|
51
|
+
return converter(batch, device)
|
52
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 58, in wrap_call
|
53
|
+
return func(*args, **kwargs)
|
54
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 223, in concat_examples
|
55
|
+
[example[i] for example in batch], padding[i])))
|
56
|
+
File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 254, in _concat_arrays
|
57
|
+
[array[None] for array in arrays])
|
58
|
+
File "<__array_function__ internals>", line 6, in concatenate
|
19
59
|
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 150 and the array at index 14 has size 149
|
20
60
|
|
61
|
+
↑のように所々149次元(データセットは全6539件)になったりして次元数が揃ってないことによって学習ができなくなっています。
|
62
|
+
|
21
63
|
```python
|
22
64
|
import db
|
23
65
|
import pandas as pd
|
2
フロー詳細
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
|
4
4
|
理由が全く分からず質問させていただきました。
|
5
5
|
|
6
|
+
やろうとしているフローチャート:
|
7
|
+
DBからつぶやき取得
|
8
|
+
↓
|
9
|
+
形態素解析
|
10
|
+
↓
|
11
|
+
bag of wordsでベクトル化
|
12
|
+
↓
|
13
|
+
LSIを用いて次元削減 ←ここで次元数の指定がうまくいかない
|
14
|
+
↓
|
15
|
+
学習・推定
|
16
|
+
|
17
|
+
|
6
18
|
エラー文:
|
7
19
|
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 150 and the array at index 14 has size 149
|
8
20
|
|
1
見やすく
title
CHANGED
File without changes
|
body
CHANGED
@@ -15,10 +15,6 @@
|
|
15
15
|
import datetime
|
16
16
|
import pymysql.cursors
|
17
17
|
import gensim
|
18
|
-
from gensim.models import word2vec
|
19
|
-
from sklearn import svm
|
20
|
-
from sklearn.model_selection import GridSearchCV
|
21
|
-
from sklearn.metrics import accuracy_score
|
22
18
|
import mlp
|
23
19
|
import random
|
24
20
|
from gensim import corpora,matutils
|
@@ -26,14 +22,6 @@
|
|
26
22
|
import screaning
|
27
23
|
from chainer import serializers
|
28
24
|
|
29
|
-
def param():
|
30
|
-
ret = {
|
31
|
-
'C':[1, 10, 100],
|
32
|
-
'kernel':['rbf'],
|
33
|
-
'gamma':np.linspace(0.01, 1.0, 10)
|
34
|
-
}
|
35
|
-
return ret
|
36
|
-
|
37
25
|
# DB操作用にカーソルを作成
|
38
26
|
cursor = db.conn.cursor()
|
39
27
|
|