cnn.keep_prob: 1.
                     })
     #print loss
     ou = sess.run(pred,
                   feed_dict={
                       cnn.x: batch_x,
                       cnn.y: batch_y,
                       cnn.keep_prob: 1
                   })
     #print ou.shape
     #print batch_y.shape
     [
         hammin_loss, one_error, coverage, ranking_loss,
         average_precision, subset_accuracy, accuracy, precision,
         recall, f_beta
     ] = utils.get_accuracy_test(ou, batch_y)
     #print(acc)
     plot_x.append(step * config.batch_size)
     plot_y.append(loss)
     print("Iter " + str(step * config.batch_size) +
           ", Minibatch Loss= " + "{:.6f}".format(loss[0]))
     print("hammin_loss: ", "{:.6f}".format(hammin_loss))
     print("subset_accuracy: ", "{:.6f}".format(subset_accuracy))
     print("accuracy: ", "{:.6f}".format(accuracy))
     print("precision: ", "{:.6f}".format(precision))
     print("recall: ", "{:.6f}".format(recall))
     print("f_beta: ", "{:.6f}".format(f_beta))
 if data.end == data.total_texts:
     epoch += 1
     print("Epoch: " + str(epoch))
     data.shuffler()
Exemplo n.º 2
0
			
			#batch_y = data.labels_train # bibtex, rcv1
			batch_y = np.array(data.labels_train) # agnews
			batch_y = batch_y.reshape(config.batch_size, config.label_size)
			#print(len(batch_x), len(batch_x[0]))
			#print("Y shape: ", batch_y.shape)
			
			sess.run(optimizer, feed_dict={mlp.x: batch_x, mlp.y: batch_y, mlp.keep_prob: mlp.dropout})

			if step % 1 == 0:
				#print Get Accuracy: "
				loss = sess.run([cost], feed_dict={mlp.x: batch_x, mlp.y: batch_y, mlp.keep_prob: 1.})
				#print loss
				ou = sess.run(pred, feed_dict={mlp.x: batch_x, mlp.y: batch_y, mlp.keep_prob: 1})
				#data.ids[data.start:data.end]
				[hammin_loss, one_error, coverage, ranking_loss, average_precision, subset_accuracy, accuracy, precision, recall, f_beta] = utils.get_accuracy_test(ou, batch_y)
				#print(data.ids[data.start:data.end])
				print ("Iter " + str(step * config.batch_size) + ", Minibatch Loss= " + "{:.6f}".format(loss[0]))
				print ("hammin_loss: ", "{:.6f}".format(hammin_loss))
				print ("subset_accuracy: ", "{:.6f}".format(subset_accuracy))
				print ("accuracy: ", "{:.6f}".format(accuracy))
				print ("precision: ", "{:.6f}".format(precision))
				print ("recall: ", "{:.6f}".format(recall))
				print ("f_beta: ", "{:.6f}".format(f_beta))

			if data.end == data.total_texts:
				epoch += 1
				print("Epoch: " + str(epoch))
				data.shuffler()
			if step % 5000 == 0:
				save_path = saver.save(sess, "mlp_weights/model" + str(model_saving) + "_bow.ckpt")