1
$\begingroup$

I have data like this.

[0 1 0 1 0]
[0 1 0 1 0 1 1]
[0 1 0 1 ]
[0 1 0 1 0 1 1 1 1 0]
...

I want to classify with Neural Network but my data different size . I can not delete or add more arbitaly data. It may make the result not correct. So, How to classification data different size ?

$\endgroup$
2
  • 1
    $\begingroup$ Welcome to CS.SE! We probably can't answer this question in isolation, without context. Can you edit your question to provide additional context? What is the meaning of the features? What kind of data are you working with? What is the meaning of the classes, and how do they relate to the features? Normally, standard neural networks require all feature vectors to be the length. Have you tried thinking about whether you can devise any features that will satisfy that? $\endgroup$
    – D.W.
    May 19, 2017 at 15:10
  • $\begingroup$ Your classifier can (and very likely will) make mistakes regardless of the representation of the data. $\endgroup$
    – Juho
    Nov 15, 2017 at 14:40

2 Answers 2

1
$\begingroup$

You can padd your data.

I can not delete or add more arbitaly data. It may make the result not correct.

Don't make assumptions about neural networks. They can map any function, and if you don't add more data (padding) then you can't even train your network in the first place.

If your data consists of merely 0's and 1's. You could either do the following:

  • pad all blanks with 0.5 ([0 1 0 1 0, 0.5, 0.5, 0.5, .0.5]), however the neural network will think that 0.5 is as far from 1 as it is from 0.
  • pad all blanks with 0.5 (this is what I recommend), if your data is binary (e.g. true/false), then all false must be set to 0 consistently. 0 then has the double meaning: false or not present.

There is no other option besides adding 'blank' data, if you don't add data, the network will still see this as a 0.

But you should try before you ask. "It may make the result not correct." is not a good argument to not do something. Your data doesn't seem that big, so you can easily test through trial and error.

$\endgroup$
5
  • 2
    $\begingroup$ "There is no other option besides adding 'blank' data". This is wrong. For a counter example, if the data were images of a strip of a barcode (which should have physical size, but was taken by camera at varying distance), it clearly make more sense to scale rather than pad the data. To sum it up, It depends on the nature of data. $\endgroup$ May 19, 2017 at 12:56
  • $\begingroup$ @Billiska that would require preprocessing of input data. If the data were images of a strip of a barcode, and the neural networks task is to classify the barcode in an image, then what is the point of the neural network if you are going to preprocess it anyway. Padding with 0's is a fairly common thing to do for neural networks, especially for convolutional networks like you described (adeshpande3.github.io/…) $\endgroup$ May 19, 2017 at 13:02
  • $\begingroup$ common doesn't imply correct. Some of points in preprocessing are to (1) train faster, (2) get more accuracy. Sure given enough network structure and training time, NN can probably figure out whether to pad or scale or something else. But that is slower and uncertain. $\endgroup$ May 19, 2017 at 13:25
  • $\begingroup$ @Billiska you dont even know if it would be better to preprocess, because the OP hasnt even given a clue on what type of data he is processing. As they are only small arrays, im 80% certain that you cant scale his samples down like you proposed. But OP is too vague to give a specific answer. $\endgroup$ May 19, 2017 at 13:33
  • 1
    $\begingroup$ I did not propose to scale. I did say it's not right to simply conclude you can only pad. Reason is exactly as you said, not enough information. If there was enough information, I would write another answer rather than commenting. $\endgroup$ May 19, 2017 at 14:29
1
$\begingroup$

I'm not an expert, but my understanding is the Recurrent Neural Networks are well suited to deal with sequences of data. This article gives a good (but possibly sensationalized) overview.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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