Closed Ddelval closed 1 year ago
Patch coverage: 99.01
% and project coverage change: +0.11
:tada:
Comparison is base (
48d1fae
) 85.51% compared to head (5ab79ca
) 85.63%.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
I think this functionality is implemented in the package
fda.usc
. We should have a test verifying that we obtain the same results.
I have (finally) added this test. However, while going back and forth between python and R, I stumbled upon a python packet that provides a simple way to execute R code from within python. I am sceptical regarding whether or not this could be useful for the tests. On the one hand, it would ensure that the tests are testing against the correct values while forcing us to include the R source used to obtain the test reference data. On the other hand, it would make the tests considerably slower and require modifications to the GitHub actions.
I think the timing tradeoff is too significant (I measured a slowdown of around 6x). Nevertheless, I thought I might just mention it just in case it comes in handy at some point. The following snippet generates the testing data for the test I just added.
from rpy2 import robjects
Rresult = robjects.r('''
library("fda.usc")
data(tecator)
# Fit the regression model with the first 129 observations
x=tecator$absorp.fdata[1:129,]
y=tecator$y$Fat[1:129]
res2=fregre.pc(x,y,l=1:10)
# Predict the response for the remaining observations
n = length(tecator$y$Fat)
xnew=tecator$absorp.fdata[130:n,]
result = predict(res2, xnew)
names(result) = NULL
# Output the predicted values
paste(
round(result,8),
collapse = ", "
)
''')
r_predictions = np.array(Rresult[0].split(", "), dtype=np.float64)
Add the FPCA regression estimator