Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Mxnet and Tensorflow to do a comparative test of simple multiple classifiers

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use Mxnet and Tensorflow to do a comparative test of simple multiple classifiers. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

When I first came into contact with mxnet and Tensorflow a few months ago, I wrote my own case using a simple dataset, iris. Because it is simple enough (only 3 categories, 150 pieces of data), it is easy to analyze. Unlike many researchers, they just run the training program and look at the printed train accuracy. After I have finished training the model, I like to continue to make up some custom data, and then let the model make predictions or classifications to see if the model is good enough. For Iris datasets, I implemented a MLP model for classification using mxnet. After training (the printed train accuracy is above 0.9), I immediately made some custom data prediction, and found that the prediction classification result was very poor and could not be used. At that time, I felt that I was not familiar with Mxnet, so I didn't care about it. Later, however, I switched to using Tensorflow to implement a similar MLP model to classify iris data sets, and then predicted the same custom data, and suddenly found that the Tensorflow code performed very well. I was surprised by this strong contrast gap, so I wrote the MLP model to test the other two data sets in mxnet and Tensorflow, and the result was the same (Tensorflow is basically classifiable, mxnet is not). I listed some test data:

Test 1. Sonar dataset (two label values, 60 features, 208pieces of data.) :

A) Tensorflow codes:

Train Accuracy: 0.833333

Test 4 new data:

New samples accuracy: 0. 50000

B) mxnet codes:

Train Accuracy: 0.6

Test 4 new data:

('New samples accuracy:', 0.25)

Test 2. Iris dataset (3 tag values, 4 features, 150 pieces of data):

A) Tensorflow codes:

Train Accuracy: 1.0

Test 10 new data:

New samples accuracy: 0.900000

B) mxnet codes:

Train Accuracy: 0.975

Test 10 new data:

('New samples accuracy:', 0.20)

Test 3. Custom dataset (3 tag values, 3 features, 10000 pieces of data). I compiled this data set, in which the first two features are irrelevant, and the third column of features is the determining factor. Deliberately set this up and let the neural network judge for itself who is the most important.

A) Tensorflow codes:

Train Accuracy: 0.9

Test 10 new data:

New samples accuracy: 0.700000.

B) mxnet codes:

Train Accuracy: 1.0

Test 10 new data:

New samples accuracy: 0.3.

As you can see, the MLP model written in mxnet has poor accuracy in the new data classification of three different text data sets and cannot be used. The MLP model written by Tensorflow works. Why is mxnet not performing well? I suspect that mxnet code has bug, especially code for model definition and model training. The question was raised on mxnet's github, but no one paid attention to it. Forget it. Use Tensorflow to classify these simple classifiers before you find out bug.

The relevant test comparison code is placed here:

Https://github.com/qinhui99/mxnetSamples.git

On how to use Mxnet and Tensorflow to do a simple multi-classifier comparison test is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report