+++ /dev/null
-^.*\.Rproj$
-^\.Rproj\.user$
--- /dev/null
+[
+]
\ No newline at end of file
--- /dev/null
+{
+ "debugBreakpointsState" : {
+ "breakpoints" : [
+ ]
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "path" : "~",
+ "sortOrder" : [
+ {
+ "ascending" : true,
+ "columnIndex" : 2
+ }
+ ]
+}
\ No newline at end of file
--- /dev/null
+{
+ "activeTab" : -1
+}
\ No newline at end of file
--- /dev/null
+{
+ "left" : {
+ "panelheight" : 993,
+ "splitterpos" : 412,
+ "topwindowstate" : "HIDE",
+ "windowheight" : 1031
+ },
+ "right" : {
+ "panelheight" : 993,
+ "splitterpos" : 618,
+ "topwindowstate" : "NORMAL",
+ "windowheight" : 1031
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "TabSet1" : 2,
+ "TabSet2" : 0,
+ "TabZoom" : {
+ }
+}
\ No newline at end of file
--- /dev/null
+build-last-errors="[]"
+build-last-errors-base-dir="~/valse/"
+build-last-outputs="[{\"output\":\"==> R CMD INSTALL --no-multiarch --with-keep.source valse\\n\\n\",\"type\":0},{\"output\":\"make: rien à faire pour « all ».\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* installing to library ‘/home/u0106095/R/x86_64-pc-linux-gnu-library/3.3’\\n\",\"type\":1},{\"output\":\"* installing *source* package ‘valse’ ...\\n\",\"type\":1},{\"output\":\"** libs\\n\",\"type\":1},{\"output\":\"installing to /home/u0106095/R/x86_64-pc-linux-gnu-library/3.3/valse/libs\\n\",\"type\":1},{\"output\":\"** R\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** data\\n\",\"type\":1},{\"output\":\"** preparing package for lazy loading\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** help\\n\",\"type\":1},{\"output\":\"*** installing help indices\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** building package indices\\n\",\"type\":1},{\"output\":\"** testing if installed package can be loaded\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* DONE (valse)\\n\",\"type\":1},{\"output\":\"\",\"type\":1}]"
+compile_pdf_state="{\"errors\":[],\"output\":\"\",\"running\":false,\"tab_visible\":false,\"target_file\":\"\"}"
+console_procs="[]"
+files.monitored-path=""
+find-in-files-state="{\"handle\":\"\",\"input\":\"\",\"path\":\"\",\"regex\":false,\"results\":{\"file\":[],\"line\":[],\"lineValue\":[],\"matchOff\":[],\"matchOn\":[]},\"running\":false}"
+imageDirtyState="1"
+saveActionState="-1"
--- /dev/null
+{"active_set":"","sets":[]}
\ No newline at end of file
--- /dev/null
+{
+ "tempName" : "Untitled1"
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+{
+}
\ No newline at end of file
--- /dev/null
+~%2Fvalse%2FDESCRIPTION="8ED40402"
+~%2Fvalse%2FLICENSE="D6E1266A"
+~%2Fvalse%2FNAMESPACE="B5669ED5"
+~%2Fvalse%2FR%2FconstructionModelesLassoMLE.R="3DB2E8C6"
+~%2Fvalse%2FR%2FdiscardSimilarModels.R="36AA59D8"
+~%2Fvalse%2FR%2FgenerateSampleInputs.R="96854E8B"
+~%2Fvalse%2FR%2FgridLambda.R="F342C3E6"
+~%2Fvalse%2FR%2FinitSmallEM.R="54FEEFED"
+~%2Fvalse%2FR%2Fmain.R="351F6E98"
+~%2Fvalse%2FR%2Fvalse.R="15D1CEE0"
+~%2Fvalse%2FREADME.md="78CD3B09"
+~%2Fvalse%2Fclean.sh="6D8AB60A"
+~%2Fvalse%2Fdata%2FTODO="7FF0D303"
+~%2Fvalse%2Fman%2FinitSmallEM.Rd="2A6B202E"
+~%2Fvalse%2Fsrc%2Fsources%2FEMGLLF.c="71C1A532"
+~%2Fvalse%2Fsrc%2Fsources%2FEMGLLF.h="93E132E4"
--- /dev/null
+{
+ "collab_server" : "",
+ "contents" : "#' Main function\n#'\n#' @param X matrix of covariates (of size n*p)\n#' @param Y matrix of responses (of size n*m)\n#' @param procedure among 'LassoMLE' or 'LassoRank'\n#' @param selecMod method to select a model among 'SlopeHeuristic', 'BIC', 'AIC'\n#' @param gamma integer for the power in the penaly, by default = 1\n#' @param mini integer, minimum number of iterations in the EM algorithm, by default = 10\n#' @param maxi integer, maximum number of iterations in the EM algorithm, by default = 100\n#' @param eps real, threshold to say the EM algorithm converges, by default = 1e-4\n#' @param kmin integer, minimum number of clusters, by default = 2\n#' @param kmax integer, maximum number of clusters, by default = 10\n#' @param rang.min integer, minimum rank in the low rank procedure, by default = 1\n#' @param rang.max integer, maximum rank in the\n#' @return a list with estimators of parameters\n#' @export\n#-----------------------------------------------------------------------\nvalse = function(X,Y,procedure,selecMod,gamma = 1,mini = 10,\n maxi = 100,eps = 1e-4,kmin = 2,kmax = 10,\n rang.min = 1,rang.max = 10) {\n ##################################\n #core workflow: compute all models\n ##################################\n \n p = dim(phiInit)[1]\n m = dim(phiInit)[2]\n \n print(\"main loop: over all k and all lambda\")\n for (k in kmin:kmax)\n {\n print(k)\n \n print(\"Parameters initialization\")\n #smallEM initializes parameters by k-means and regression model in each component,\n #doing this 20 times, and keeping the values maximizing the likelihood after 10\n #iterations of the EM algorithm.\n init = initSmallEM(k, X, Y)\n phiInit <<- init$phiInit\n rhoInit <<- init$rhoInit\n piInit\t<<- init$piInit\n gamInit <<- init$gamInit\n \n gridLambda <<- gridLambda(phiInit, rhoInit, piInit, tauInit, X, Y, gamma, mini, maxi, eps)\n \n print(\"Compute relevant parameters\")\n #select variables according to each regularization parameter\n #from the grid: A1 corresponding to selected variables, and\n #A2 corresponding to unselected variables.\n params = selectiontotale(phiInit,rhoInit,piInit,tauInit,\n mini,maxi,gamma,gridLambda,\n X,Y,thresh,eps)\n A1 <<- params$A1\n A2 <<- params$A2\n Rho <<- params$Rho\n Pi <<- params$Pi\n \n if (procedure == 'LassoMLE') {\n print('run the procedure Lasso-MLE')\n #compute parameter estimations, with the Maximum Likelihood\n #Estimator, restricted on selected variables.\n model = constructionModelesLassoMLE(\n phiInit, rhoInit,piInit,tauInit,mini,maxi,\n gamma,gridLambda,X,Y,thresh,eps,A1,A2)\n ################################################\n ### Regarder la SUITE\n r1 = runProcedure1()\n Phi2 = Phi\n Rho2 = Rho\n Pi2 = Pi\n \n if (is.null(dim(Phi2)))\n #test was: size(Phi2) == 0\n {\n Phi[, , 1:k] <<- r1$phi\n Rho[, , 1:k] <<- r1$rho\n Pi[1:k,] <<- r1$pi\n } else\n {\n Phi <<-\n array(0., dim = c(p, m, kmax, dim(Phi2)[4] + dim(r1$phi)[4]))\n Phi[, , 1:(dim(Phi2)[3]), 1:(dim(Phi2)[4])] <<- Phi2\n Phi[, , 1:k, dim(Phi2)[4] + 1] <<- r1$phi\n Rho <<-\n array(0., dim = c(m, m, kmax, dim(Rho2)[4] + dim(r1$rho)[4]))\n Rho[, , 1:(dim(Rho2)[3]), 1:(dim(Rho2)[4])] <<- Rho2\n Rho[, , 1:k, dim(Rho2)[4] + 1] <<- r1$rho\n Pi <<- array(0., dim = c(kmax, dim(Pi2)[2] + dim(r1$pi)[2]))\n Pi[1:nrow(Pi2), 1:ncol(Pi2)] <<- Pi2\n Pi[1:k, ncol(Pi2) + 1] <<- r1$pi\n }\n } else {\n print('run the procedure Lasso-Rank')\n #compute parameter estimations, with the Low Rank\n #Estimator, restricted on selected variables.\n model = constructionModelesLassoRank(Pi, Rho, mini, maxi, X, Y, eps,\n A1, rank.min, rank.max)\n \n ################################################\n ### Regarder la SUITE \n phi = runProcedure2()$phi\n Phi2 = Phi\n if (dim(Phi2)[1] == 0)\n {\n Phi[, , 1:k,] <<- phi\n } else\n {\n Phi <<- array(0, dim = c(p, m, kmax, dim(Phi2)[4] + dim(phi)[4]))\n Phi[, , 1:(dim(Phi2)[3]), 1:(dim(Phi2)[4])] <<- Phi2\n Phi[, , 1:k,-(1:(dim(Phi2)[4]))] <<- phi\n }\n }\n }\n print('Model selection')\n if (selecMod == 'SlopeHeuristic') {\n \n } else if (selecMod == 'BIC') {\n \n } else if (selecMod == 'AIC') {\n \n }\n}\n",
+ "created" : 1488803392297.000,
+ "dirty" : false,
+ "encoding" : "UTF-8",
+ "folds" : "",
+ "hash" : "360251119",
+ "id" : "46694A18",
+ "lastKnownWriteTime" : 1487870307,
+ "last_content_update" : 1487870307,
+ "path" : "~/valse/R/valse.R",
+ "project_path" : "R/valse.R",
+ "properties" : {
+ "tempName" : "Untitled1"
+ },
+ "relative_order" : 3,
+ "source_on_save" : false,
+ "source_window" : "",
+ "type" : "r_source"
+}
\ No newline at end of file
--- /dev/null
+{
+ "collab_server" : "",
+ "contents" : "# VAriable seLection with mixtureS of modEls\n\nThis code is the applied part of the PhD thesis of [Benjamin Gohehry](http://www.math.u-psud.fr/~goehry/).\n\n## Description\n\nTODO : see R package\n",
+ "created" : 1488803358112.000,
+ "dirty" : false,
+ "encoding" : "UTF-8",
+ "folds" : "",
+ "hash" : "268038944",
+ "id" : "5519E2E7",
+ "lastKnownWriteTime" : 1480679557,
+ "last_content_update" : 1480679557,
+ "path" : "~/valse/README.md",
+ "project_path" : "README.md",
+ "properties" : {
+ },
+ "relative_order" : 1,
+ "source_on_save" : false,
+ "source_window" : "",
+ "type" : "markdown"
+}
\ No newline at end of file
--- /dev/null
+{
+ "collab_server" : "",
+ "contents" : "Trouver un jeu de données (+) intéressant (que les autres) ?\nAjouter toy datasets pour les tests (ou piocher dans MASS ?)\n\nED : j'ai simulé un truc basique via 'generateXYdefault(10,5,6,2)'\n",
+ "created" : 1488803373820.000,
+ "dirty" : false,
+ "encoding" : "UTF-8",
+ "folds" : "",
+ "hash" : "560839226",
+ "id" : "9BC0CCC4",
+ "lastKnownWriteTime" : 1487753778,
+ "last_content_update" : 1487753778,
+ "path" : "~/valse/data/TODO",
+ "project_path" : "data/TODO",
+ "properties" : {
+ },
+ "relative_order" : 2,
+ "source_on_save" : false,
+ "source_window" : "",
+ "type" : "text"
+}
\ No newline at end of file
--- /dev/null
+{
+ "collab_server" : "",
+ "contents" : "constructionModelesLassoMLE = function(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,glambda,\n\tX,Y,seuil,tau,selected)\n{\n\t#TODO: parameter ncores (chaque tâche peut aussi demander du parallélisme...)\n\tcl = parallel::makeCluster( parallel::detectCores() / 4 )\n\tparallel::clusterExport(cl=cl,\n\t\tvarlist=c(\"phiInit\",\"rhoInit\",\"gamInit\",\"mini\",\"maxi\",\"glambda\",\"X\",\"Y\",\"seuil\",\"tau\"),\n\t\tenvir=environment())\n\t#Pour chaque lambda de la grille, on calcule les coefficients\n\tout = parLapply( seq_along(glambda), function(lambdaindex)\n\t{\n\t\tn = dim(X)[1]\n\t\tp = dim(phiInit)[1]\n\t\tm = dim(phiInit)[2]\n\t\tk = dim(phiInit)[3]\n\n\t\t#TODO: phiInit[selected] et X[selected] sont bien sûr faux; par quoi remplacer ?\n\t\t#lambda == 0 c'est normal ? -> ED : oui, ici on calcule le maximum de vraisembance, donc on ne pénalise plus\n res = EMGLLF(phiInit[selected],rhoInit,piInit,gamInit,mini,maxi,gamma,0.,X[selected],Y,tau)\n\n\t\t#comment évaluer la dimension à partir du résultat et de [not]selected ?\n #dimension = ...\n\n #on veut calculer la vraisemblance avec toutes nos estimations\n\t\tdensite = vector(\"double\",n)\n\t\tfor (r in 1:k)\n\t\t{\n\t\t\tdelta = Y%*%rho[,,r] - (X[selected]%*%res$phi[selected,,r])\n\t\t\tdensite = densite + pi[r] *\n\t\t\t\tdet(rho[,,r])/(sqrt(2*base::pi))^m * exp(-tcrossprod(delta)/2.0)\n\t\t}\n\t\tllh = c( sum(log(densite[,lambdaIndex])), (dimension+m+1)*k-1 )\n\t\tlist(\"phi\"=res$phi, \"rho\"=res$rho, \"pi\"=res$pi, \"llh\" = llh)\n\t})\n\tparallel::stopCluster(cl)\n\tout\n}\n",
+ "created" : 1488803513260.000,
+ "dirty" : false,
+ "encoding" : "UTF-8",
+ "folds" : "",
+ "hash" : "1470456796",
+ "id" : "C0098B3E",
+ "lastKnownWriteTime" : 1488803686,
+ "last_content_update" : 1488803686911,
+ "path" : "~/valse/R/constructionModelesLassoMLE.R",
+ "project_path" : "R/constructionModelesLassoMLE.R",
+ "properties" : {
+ },
+ "relative_order" : 4,
+ "source_on_save" : false,
+ "source_window" : "",
+ "type" : "r_source"
+}
\ No newline at end of file
+++ /dev/null
-.Rproj.user
-.Rhistory
-.RData
-.Ruserdata
-src/*.o
-src/*.so
-src/*.dll
k = dim(phiInit)[3]
#TODO: phiInit[selected] et X[selected] sont bien sûr faux; par quoi remplacer ?
- #lambda == 0 c'est normal ?
+ #lambda == 0 c'est normal ? -> ED : oui, ici on calcule le maximum de vraisembance, donc on ne pénalise plus
res = EMGLLF(phiInit[selected],rhoInit,piInit,gamInit,mini,maxi,gamma,0.,X[selected],Y,tau)
#comment évaluer la dimension à partir du résultat et de [not]selected ?
#dimension = ...
- #on veut calculer l'EMV avec toutes nos estimations
+ #on veut calculer la vraisemblance avec toutes nos estimations
densite = vector("double",n)
for (r in 1:k)
{