Code Monkey home page Code Monkey logo

gmcm's People

Contributors

aebilgrau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gmcm's Issues

Improve get.IDR docs

The usage in the get.IDR docs should not display get.idr as it is no longer exported to the users.

STS-27 shuttle link broken

The automatic download for the vignette is broken due to a redirect.

trying URL ‘http://i.space.com/images/i/000/010/634/original/shuttle-atlantis-lifts-off.jpg?1309297321’
Warning in download.file(url, destfile = fig7.file, method = "internal", :
  "internal" method cannot handle https redirection to: 'https://www.space.com/images/i/000/010/634/original/shuttle-atlantis-lifts-off.jpg?1309297321'
Quitting from lines 128-128 (GMCM-JStatSoft.Rnw) 

The file does not appear to be hosted at space.com anymore.

sts-27

Allow as.theta coerceions

See file.

GMCM/R/as.theta.R

Lines 1 to 26 in 1563574

#' Coerce a list to a theta object
#'
#' @description At the moment, only the class is added.
#'
#' @param x A theta-like object that can be coerced.
#' @return A theta object. See \code{\link{rtheta}}.
#' @examples
#' m <- 2
#' d <- 2
#' x <- list(m = m,
#' d = d,
#' pie = c(0.5, 0.5),
#' mu = list(comp1=rep(0,d), comp2=rep(1,d)),
#' sigma = list(comp1=diag(d), comp2=diag(d)))
#' print(x)
#' theta <- as.theta(x)
#' print(theta)
#' @export
as.theta <- function(x) {
class(x) <- "theta"
if (is.theta(x)) {
return(x)
} else {
stop("Could not coerce 'x' into a theta object.")
}
}

Warning from regularize.values in fit.meta.GMCM

Warning when using a large mu/sd:

real.par <- c(0.6, 1.3, 2, 0.3)
sim <- SimulateGMCMData(n = 500, par = real.par, d = 6)
res5 <- fit.meta.GMCM(u = sim$u,
                          init.par = c(0.1, 11, 11, 0.9),
                          method = "L-BFGS-B", max.ite = 1000,
                          verbose = TRUE)
Warning messages:
1: In regularize.values(x, y, ties, missing(ties)) :
  collapsing to unique 'x' values
2: In regularize.values(x, y, ties, missing(ties)) :
  collapsing to unique 'x' values
3: In regularize.values(x, y, ties, missing(ties)) :
  collapsing to unique 'x' values
4: In regularize.values(x, y, ties, missing(ties)) :
  collapsing to unique 'x' values
5: In regularize.values(x, y, ties, missing(ties)) :
  collapsing to unique 'x' values
6: In regularize.values(x, y, ties, missing(ties)) :
  collapsing to unique 'x' values

Error in EMAlgorithm

library("GMCM")
set.seed(1)
n <- 1000
d <- 5
m <- 5
data <- SimulateGMMData(n = n, d = d, m = m) # Simulate some data
start.theta <- rtheta(d = d, m = m)
res <- GMCM:::EMAlgorithm(data$z, theta = start.theta, max.ite = 1000,
trace.theta = TRUE, verbose = TRUE)
iteration 2 Delta loglik = 43233.53

error: inv_sympd(): matrix appears to be singular

Error: inv_sympd(): matrix appears to be singular

Extra features for GMCM shiny app

Re. #19, the following features could be considered for the GMCM:

Input file handling:

  • Subset rows which are passed to model
  • Better "pre-processing". Allow to apply basic functions on chosen cols.

Special case GMCM

  • Displaying more clearly exactly which cols have been used and the dimension of the model

  • A "fit log" -- captured output from fit.meta.GMCM (?)

  • Ability to provide new values to predict

  • 3d plots when applicable

Other

  • Add various alters, models, popups, etc, to guide users safely through
  • Add usage to README, update NEWS, deploy app somewhere

Error in fit.meta.GMCM

Sometimes, optim throws an error from fit.meta.GMCM about infinite objective function values.

An example which reproduce this error is:

library(GMCM)
set.seed(3)
true.par <- c(0.95, 3, 2, 0.5)
data <- SimulateGMCMData(d = 3, n = 10000, par = true.par)
start.par <- c(0.32, 3.62, 3.74, 0.08)
fit <- fit.meta.GMCM(Uhat(data$u), init.par = start.par, method = "L-BFGS")

And this yield the error:

Error in optim(inv.tt(init.par, d = d, positive.rho = positive.rho), meta.gmcm.loglik,  : 
  L-BFGS-B needs finite values of 'fn'

Error when fitting with one component.

Reproducible example:

library("GMCM")

n <- 1000
set.seed(123)
data <- data.frame(X1 = rnorm(n),
                   X2 = rchisq(n, df = 10),
                   X3 = rpois(n, lambda = 100))

udata <- Uhat(data)

fitted.theta <- fit.full.GMCM(u = udata, m = 1, method = "NM", verbose = FALSE)

Use relist in functions tt and tt.inv

Instead of manually relisting the "unlisted" parameter list as done in the functions tt and tt.inv use relist. Probably more safe and faster?. See ?relist.

Create a proper theta() constructor

Improve the interface with a theta() constructor. Looks like list(…) but evaluates lazily and checks specified names, and applies as.theta, etc.

Code like this is annoying:

start.theta <- 
  list(m = 3,
       d = 4,
       pie = c(1,1,1)/3,
       mu = list(comp1 = rep(0, 4), comp2 = c(1,0,0,0), comp3 = c(0,1,0,0)),
       sigma = replicate(3, diag(4), simplify = FALSE))

start.theta <- as.theta(start.theta)

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.