Skip to content

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

@DMRoberts

Description

@DMRoberts

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions