Skip to content

Error with only intervals for gaussian data #3

@Quentin62

Description

@Quentin62

data.zip

library(RMixtComp)

dat = readRDS("bugdata.rds")
algo <- createAlgo(nInitPerClass = 1000)
model = list(molybdène = "Gaussian")

res <- mixtCompLearn(dat, model, algo, nClass = 1:3, nRun = 2, criterion = "ICL")

an R error is generated:

 Error in res[[indMax]] : 
  attempt to select less than one element in get1index 
3.
rmcMultiRun(algo, dataList, model, list(), nRun, nCore, verbose) at MIXTCOMP_mixtCompLearn.R#396
2.
classicLearn(data, model, algo, nClass, criterion, nRun, nCore, 
    verbose, mode) at MIXTCOMP_mixtCompLearn.R#283
1.
mixtCompLearn(datMC[datMC$Racine == "ELE100", ], model, algo, 
    nClass = 1:10, nRun = 10, criterion = "ICL")

the error comes from in RMixtCompIO:

  logLikelihood <- sapply(res, function(x) {ifelse(is.null(x$warnLog), x$mixture$lnObservedLikelihood, -Inf)})

  indMax <- which.max(logLikelihood)

  return(res[[indMax]])

If all warnlog are null then logLikelihood should be a vector of -Inf and this should not generate an error for which.max

Metadata

Metadata

Assignees

No one assigned

    Labels

    MixtCompConcern the C++ libraryRMixtCompIOConcern the RMixtCompIO package: R interface of the C++ library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions