From 7411013519fc6aef07280502d7d201e5ca177e0c Mon Sep 17 00:00:00 2001 From: emilie Date: Mon, 6 Mar 2017 13:37:22 +0100 Subject: [PATCH] add comment in constructionMdodelesLassoMLE.R --- .Rbuildignore | 2 -- .Rproj.user/40465803/cpp-definition-cache | 2 ++ .../40465803/pcs/debug-breakpoints.pper | 6 ++++++ .Rproj.user/40465803/pcs/files-pane.pper | 9 ++++++++ .Rproj.user/40465803/pcs/source-pane.pper | 3 +++ .../40465803/pcs/windowlayoutstate.pper | 14 +++++++++++++ .Rproj.user/40465803/pcs/workbench-pane.pper | 6 ++++++ .Rproj.user/40465803/persistent-state | 9 ++++++++ .Rproj.user/40465803/saved_source_markers | 1 + .Rproj.user/40465803/sdb/prop/15D1CEE0 | 3 +++ .Rproj.user/40465803/sdb/prop/2A6B202E | 2 ++ .Rproj.user/40465803/sdb/prop/351F6E98 | 2 ++ .Rproj.user/40465803/sdb/prop/36AA59D8 | 2 ++ .Rproj.user/40465803/sdb/prop/3DB2E8C6 | 2 ++ .Rproj.user/40465803/sdb/prop/54FEEFED | 2 ++ .Rproj.user/40465803/sdb/prop/6D8AB60A | 2 ++ .Rproj.user/40465803/sdb/prop/71C1A532 | 2 ++ .Rproj.user/40465803/sdb/prop/78CD3B09 | 2 ++ .Rproj.user/40465803/sdb/prop/7FF0D303 | 2 ++ .Rproj.user/40465803/sdb/prop/8ED40402 | 2 ++ .Rproj.user/40465803/sdb/prop/93E132E4 | 2 ++ .Rproj.user/40465803/sdb/prop/96854E8B | 2 ++ .Rproj.user/40465803/sdb/prop/B5669ED5 | 2 ++ .Rproj.user/40465803/sdb/prop/D6E1266A | 2 ++ .Rproj.user/40465803/sdb/prop/F342C3E6 | 2 ++ .Rproj.user/40465803/sdb/prop/INDEX | 16 ++++++++++++++ .Rproj.user/40465803/sdb/s-B9318FF6/46694A18 | 21 +++++++++++++++++++ .Rproj.user/40465803/sdb/s-B9318FF6/5519E2E7 | 20 ++++++++++++++++++ .Rproj.user/40465803/sdb/s-B9318FF6/9BC0CCC4 | 20 ++++++++++++++++++ .Rproj.user/40465803/sdb/s-B9318FF6/C0098B3E | 20 ++++++++++++++++++ .Rproj.user/40465803/sdb/s-B9318FF6/lock_file | 0 .gitignore | 7 ------- R/constructionModelesLassoMLE.R | 4 ++-- 33 files changed, 182 insertions(+), 11 deletions(-) delete mode 100644 .Rbuildignore create mode 100644 .Rproj.user/40465803/cpp-definition-cache create mode 100644 .Rproj.user/40465803/pcs/debug-breakpoints.pper create mode 100644 .Rproj.user/40465803/pcs/files-pane.pper create mode 100644 .Rproj.user/40465803/pcs/source-pane.pper create mode 100644 .Rproj.user/40465803/pcs/windowlayoutstate.pper create mode 100644 .Rproj.user/40465803/pcs/workbench-pane.pper create mode 100644 .Rproj.user/40465803/persistent-state create mode 100644 .Rproj.user/40465803/saved_source_markers create mode 100644 .Rproj.user/40465803/sdb/prop/15D1CEE0 create mode 100644 .Rproj.user/40465803/sdb/prop/2A6B202E create mode 100644 .Rproj.user/40465803/sdb/prop/351F6E98 create mode 100644 .Rproj.user/40465803/sdb/prop/36AA59D8 create mode 100644 .Rproj.user/40465803/sdb/prop/3DB2E8C6 create mode 100644 .Rproj.user/40465803/sdb/prop/54FEEFED create mode 100644 .Rproj.user/40465803/sdb/prop/6D8AB60A create mode 100644 .Rproj.user/40465803/sdb/prop/71C1A532 create mode 100644 .Rproj.user/40465803/sdb/prop/78CD3B09 create mode 100644 .Rproj.user/40465803/sdb/prop/7FF0D303 create mode 100644 .Rproj.user/40465803/sdb/prop/8ED40402 create mode 100644 .Rproj.user/40465803/sdb/prop/93E132E4 create mode 100644 .Rproj.user/40465803/sdb/prop/96854E8B create mode 100644 .Rproj.user/40465803/sdb/prop/B5669ED5 create mode 100644 .Rproj.user/40465803/sdb/prop/D6E1266A create mode 100644 .Rproj.user/40465803/sdb/prop/F342C3E6 create mode 100644 .Rproj.user/40465803/sdb/prop/INDEX create mode 100644 .Rproj.user/40465803/sdb/s-B9318FF6/46694A18 create mode 100644 .Rproj.user/40465803/sdb/s-B9318FF6/5519E2E7 create mode 100644 .Rproj.user/40465803/sdb/s-B9318FF6/9BC0CCC4 create mode 100644 .Rproj.user/40465803/sdb/s-B9318FF6/C0098B3E create mode 100644 .Rproj.user/40465803/sdb/s-B9318FF6/lock_file delete mode 100644 .gitignore diff --git a/.Rbuildignore b/.Rbuildignore deleted file mode 100644 index 91114bf..0000000 --- a/.Rbuildignore +++ /dev/null @@ -1,2 +0,0 @@ -^.*\.Rproj$ -^\.Rproj\.user$ diff --git a/.Rproj.user/40465803/cpp-definition-cache b/.Rproj.user/40465803/cpp-definition-cache new file mode 100644 index 0000000..32960f8 --- /dev/null +++ b/.Rproj.user/40465803/cpp-definition-cache @@ -0,0 +1,2 @@ +[ +] \ No newline at end of file diff --git a/.Rproj.user/40465803/pcs/debug-breakpoints.pper b/.Rproj.user/40465803/pcs/debug-breakpoints.pper new file mode 100644 index 0000000..5528aea --- /dev/null +++ b/.Rproj.user/40465803/pcs/debug-breakpoints.pper @@ -0,0 +1,6 @@ +{ + "debugBreakpointsState" : { + "breakpoints" : [ + ] + } +} \ No newline at end of file diff --git a/.Rproj.user/40465803/pcs/files-pane.pper b/.Rproj.user/40465803/pcs/files-pane.pper new file mode 100644 index 0000000..610ac35 --- /dev/null +++ b/.Rproj.user/40465803/pcs/files-pane.pper @@ -0,0 +1,9 @@ +{ + "path" : "~", + "sortOrder" : [ + { + "ascending" : true, + "columnIndex" : 2 + } + ] +} \ No newline at end of file diff --git a/.Rproj.user/40465803/pcs/source-pane.pper b/.Rproj.user/40465803/pcs/source-pane.pper new file mode 100644 index 0000000..9efb51b --- /dev/null +++ b/.Rproj.user/40465803/pcs/source-pane.pper @@ -0,0 +1,3 @@ +{ + "activeTab" : -1 +} \ No newline at end of file diff --git a/.Rproj.user/40465803/pcs/windowlayoutstate.pper b/.Rproj.user/40465803/pcs/windowlayoutstate.pper new file mode 100644 index 0000000..569ac98 --- /dev/null +++ b/.Rproj.user/40465803/pcs/windowlayoutstate.pper @@ -0,0 +1,14 @@ +{ + "left" : { + "panelheight" : 993, + "splitterpos" : 412, + "topwindowstate" : "HIDE", + "windowheight" : 1031 + }, + "right" : { + "panelheight" : 993, + "splitterpos" : 618, + "topwindowstate" : "NORMAL", + "windowheight" : 1031 + } +} \ No newline at end of file diff --git a/.Rproj.user/40465803/pcs/workbench-pane.pper b/.Rproj.user/40465803/pcs/workbench-pane.pper new file mode 100644 index 0000000..f22d60c --- /dev/null +++ b/.Rproj.user/40465803/pcs/workbench-pane.pper @@ -0,0 +1,6 @@ +{ + "TabSet1" : 2, + "TabSet2" : 0, + "TabZoom" : { + } +} \ No newline at end of file diff --git a/.Rproj.user/40465803/persistent-state b/.Rproj.user/40465803/persistent-state new file mode 100644 index 0000000..edcabd7 --- /dev/null +++ b/.Rproj.user/40465803/persistent-state @@ -0,0 +1,9 @@ +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" diff --git a/.Rproj.user/40465803/saved_source_markers b/.Rproj.user/40465803/saved_source_markers new file mode 100644 index 0000000..2b1bef1 --- /dev/null +++ b/.Rproj.user/40465803/saved_source_markers @@ -0,0 +1 @@ +{"active_set":"","sets":[]} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/15D1CEE0 b/.Rproj.user/40465803/sdb/prop/15D1CEE0 new file mode 100644 index 0000000..32390ac --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/15D1CEE0 @@ -0,0 +1,3 @@ +{ + "tempName" : "Untitled1" +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/2A6B202E b/.Rproj.user/40465803/sdb/prop/2A6B202E new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/2A6B202E @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/351F6E98 b/.Rproj.user/40465803/sdb/prop/351F6E98 new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/351F6E98 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/36AA59D8 b/.Rproj.user/40465803/sdb/prop/36AA59D8 new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/36AA59D8 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/3DB2E8C6 b/.Rproj.user/40465803/sdb/prop/3DB2E8C6 new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/3DB2E8C6 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/54FEEFED b/.Rproj.user/40465803/sdb/prop/54FEEFED new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/54FEEFED @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/6D8AB60A b/.Rproj.user/40465803/sdb/prop/6D8AB60A new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/6D8AB60A @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/71C1A532 b/.Rproj.user/40465803/sdb/prop/71C1A532 new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/71C1A532 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/78CD3B09 b/.Rproj.user/40465803/sdb/prop/78CD3B09 new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/78CD3B09 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/7FF0D303 b/.Rproj.user/40465803/sdb/prop/7FF0D303 new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/7FF0D303 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/8ED40402 b/.Rproj.user/40465803/sdb/prop/8ED40402 new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/8ED40402 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/93E132E4 b/.Rproj.user/40465803/sdb/prop/93E132E4 new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/93E132E4 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/96854E8B b/.Rproj.user/40465803/sdb/prop/96854E8B new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/96854E8B @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/B5669ED5 b/.Rproj.user/40465803/sdb/prop/B5669ED5 new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/B5669ED5 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/D6E1266A b/.Rproj.user/40465803/sdb/prop/D6E1266A new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/D6E1266A @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/F342C3E6 b/.Rproj.user/40465803/sdb/prop/F342C3E6 new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/F342C3E6 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/.Rproj.user/40465803/sdb/prop/INDEX b/.Rproj.user/40465803/sdb/prop/INDEX new file mode 100644 index 0000000..c89d5de --- /dev/null +++ b/.Rproj.user/40465803/sdb/prop/INDEX @@ -0,0 +1,16 @@ +~%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" diff --git a/.Rproj.user/40465803/sdb/s-B9318FF6/46694A18 b/.Rproj.user/40465803/sdb/s-B9318FF6/46694A18 new file mode 100644 index 0000000..7ccc15c --- /dev/null +++ b/.Rproj.user/40465803/sdb/s-B9318FF6/46694A18 @@ -0,0 +1,21 @@ +{ + "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 diff --git a/.Rproj.user/40465803/sdb/s-B9318FF6/5519E2E7 b/.Rproj.user/40465803/sdb/s-B9318FF6/5519E2E7 new file mode 100644 index 0000000..2fa3989 --- /dev/null +++ b/.Rproj.user/40465803/sdb/s-B9318FF6/5519E2E7 @@ -0,0 +1,20 @@ +{ + "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 diff --git a/.Rproj.user/40465803/sdb/s-B9318FF6/9BC0CCC4 b/.Rproj.user/40465803/sdb/s-B9318FF6/9BC0CCC4 new file mode 100644 index 0000000..ccd4fad --- /dev/null +++ b/.Rproj.user/40465803/sdb/s-B9318FF6/9BC0CCC4 @@ -0,0 +1,20 @@ +{ + "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 diff --git a/.Rproj.user/40465803/sdb/s-B9318FF6/C0098B3E b/.Rproj.user/40465803/sdb/s-B9318FF6/C0098B3E new file mode 100644 index 0000000..ba216a8 --- /dev/null +++ b/.Rproj.user/40465803/sdb/s-B9318FF6/C0098B3E @@ -0,0 +1,20 @@ +{ + "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 diff --git a/.Rproj.user/40465803/sdb/s-B9318FF6/lock_file b/.Rproj.user/40465803/sdb/s-B9318FF6/lock_file new file mode 100644 index 0000000..e69de29 diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 56843bc..0000000 --- a/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -.Rproj.user -.Rhistory -.RData -.Ruserdata -src/*.o -src/*.so -src/*.dll diff --git a/R/constructionModelesLassoMLE.R b/R/constructionModelesLassoMLE.R index 55e9419..50879c9 100644 --- a/R/constructionModelesLassoMLE.R +++ b/R/constructionModelesLassoMLE.R @@ -15,13 +15,13 @@ constructionModelesLassoMLE = function(phiInit,rhoInit,piInit,gamInit,mini,maxi, 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) { -- 2.44.0