NMF icon indicating copy to clipboard operation
NMF copied to clipboard

using my own objective with an existing method

Open ChristelSwift opened this issue 4 years ago • 0 comments

this may be a naive question but is it possible to specify my own objective function using one of the existing methods?

For example, based on the example given in the vignette, let's say i want to use my own objective but instead of my own algorithm, i want to use the method 'snmf/l'. If i run this:

n <- 50 
r <- 3 
p <- 20
V <-syntheticNMF(n, r, p)

V_model <- nmf(V, 3, method = 'snmf/l', 
    objective = function(model, target, ...){
      ( sum( (target-fitted(model))^4 ) )^{1/4}
      }
    )  

it fails as this method already has its own objective baked in.

Can i somehow edit an existing method so i can use my own objective based on the model and fitted objects?

ChristelSwift avatar Apr 19 '20 09:04 ChristelSwift