分类贴标签

DataFrame分类贴标签

y = np.argmax(tf.nn.softmax(encoded_imgs), axis=1)
data_before.loc[:, 'labels'] = y
df1 = data_before[data_before['labels'] == 0]
df2 = data_before[data_before['labels'] == 1]
df3 = data_before[data_before['labels'] == 2]

tf.tensor分类贴标签

y =tf.argmax(tf.nn.softmax(encoden_imgs), axis=1)
y=tf.cast(y,dtype='float32')#(100,),epochs=100
y=tf.expand_dims(y,axis=-1)#扩展维度(100,1)
y_actual= tf.concat([y_actual,y],axis=1)#(100,11)+(100,1)=(100,12)
# y_actual['labels'] = y
df1 = y_actual[y_actual[:,12] == 0]
df2 = y_actual[y_actual[:,12] == 1]
df3 = y_actual[y_actual[:,12] == 2]
上一篇:安装pytorch


下一篇:Tensorflow编程基础