質問編集履歴

4

エラー文を見やすく

2020/03/24 03:58

投稿

KazuyaKojima
KazuyaKojima

スコア16

test CHANGED
File without changes
test CHANGED
@@ -36,6 +36,8 @@
36
36
 
37
37
  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
38
38
 
39
+
40
+
39
41
  Traceback (most recent call last):
40
42
 
41
43
  File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/trainer.py", line 319, in run
@@ -70,6 +72,12 @@
70
72
 
71
73
  Will finalize trainer extensions and updater before reraising the exception.
72
74
 
75
+
76
+
77
+ ####trainer.run()で学習を行う際に入力ベクトルの次元数が揃っていないため学習が行えないというエラー####
78
+
79
+
80
+
73
81
  Traceback (most recent call last):
74
82
 
75
83
  File "train_review.py", line 171, in <module>
@@ -114,10 +122,16 @@
114
122
 
115
123
  File "<__array_function__ internals>", line 6, in concatenate
116
124
 
125
+
126
+
127
+
128
+
117
129
  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
118
130
 
119
131
 
120
132
 
133
+
134
+
121
135
  ↑のように所々149次元(データセットは全6539件)になったりして次元数が揃ってないことによって学習ができなくなっています。
122
136
 
123
137
 

3

エラー文の追加

2020/03/24 03:58

投稿

KazuyaKojima
KazuyaKojima

スコア16

test CHANGED
File without changes
test CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
 
24
24
 
25
- LSIを用いて次元削減   ←ここで次元数の指定がうまくいかない
25
+ LSIを用いて150次元削減   ←ここで次元数の指定がうまくいかない
26
26
 
27
27
 
28
28
 
@@ -34,10 +34,94 @@
34
34
 
35
35
  エラー文:
36
36
 
37
+ 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
38
+
39
+ Traceback (most recent call last):
40
+
41
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/trainer.py", line 319, in run
42
+
43
+ entry.extension(self)
44
+
45
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/extensions/evaluator.py", line 161, in __call__
46
+
47
+ result = self.evaluate()
48
+
49
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/extensions/evaluator.py", line 216, in evaluate
50
+
51
+ self.converter, batch, self.device)
52
+
53
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 73, in _call_converter
54
+
55
+ return converter(batch, device)
56
+
57
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 58, in wrap_call
58
+
59
+ return func(*args, **kwargs)
60
+
61
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 223, in concat_examples
62
+
63
+ [example[i] for example in batch], padding[i])))
64
+
65
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 254, in _concat_arrays
66
+
67
+ [array[None] for array in arrays])
68
+
69
+ File "<__array_function__ internals>", line 6, in concatenate
70
+
71
+ Will finalize trainer extensions and updater before reraising the exception.
72
+
73
+ Traceback (most recent call last):
74
+
75
+ File "train_review.py", line 171, in <module>
76
+
77
+ trainer.run()
78
+
79
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/trainer.py", line 349, in run
80
+
81
+ six.reraise(*exc_info)
82
+
83
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/six.py", line 693, in reraise
84
+
85
+ raise value
86
+
87
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/trainer.py", line 319, in run
88
+
89
+ entry.extension(self)
90
+
91
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/extensions/evaluator.py", line 161, in __call__
92
+
93
+ result = self.evaluate()
94
+
95
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/training/extensions/evaluator.py", line 216, in evaluate
96
+
97
+ self.converter, batch, self.device)
98
+
99
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 73, in _call_converter
100
+
101
+ return converter(batch, device)
102
+
103
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 58, in wrap_call
104
+
105
+ return func(*args, **kwargs)
106
+
107
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 223, in concat_examples
108
+
109
+ [example[i] for example in batch], padding[i])))
110
+
111
+ File "/Users/kojimakazuya/anaconda3/lib/python3.7/site-packages/chainer/dataset/convert.py", line 254, in _concat_arrays
112
+
113
+ [array[None] for array in arrays])
114
+
115
+ File "<__array_function__ internals>", line 6, in concatenate
116
+
37
117
  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
38
118
 
39
119
 
40
120
 
121
+ ↑のように所々149次元(データセットは全6539件)になったりして次元数が揃ってないことによって学習ができなくなっています。
122
+
123
+
124
+
41
125
  ```python
42
126
 
43
127
  import db

2

フロー詳細

2020/03/24 01:21

投稿

KazuyaKojima
KazuyaKojima

スコア16

test CHANGED
File without changes
test CHANGED
@@ -8,6 +8,30 @@
8
8
 
9
9
 
10
10
 
11
+ やろうとしているフローチャート:
12
+
13
+ DBからつぶやき取得
14
+
15
+
16
+
17
+ 形態素解析
18
+
19
+
20
+
21
+ bag of wordsでベクトル化
22
+
23
+
24
+
25
+ LSIを用いて次元削減   ←ここで次元数の指定がうまくいかない
26
+
27
+
28
+
29
+ 学習・推定
30
+
31
+
32
+
33
+
34
+
11
35
  エラー文:
12
36
 
13
37
  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

1

見やすく

2020/03/23 07:32

投稿

KazuyaKojima
KazuyaKojima

スコア16

test CHANGED
File without changes
test CHANGED
@@ -32,14 +32,6 @@
32
32
 
33
33
  import gensim
34
34
 
35
- from gensim.models import word2vec
36
-
37
- from sklearn import svm
38
-
39
- from sklearn.model_selection import GridSearchCV
40
-
41
- from sklearn.metrics import accuracy_score
42
-
43
35
  import mlp
44
36
 
45
37
  import random
@@ -54,22 +46,6 @@
54
46
 
55
47
 
56
48
 
57
- def param():
58
-
59
- ret = {
60
-
61
- 'C':[1, 10, 100],
62
-
63
- 'kernel':['rbf'],
64
-
65
- 'gamma':np.linspace(0.01, 1.0, 10)
66
-
67
- }
68
-
69
- return ret
70
-
71
-
72
-
73
49
  # DB操作用にカーソルを作成
74
50
 
75
51
  cursor = db.conn.cursor()