Answers.Body: <p>It is much simpler to process the data in a different way. Since you're using temporal data a common practice is to define a priori a minimum time-step, usually called <span class="math-container">$\textit{granularity}$</span>, which must be bigger than you're sensor responsiveness. Using this granularity value you'll then be able split your data into intervals, and you can then combine each instance belonging to an interval with a function that you like. Most common choice is obviously averaging the values, but also summing then could be a choice or a moving average. </p>
  
  <p>Don't think that in this way you will loose information, preprocessing is also called data cleaning for a reason, not aways raw data are better. </p>
  
  <p>As a last note, I would suggest you to look into 'Machine learning for the quantified self', there is growing literature going on about using sensors to train predictive models about movements and body measures like heart-rate. You might find something about preprocessing for this specific sensor-applications. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-14T15:04:05.317Z
Answers.LastActivityDate: 2020-03-14T15:04:05.317Z
Answers.UserDisplayName: Edoardo Guerriero
Body: <p>I am currently working on a project, where I have a sensor in a shoe that records the <span class="math-container">$X, Y, Z$</span> axes, from an acceleration and gyroscope sensor. Every millisecond, I get 6 data points. Now, the goal is, if I do an action, such a jumping or kicking, I would use the sensor's output to predict that action being done.</p>
  
  <p><strong>The issue</strong>: If I jump, for example, one time I may get 1000 data points, but, in another, I get 1200 amounts, meaning the size of the input is different. </p>
  
  <p>The neural networks I've studied so far require the input size to be constant to predict a <span class="math-container">$Y$</span> value, however, in this case, it isn't. I've done some research on how to make a neural network with variable sizes, but haven't been able to find one which works. It's not a good idea to crop the input to a certain size, because then I am losing data. In addition, if I just resize the smaller trials by putting extra <span class="math-container">$0$</span>s, it skews the model. </p>
  
  <p>Any suggestions on a model that would work or how to better clean the data?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-14T19:46:36.967Z
Comments.Text: the accelerometer gives the acceleration in the x,y,z. Then the gyroscope does the same.
Comments.UserDisplayName: Tarun R
Tags: <neural-networks><classification><data-preprocessing>
Title: How should I deal with variable input sizes for a neural network classifier?
UserDisplayName: Tarun R
ThreadText: # How should I deal with variable input sizes for a neural network classifier?
  
  (Asked by: username_0 on 2020-03-13)
  
  I am currently working on a project, where I have a sensor in a shoe that records the $X, Y, Z$ axes, from an acceleration and gyroscope sensor. Every millisecond, I get 6 data points. Now, the goal is, if I do an action, such a jumping or kicking, I would use the sensor's output to predict that action being done.
  
  **The issue**: If I jump, for example, one time I may get 1000 data points, but, in another, I get 1200 amounts, meaning the size of the input is different.
  
  The neural networks I've studied so far require the input size to be constant to predict a $Y$ value, however, in this case, it isn't. I've done some research on how to make a neural network with variable sizes, but haven't been able to find one which works. It's not a good idea to crop the input to a certain size, because then I am losing data. In addition, if I just resize the smaller trials by putting extra $0$s, it skews the model.
  
  Any suggestions on a model that would work or how to better clean the data?
  
  **Tags:** neural-networks, classification, data-preprocessing
  > **Comments:**
  > **username_0**: the accelerometer gives the acceleration in the x,y,z. Then the gyroscope does the same.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-03-14. Score: 2
  
  It is much simpler to process the data in a different way. Since you're using temporal data a common practice is to define a priori a minimum time-step, usually called $\textit{granularity}$, which must be bigger than you're sensor responsiveness. Using this granularity value you'll then be able split your data into intervals, and you can then combine each instance belonging to an interval with a function that you like. Most common choice is obviously averaging the values, but also summing then could be a choice or a moving average.
  
  Don't think that in this way you will loose information, preprocessing is also called data cleaning for a reason, not aways raw data are better.
  
  As a last note, I would suggest you to look into 'Machine learning for the quantified self', there is growing literature going on about using sensors to train predictive models about movements and body measures like heart-rate. You might find something about preprocessing for this specific sensor-applications.
  
  
  ---
  
  