I have time-series data of a few metrics. I know which metric is the response variable and the independent ones. I need to fit a model between them. The relationship could be linear, quadratic, logarithmic, piecewise linear, multiple linear, etc. Basically, it could be anything.

Is there any technique / properties I could use to find the relationship between the metrics and fit a model?

Right now, I have written a brute-force script in R.
For example, I have response variable A which depends on X1, X2 and X2.

A = C1*f1(X1)+C2*f2(X2)+C3*f3(X3) is my model.

My script tries all possible combinations of f1, f2 and f3.
By combinations, I mean that I initialy start with all linear, then one of them is quadratic, then cubic, then logarithmic, etc.

I am using lm().

I then choose the model which has the least AIC as my final model.

This obviously takes too long.

I definitely need an automated way of finding this model.

Could you suggest a better way to do this?


How about using neural networks instead of linear models? The neural net will have an easier time learning arbitrary non-linear relationships.

  • $\begingroup$ Hey, could you please elaborate a little bit? I'm not too familiar with Neural Nets. Just know the absolute basics. $\endgroup$
    – Sid Prasad
    Nov 4 '17 at 6:18
  • $\begingroup$ You're doing automated feature engineering. You're assuming a linear model, then you're trying to use automation and searching a large model space to find the best mutation of input variables. Neural networks instead allow you to specify the shape of the network, then they learn internal structures that encode functions that best mutate the input variables. Take a look at playground.tensorflow.org for a visual explanation and to play around with a neural net in your browser. $\endgroup$ Nov 6 '17 at 17:28

I would first make sure that I have only independent features (you can easily double check the covariance matrix and spot the zero singular values). Then, I would go for linear/logistic regression/linear SVM. If it doesn't give the desired performance, I would try the kernel SVM.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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