Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Computed features can differ on Apple Silicon (ARM) vs. other x86 platforms #54

Open
DMRoberts opened this issue Nov 21, 2024 · 0 comments

Comments

@DMRoberts
Copy link

This may be an issue with R, rather than the tsfeatures package, but when replicating a colleague's code I noticed that the results of some feature functions can differ between machines. From my initial testing, it seems that the difference is between Apple Silicon ARM chips (M1, M2, etc.) and x86, whether the latter is running Mac, Windows, or Linux.

For example, I set up the following code snippet to run on a GitHub action on Mac Arm, Mac x86, Linux x86, and Windows x86, and collected the results:

library(tsfeatures)

ts_data = c(256, 378, 91, 121, 210, 283, 322, 240, 95, 144, 240, 240, 196, 224, 273, 632, 292, 391, 322, 301, 367, 189, 273, 444, 217, 256, 332, 217, 322, 404, 489, 322, 232, 430, 489, 311, 474, 224, 203, 378, 322)

stl_result = tsfeatures::stl_features(ts(ts_data))

os_name = Sys.info()['sysname'] 

dir.create('output')

write.csv(stl_result, sprintf('output/stl_test_output_%s.csv', os_name))

writeLines(capture.output(sessionInfo()), sprintf('output/session_info_%s.txt', os_name))

The three x86 platforms return identical values, but several features from the stl_features function differ on Mac ARM. For example:

  nperiods seasonal_period     trend    spike linearity curvature      e_acf1   e_acf10                      arch
1        0               1 0.2049397 218983.4  243.2577 -59.08921 0.003537246 0.1448975   x86_64-apple-darwin20
2        0               1 0.1970024 227456.4  243.7909 -55.47259 0.012220162 0.1425530  aarch64-apple-darwin20
3        0               1 0.2049397 218983.4  243.2577 -59.08921 0.003537246 0.1448975     x86_64-pc-linux-gnu
4        0               1 0.2049397 218983.4  243.2577 -59.08921 0.003537246 0.1448975  x86_64-w64-mingw32/x64

Both Mac platforms use LAPACK version 3.12.0 for matrix algebra, though I understand this itself can vary between architectures.

This test code was run with both R 4.4.0, and also R 4.4.2, with identical results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant