# How would someone use curves as an input to a supervised learning model?

I was asked this question during a test and couldn't figure out the answer:

• You have a set of curves against time $$X_i(t)$$ that you want to use as input to a supervised learning model. The curves could be daily or hourly observations of a time varying metric, measured from $$t=0$$ up to $$t=T$$. Each individual curve $$X_i(t)$$ corresponds to a single example in the training data set. How do you encode the curves into a feature or set of features for your model?

The different curves would look something like:

The example mentioned was yield curves, but it was indicated that the question was regarding any set of time varying curves, as long as they were all over the same length of time $$T$$. Presumably the rate at which the curves are sampled is regular, but high enough that using the discrete samples as an input vector won't work.

The purpose of the supervised learning model wasn't specific: It could be forecasting, or regression, or some sort of logistic regression. The main idea was how would you feature engineer the curve data,

My answer was to either:

• Choose a sufficiently high order n of polynomial, such that any one of the $$X_i(t)$$ can be reasonably approximated by a polynomial $$\hat{X}_i = x_{i,0} + x_{i,1} t + x_{i,2} t^2 + \cdots + x_{i,n} t^n$$ and then use $$x_{i,0}, x_{i,1}, x_{i,2}, \ldots ,x_{i,n}$$ as my $$n+1$$ features.

• Or, treat each curve as a time series, and use the values of the ACF,PACF, the seasonality index, and the slope of the trend as inputs to our model.

The response I got was: neither, you need to use principal component analysis. But no further explanation was given.

My questions:

What is wrong with the approaches I suggested?

And how exactly can principal component analysis turn our curves into features? Wouldn't PCA just rotate our curves for us?

• I'm voting to close this question, not because I think this is a bad question, but because I'm afraid you'll have to ask this to whomever made the test. For what it's worth, your second approach sounds much more reasonable than "you need to use PCA", and I personally cannot think of a simple reason why and how PCA would be suitable for this approach. Commented May 30, 2019 at 7:09
• Let me add that I don't think the question (not yours, the one you quote) is clear: First it states you already have curves, then it states these could be observations on an interval. A curve can be fit on a series of observations, but a series of observations is not a curve. Commented May 30, 2019 at 7:18
• Imagine a study of subjects that occasionally--but very rarely--exhibit a behavior of interest. Instruments on each subject record these behaviors for each second of a day by logging a zero when the behavior does not occur and a one when it does occur. If the behaviors are never simultaneous, these "curves" will be orthogonal and PCA won't accomplish more than counting the behaviors. The polynomial will be useless. This example shows that the nature of the data as well as the purpose of the analysis are key pieces of information needed to formulate a good answer.
– whuber
Commented May 30, 2019 at 17:06
• @whuber I hope I have added sufficient detail on the nature of the data. The purpose of the exercise wasn't specified, although using the curves as casual inputs to a forecasting model was given as an example. Commented May 30, 2019 at 19:20
• It is standard to preprocess with PCA in supervised learning. I would be shocked if this wasn't mentioned a lot during the course of the semester. It is sort of "what you do" without really even thinking to help your model learn, and this question may even have been a "were you paying attention" type of question. Your given answers act as if the goal is to model the behavior of the curves, rather than simplify them and feed them to a supervised learning model. My guess is the prof didn't want to take the time to explain because this is something you should know already. Commented Jun 11, 2019 at 2:51