Thank you very much. I will use 1.7.1 version.  Have you had time to look at 
the issue regarding a weird behaviour of multinomial glmnet when alpha=0? I 
posted it to r-help more than two weeks ago and maybe you missed it. Damjan 
Krstajic
 Subject: Re: differences between 1.7 and 1.7.1 glmnet versions
From: has...@stanford.edu
Date: Thu, 29 Dec 2011 20:54:44 -0800
CC: r-help@r-project.org
To: dkrsta...@hotmail.com



I have just started using changelogs, and am clearly not disciplined enough at 
it.The big change that occurred was the convergence criterion, which would 
account for the difference.At some point will put up details of this.
Trevor Hastie
On Dec 26, 2011, at 11:55 PM, Damjan Krstajic wrote:
Dear All,
 
I have found differences between glmnet versions 1.7 and 1.7.1 which, in 
my opinion, are not cosmetic and do not appear in the ChangeLog. If I am 
not mistaken, glmnet appears to return different number of selected 
input variables, i.e. nonzeroCoef(fit$beta[[1]]) differes between 
versions. The code below is the same for 1.7.1 and 1.7, but you can see 
that outputs differ. I would automatically use the latest version, but 
by looking at the ChangeLog I wonder if this is a bug or expected 
behaviour, as this change is not documented.

Thanks in advance.
DK

############# glmnet 1.7.1
library(glmnet)
Loading required package: Matrix
Loading required package: lattice
Loaded glmnet 1.7.1
set.seed(1)
x=matrix(rnorm(40*500),40,500)
g4=sample(1:7,40,replace=TRUE)
fit=glmnet(x,g4,family="multinomial",alpha=0.1)
dgcBeta<- fit$beta[[1]]
which=nonzeroCoef(dgcBeta)
which
[1]   1  12  15  17  19  20  34  39  42  58  60  62  63  65  71  72 
73  77
[19]  80  82  85  86  95  97  98  99 106 110 113 114 119 120 123 124 
128 130
[37] 136 138 139 143 148 149 151 160 161 162 173 174 175 176 177 183 
186 187
[55] 188 190 193 194 195 198 199 204 206 218 224 238 239 240 241 245 
247 250
[73] 252 255 256 258 265 266 270 277 278 281 287 293 294 296 297 300 
306 308
[91] 311 316 317 321 326 329 336 337 341 349 354 356 363 365 368 374 
376 377
[109] 379 384 385 389 397 398 400 403 404 407 415 417 418 423 424 430 
432 437
[127] 440 442 446 450 451 454 456 459 463 467 470 472 474 478 481 488 
496 497
[145] 498 500
# just to check that inputs to glmnet are the same
g4
[1] 5 4 5 3 2 6 1 6 6 1 3 6 1 2 6 3 7 2 6 7 6 7 5 1 3 2 2 3 2 3 3 1 5 
6 7 4 6 3
[39] 2 7
x[,1]
[1] -0.62645381  0.18364332 -0.83562861  1.59528080  0.32950777 
-0.82046838
[7]  0.48742905  0.73832471  0.57578135 -0.30538839  1.51178117 
0.38984324
[13] -0.62124058 -2.21469989  1.12493092 -0.04493361 -0.01619026  0.94383621
[19]  0.82122120  0.59390132  0.91897737  0.78213630  0.07456498 -1.98935170
[25]  0.61982575 -0.05612874 -0.15579551 -1.47075238 -0.47815006  0.41794156
[31]  1.35867955 -0.10278773  0.38767161 -0.05380504 -1.37705956 -0.41499456
[37] -0.39428995 -0.05931340  1.10002537  0.76317575


################ glmnet 1.7
library(glmnet)
Loading required package: Matrix
Loading required package: lattice
Loaded glmnet 1.7
set.seed(1)
x=matrix(rnorm(40*500),40,500)
g4=sample(1:7,40,replace=TRUE)
fit=glmnet(x,g4,family="multinomial",alpha=0.1)
dgcBeta<- fit$beta[[1]]
which=nonzeroCoef(dgcBeta)
which
[1]   1   2   3   4   6   7   8   9  10  11  12  13  14  15  16  17 
18  19
[19]  20  21  22  23  24  25  26  27  28  30  31  32  33  34  35  36 
37  38
[37]  39  41  42  43  44  45  46  47  48  50  51  52  53  54  55  56 
57  58
[55]  59  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74 
75  76
[73]  77  78  79  80  81  82  83  84  85  86  87  88  89  91  93  94 
95  97
[91]  98  99 100 101 102 104 105 106 107 109 110 111 112 113 114 115 
116 119
[109] 120 121 122 123 124 126 127 128 130 131 132 133 134 135 136 137 
138 139
[127] 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 156 
157 159
[145] 160 161 162 163 164 165 167 168 170 171 172 173 174 175 176 177 
178 179
[163] 180 181 182 183 184 185 186 187 188 189 190 191 193 194 195 196 
197 198
[181] 199 200 203 204 205 206 207 208 209 211 212 213 215 216 217 218 
219 220
[199] 221 222 223 224 225 226 227 228 229 231 232 233 234 235 236 237 
238 239
[217] 240 241 242 243 244 245 246 247 248 249 250 251 252 253 255 256 
257 258
[235] 259 261 262 263 264 265 266 268 269 270 271 272 273 274 275 276 
277 278
[253] 279 280 281 282 283 285 286 287 288 289 290 291 292 293 294 295 
296 297
[271] 298 299 300 301 302 304 305 306 307 308 309 310 311 312 313 314 
315 316
[289] 317 318 319 321 323 324 325 326 327 328 329 330 331 332 333 334 
336 337
[307] 338 339 341 342 343 344 345 346 347 348 349 350 351 352 353 354 
355 356
[325] 357 358 361 362 363 364 365 366 367 368 369 370 371 372 373 374 
375 376
[343] 377 378 379 380 381 382 384 385 386 388 389 390 393 394 395 396 
397 398
[361] 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 
415 417
[379] 418 420 421 422 423 424 425 426 427 428 429 430 432 433 434 436 
437 438
[397] 439 440 441 442 443 444 445 446 448 450 451 452 453 454 455 456 
457 458
[415] 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 
475 476
[433] 477 478 479 480 481 482 483 484 486 488 489 490 491 493 494 495 
496 497
[451] 498 499 500
# just to check that inputs to glmnet are the same
g4
[1] 5 4 5 3 2 6 1 6 6 1 3 6 1 2 6 3 7 2 6 7 6 7 5 1 3 2 2 3 2 3 3 1 5 
6 7 4 6 3
[39] 2 7
x[,1]
[1] -0.62645381  0.18364332 -0.83562861  1.59528080  0.32950777 
-0.82046838
[7]  0.48742905  0.73832471  0.57578135 -0.30538839  1.51178117 
0.38984324
[13] -0.62124058 -2.21469989  1.12493092 -0.04493361 -0.01619026  0.94383621
[19]  0.82122120  0.59390132  0.91897737  0.78213630  0.07456498 -1.98935170
[25]  0.61982575 -0.05612874 -0.15579551 -1.47075238 -0.47815006  0.41794156
[31]  1.35867955 -0.10278773  0.38767161 -0.05380504 -1.37705956 -0.41499456
[37] -0.39428995 -0.05931340  1.10002537  0.76317575
                                          

 
----------------------------------------------------------------------------------------
  Trevor Hastie                                   has...@stanford.edu    
Professor, Department of Statistics, Stanford University  Phone: (650) 725-2231 
                Fax: (650) 725-8977    URL: http://www.stanford.edu/~hastie     
address: room 104, Department of Statistics, Sequoia Hall           390 Serra 
Mall, Stanford University, CA 94305-4065   
--------------------------------------------------------------------------------------



                                          
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to