Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23218

How to train a DL model in Python when samples are 2d number arrays with different length?

$
0
0

I want to create a deep learning model, I know how to do so with simple samples where each row of dataset represents a sample, but my samples are 2D table of numbers. The features are the same in all samples but their length (rows) varies from sample to sample, like tables below.

Sample1:

Feature 1Feature 2...Feature nResult
row 1F1row 1F2...row 1FnS1
row 2F1row 2F2...row 2FnS1
............
row 1000F1row 1000F2...row 1000FnS1

Sample2:

Feature 1Feature 2...Feature nResult
row 1F1row 1F2...row 1FnS2
row 2F1row 2F2...row 2FnS2
............
row 1200F1row 1200F2...row 1200FnS2

Feature are the same, for example let's say feature 1 represents "Name" in all samples, feature 2 represents "city" and so on; but the number of rows in each sample varies.

I can not put away some rows to make the samples equal in length since they affect result. I also can not turn rows into new features to transform samples into 1D array of numbers because there are too many rows to do that.

  1. I want to know do I need to somehow normalize the dimension of the samples? (if yes how can I do that?)
  2. or Is there a deep learning model that can take inputs with different dimensions like my samples?

(I am using Python; I read that one way is to encode and decode the samples using LSTM seq-2-seq but I don't know if it is the right way to handle my dataset.)

Thanks in advance.


Viewing all articles
Browse latest Browse all 23218

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>