0
$\begingroup$

I have a huge list of binary strings: [010101, 011111111, 0101111100011....]. The length of each string is different: from 1 to 10000 characters. The output of the Neural Network is simple: yes/no.

Can you please suggest how to use these strings as input? Most examples use fixed-size input.

Is there a way to use 1d Convolutional NN?

$\endgroup$
5
  • 1
    $\begingroup$ It depends on what these data mean. If the order is meaningful (for example, the sequences are arranged in time), then RNN structures like lstm could be useful, because you don't need fixed-length inputs to LSTM models. $\endgroup$
    – Sycorax
    Jul 20, 2020 at 16:22
  • $\begingroup$ @Sycorax you are right, lstm is one possible choice. Is there a way to use simpler 1d convolutional NN? $\endgroup$
    – Oleg Dats
    Jul 20, 2020 at 16:39
  • 1
    $\begingroup$ I guess, but whatever you do with a CNN, you're either padding everything to be the same length on the front, or on the back you're applying some reduction to create a fixed-length result before collapsing to the binary prediction. I don't know that either choice is uniformly better. $\endgroup$
    – Sycorax
    Jul 20, 2020 at 16:41
  • $\begingroup$ understand, there are only 2 ways: LSTM or CNN + padding? $\endgroup$
    – Oleg Dats
    Jul 20, 2020 at 16:50
  • 1
    $\begingroup$ No, I've outlined 3: (1) any RNN, of which LSTM is a specific choice; (2) CNN + padding; (3) CNN + reduction to single length. In addition, you could use a fully-connected network padded to uniform length. Or you could use some sort of pre-processing method to make each sequence a fixed-length vector and then use an FCNN on that. These options probably aren't exhaustive, or they are exhaustive if you're very generous about what "pre-processing" and "padding," and "reduction" mean. $\endgroup$
    – Sycorax
    Jul 20, 2020 at 16:56

1 Answer 1

2
$\begingroup$

Collecting my comments into an answer: we have several options; which is best depend on what your goals are, and what the data mean. There's no enough information in the question to say which is most correct.

  1. Use a model such as an network or network. Sequence-based NNs are not restricted to fixed-length inputs.

  2. Use a CNN network. This network will either (a) pad all inputs to the same length of input, or else (b) reduce the CNN output to a fixed length before fully-connected layers yield the predicted output.

  3. Use a fully-connected network. This either (a) pads all of the inputs to the same length, and then proceeds as usual or (b) uses some more ornate kind of pre-processing to create a fixed-length vectors and proceeds as any fully-connected network does.

Importantly, the fact that the data are binary does not enter into any of these suggestions, so we can consider them as generic options for any usage where one is interested in classifying sequences of data with varied lengths.

$\endgroup$

Your Answer

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

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