Open Banana1530 opened 5 years ago
clustRviz is here: https://github.com/DataSlingers/clustRviz
The weights argument there can be two things: either a custom weight matrix or a function which is called on the data to build a weight matrix for that specific problem. We'd definitely want to do something similar because there are times when non-standard smoothing matrices make sense (e.g., in the SFPCA paper, we use great circle distances for points on the cortical surface) but it's worth it to make a convenient shortcut for the 95% case of second difference matrices.
Summarizing, the ideal solution to this issue consists of two parts:
How clustRviz does this is clever, using tricks in functional programming.
A tentative solution is here:
https://github.com/Banana1530/MoMA-1/commit/a4b64dbf5ea73c8e1e9522cc54a181b2cc189c24
(currently broken due to code formatting issues.)
Perhaps a similar sort of thing:
u_smoothness = second_order_difference(select = TRUE)
I used a similar pattern for fusion weights in the clustRviz package: it's a bit tricky to get your head around it, but check it out - might have some useful ideas.
Related, but separate, question: if we go this route, should parameter values be in the object or as a second argument?
Originally posted by @michaelweylandt in https://github.com/michaelweylandt/MoMA/pull/42