I would like to use FPCA to reconstruct a partial curve.
I have 20 temperature curves and each curve contains 365 days. I would like to do FPCA on 15 curves and extract functional PCA. The other 5 curves only have data up to 100 days. I would like to use the extracted PCA to make prediction and reconstruct the 5 curves to 365 days. How can I do that in python?
The code I have so far is fitting FPCA, but how do I do the prediction?
train_grid = FDataGrid(data_matrix=training_data, grid_points=day[:365])
test_grid = FDataGrid(data_matrix=testing_data, grid_points=day[:100])
fpca = FPCA(n_components=2)
fpca.fit(train_grid)
train_scores = fpca.transform(train_grid)
test_scores = fpca.transform(test_grid)
y_pred = fpca.inverse_transform(test_scores)
It gave me error ValueError: Incorrect dimension in data_matrix and grid_points.