Coder Social home page Coder Social logo

Cholesky solver about rsparse HOT 8 CLOSED

david-cortes avatar david-cortes commented on May 23, 2024
Cholesky solver

from rsparse.

Comments (8)

david-cortes avatar david-cortes commented on May 23, 2024 1

But that loss is not the same function that is being minimized. The solver minimizes (or is supposed to minimize) the values over all entries, whereas the loss function calculates it over the present entries.

from rsparse.

dselivanov avatar dselivanov commented on May 23, 2024

Thanks for reporting, I will take a look. Actually I expect the problem is the same as in #35 - XtX.

Which is certainly not what I'd expect as the Cholesky is a more exact method and should lead to better results.

Loss with Cholesky should be lower, but hit rate might be worse since we don't optimize it directly...

from rsparse.

dselivanov avatar dselivanov commented on May 23, 2024

@david-cortes could set logger to debug and check the loss? From what I see cholesky achieves smaller (or about the same) loss:

library(rsparse)
library(lgr)
lg = get_logger('rsparse')
lg$set_threshold('debug')
data('movielens100k')

train = movielens100k
train = log1p(train)

for (seed in c(1, 2, 3)) {
  for (solver in c('cholesky', 'conjugate_gradient')) {
    model = WRMF$new(rank = 50,  lambda = 1, solver = solver)
    message(glue::glue("seed {seed}, solver {solver}"))
    user_emb = model$fit_transform(train, n_iter = 10, convergence_tol = -1, cg_steps = 3)
  }
}

from rsparse.

dselivanov avatar dselivanov commented on May 23, 2024

@david-cortes you are right! starting to forget all the details...

from rsparse.

david-cortes avatar david-cortes commented on May 23, 2024

Well I did some experiments calculating over all entries and they do indeed end up with similar loss. Weird that the resulting from Cholesky then performs worse at other metrics, and that it takes so little time.

from rsparse.

david-cortes avatar david-cortes commented on May 23, 2024

Did some more experiments this time, from the same movielens. After running for 10 iterations with seed=1, I get these losses:

  • CG: 74202.05
  • Cholesky: 74295.25

Whereas with the other package I was comparing, I get these:

  • CG: 126483.4
  • Cholesky: 78421.88

Wonder where the difference comes from...

from rsparse.

dselivanov avatar dselivanov commented on May 23, 2024

And if you remove arma::solve_opts::fast argument from the solver?

from rsparse.

david-cortes avatar david-cortes commented on May 23, 2024

Then the loss does end up lower than for CG, even though in a test set it didn't improve HR@5 or AUC. I guess technically it is working as it should - that is, it minimizes the function it is intended to - so I'll close this.

from rsparse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.