Skip to content

excessive runtime of coef.mboost #114

Open
@bastistician

Description

@bastistician

Profiling coef.mboost for a colleague, I have noticed that it seems to waste time to "check if base-learner has coefficients" here:

if(any(sapply(cf, is.null))){

I don't know what the original intention was (@hofnerb), but given that cf is a numeric matrix, I think that condition will always be FALSE.

In the particular application, the base learner was a Markov random field over 327 regions. Here are the runtimes I get for evaluating the above condition as a function of mstop:

for (mstop in 10^(2:5)) {
  cat(mstop, ": ")
  cf <- matrix(0, 327, mstop)  # the actual values are irrelevant for this runtime assessment
  cat(system.time(any(sapply(cf, is.null)))["elapsed"], "s\n")
}
#> 100 : 0.009 s
#> 1000 : 0.109 s
#> 10000 : 1.094 s
#> 1e+05 : 20.04 s

Maybe that condition should be fixed to really "check if base-learner has coefficients". Otherwise the ret <- NULL case could simply be dropped. It would fail anyway when trying to set names on NULL later on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions