I am fitting a logistic regression model using 4 indepdendent features. These features are counts of signal features present in a time series dataset. For example, number of peaks, number of troughs, etc. We have approximately 100,000 samples, however these have been measured from signals of differing length (between 10 and 60 minutes). The most 'truly' representative data are from those samples acquired for 60 minutes, however many of the samples are from observations less than 20 minutes. Converting these signal feature counts to the frequency domain (e.g. 10 peaks per hour) results in an overestimation of certain features from the shorter signal duration samples because we know, for example, that 100 peaks per hour does not occur. The frequency of features within these signals are non-steady and change significantly throughout recording. Only once a recording duration of >40 minutes are the signal features most reliable.

Therefore, the question is: is there a way to 'penalise' the datapoints that are from shorter signal lengths (e.g. <30 minutes) in the model training process?

  • $\begingroup$ I am not sure whether you are confused by your scaling. eg would 15 peaks/10 minutes be more meaningful? A tennis ball can be served at 263 km/h. That doesn't mean any tennis ball has ever travelled 263 kilometres from a serve. $\endgroup$
    – seanv507
    Dec 29, 2021 at 17:46

1 Answer 1


There are several things that you could do:

  • You could include measurement length as a feature in your model and interactions of this feature with other features. In such a case, the model would estimate parameters to "correct" for different length. This has the positive side of having explicit estimate of the effect of measurement length. By this, you could verify if the assumption that something changes with more measurements.
  • Alternatively, you could include the inverse of measurement length as a sample weights in your model (e.g. weights parameter in R's glm, or sample_weight parameter of the fit method for logistic regression in Python's scikit-learn). This would force the model to pay more importance to longer measurements and less to shorter, proportionally to the length. This is a pretty standard approach. One problem with this solution is that you would need to decide how would like to penalize for measurement length: should the weight be proportional to the inverse of the length or maybe it should be some non-linear transformation..?
  • Finally, you could just ignore the rows with not enough measurements from the analysis. It's not elegant, but if they are unreliable, this could be the simplest solution to consider. Nonetheless, it might be an interesting exercise to compare results of the models with and without those observations to verify how much impact do they have and what is the nature of their impact.

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.