D
D
dostoevskiy542022-01-21 12:55:14
Neural networks
dostoevskiy54, 2022-01-21 12:55:14

How to create a classifier with different types of features?

The task is as follows: it is necessary to classify the degree of harmfulness of the operation. I selected 15 key features, among them there are features with different types (string, number, bool). How can all this be brought into a form that the neuron will understand?
I will clarify that the string can be of various lengths.

Thought to create a tensor (features_num x max_feature_len). But then how to fill the empty space? By convention, a string will occupy a tensor of 1 x 16 when a boolean will occupy 1 x 1. Fill this space with 0?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2022-01-21
@rPman

neural networks understand only numbers, and even normalized on the
boolean interval, these are two values ​​​​0 and 1 (conditionally, you can choose any other values, it doesn’t matter)
but the lines are a question of the type of attribute - if this is a value from the directory, then if they can be somehow sorted by attribute (for example, large, medium, small), then they can be replaced with one value in the interval (in my example 1,0.5,0), but if not, then this is a vector of values ​​0 or 1 with one only in the desired element (by the way, nothing prevents using complex combinations when one line sets the value in several elements in the vector at once, for example, if the string is composite - 'blue rabbit' you need to set 1 in elements according to the color blue, type of animal and rabbit (maybe some more), plus you can give different values ​​​​as the weight of the sign's significance, for example, a rabbit is not only an animal, but also a little food and a little bit of entertainment)
Yes, 0 for the neural network is a very convenient value for the absence of a feature (by the way, nothing prevents you from flipping the values ​​​​and making 1 a sign of absence and 0 a sign of presence, the neural network will digest everything, although there may be optimization algorithms that will not understand this)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question