1
$\begingroup$

I want to feed a set of non-binary features/attributes of my problem into the input for a neural network. Currently, I am looking about 21 features I would like to use for my input and one binary output (true/false).

I just want to make sure that neural nets can actually utilize non-binary input values before I start delving deeper into solving the problem. If there is a better method of machine learning given the number of features and the need for a true/false output, I am also open to new approaches.

$\endgroup$
1
$\begingroup$

Yes, you can use non-binary inputs with neural networks. I'm currently using neural nets to predict the presence of various objects in images, and the inputs are continuous pixel values.

$\endgroup$
  • $\begingroup$ Thanks for the quick answer, do you know of any good resources on neural net design. $\endgroup$ – user1634494 Jul 8 '16 at 23:24
  • $\begingroup$ It depends on the neural network architecture that you care about. In my case, I'm using convoluted neural networks in "deep learning", and Stanford's freely available class material is very helpful.: cs231n.github.io/convolutional-networks $\endgroup$ – Ryan Zotti Jul 8 '16 at 23:33
  • $\begingroup$ Also take a look at Google's TensorFlow: tensorflow.org/versions/r0.9/tutorials/index.html $\endgroup$ – Ryan Zotti Jul 8 '16 at 23:34
0
$\begingroup$

Yes. You can scale non-binary, non-categorical data to be between -1..1 or 0..1

For categorical data you can use 'one hot' vectors. Set the vector to zeros and put a 1 in to represent the category

for example: dog 001 cat 010 mouse 100

$\endgroup$
0
$\begingroup$

As others have noted, you can of course use any real-valued (haven't seen a model with complex inputs, but I guess it could happen) features. It may help to even think of your binary values as special cases of general input features.

Since it sounds like you're unsure about the appropriateness of your chosen method (neural networks), I'll lay out how I might structure the problem. Given the small number of features (and without knowing how much or how high quality the data), I'd recommend starting with a simple linear model. Something like Logistic Regression or a Binary Probit model would be a reasonable place to start. You can easily implement these in a language like R, or use libraries for Python or whatever your favorite language is. If the linear model gives you sufficient predictive power, great, you're done!

But if your linear model isn't where you want it to be, and you can't get more features nor more data, maybe you start thinking about transforming the inputs. Instead of $X_i$, you try $X_i^2$ or $log(X_i + X_j)$. Given the modest number of features you have, this might be enough to get a decent model.

If the model still isn't where you need it, now's a good time to look into neural networks. Unless your features have some inherent structure, like pixel values on a grid, you should probably start with a densely connected network. I advise starting small, with a few neurons on one layer, and adding to see if that improves your results. You're going to sacrifice easy understanding of the importance of your variables, but you can get more predictive power as the net effectively learns useful nonlinear combinations and transformations of your input data.

If you're new to implementing neural networks, I'd suggest giving Keras or skflow a try. They're both high-level interfaces to well-known neural network libraries. For your problem of a binary outcome, just make sure you end with one dense neuron that has a sigmoid activation, and use binary cross entropy as your loss function (you don't need to one-hot encode your output labels in this case because it's only 1 bit of information). This is basically equivalent to binary logistic regression at the final layer.

This is just one approach that may or may not make sense for your problem. And this may have been more than you wanted to read, but hopefully it's useful to someone starting out.

$\endgroup$
0
$\begingroup$

Yup, It works fine. I am using it on a regression data set in which there aren't any binary values to begin with. For more reference, you can refer to classical examples like wine classification. In this datasets there are binary and real attributes. This classification problem was solved using Neural Networks and its variants by many: Comparative study of artificial neural network and multivariate methods to classify Spanish DO rose wines

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.