# Neural network: Using genetic algorithms to train and deploy neural networks: High quality classification

Total views
1,274,018

Currently the popular output class encoding method is one-hot, each class corresponds to a vector that only one bit of the class is turned on (by 1), while the other bits are 0. The most applicable in this way is TensorFlow with one_hot () function The output is a level 4 square matrix, each row representing one class. Suppose those classes have the following labels:

```“Low Risk” 	:= (1, 0, 0, 0)
“Medium Risk”	:= (0, 1, 0, 0)
“High Risk”	:= (0, 0, 1, 0)
“Extreme Risk”	:= (0, 0, 0, 1)```

We see that these concepts describe different levels of risk, so the metric between concepts needs to show such information. "Extreme Risk" must be farther away from "Low Risk" than "Medium Risk".
But in this encoding, the metric between all vector pairs is the same, is √2

d(“Low Risk”, “Medium Risk”) = √(1 + 1 + 0 + 0) = √2
d(“Low Risk”, “Extreme Risk”) = √(1 + 0 + 0 + 1) = √2

A better way is to express the level of the class, starting from the first class with level 1. The level of a class will be the number of 1s in the corresponding vector. We have

```“Low Risk” 	:= (1, 0, 0, 0)
“Medium Risk”	:= (1, 1, 0, 0)
“High Risk”	:= (1, 1, 1, 0)
“Extreme Risk”	:= (1, 1, 1, 1)```

Then

d(“Low Risk”, “Medium Risk”) = √(0 + 1 + 0 + 0) = 1
d(“Low Risk”, “Extreme Risk”) = √(0 + 1 + 1 + 1) = √3

Thus "Extreme Risk" is farthest from "Low Risk", while "Medium Risk" is closest to the "Low Risk".

Hope TensorFlow will update this issue in the future.

Currently unrated

### New Comment

required

required (not published)

optional

required

What is 6 - 6?

required ### Top Posts & Pages

• ###### Online Shopping (2,414 hits)
Join 1,270 other followers

What is 8 - 7?

Can't see mail in Inbox? Check your Spam folder.