tflearn
で提供されるDNNを使用して、データから学習します。これは私にエラーのカップルを与え形状はランク1でなければなりませんが、ランク2になります。エラー
# Target label used for training
labels = np.array(data[label], dtype=np.float32)
# Reshape target label from (6605,) to (6605, 1)
labels = tf.reshape(labels, shape=[-1, 1])
# Data for training minus the target label.
data = np.array(data.drop(label, axis=1), dtype=np.float32)
# DNN
net = tflearn.input_data(shape=[None, 32])
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 1, activation='softmax')
net = tflearn.regression(net)
# Define model.
model = tflearn.DNN(net)
model.fit(data, labels, n_epoch=10, batch_size=16, show_metric=True)
、最初は...私のdata
変数は(6605, 32)
の形状をしており、私のlabels
データは、私が(6605, 1)
に以下のコードで作り直す(6605,)
の形状をしています...
tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 1 but is rank 2 for 'strided_slice' (op: 'StridedSlice') with input shapes: [6605,1], [1,16], [1,16], [1].
...第二は...
During handling of the above exception, another exception occurred:
ValueError: Shape must be rank 1 but is rank 2 for 'strided_slice' (op: 'StridedSlice') with input shapes: [6605,1], [1,16], [1,16], [1].
私は考えている何rank 1
とrank 2
がありますので、この問題を解決する方法はありません。
「ラベル」の形を変えてみてください。エラーは持続しますか?はい、あなたのデータのサンプルを提供しています(また、このモデルが提供されているリンクは、役に立つと思われます) – desertnaut