BIDData/BIDMach

Cannot find GLM.matrixOfScores? (Can't find an option that I set)

Closed this issue · 2 comments

Hi @jcanny (and @byeah , @xinleipan ),

I added in matrixOfScores for GLM.scala as an option. However, if you run the following simple script for GLM with a basic learner and data matrices on the stout machine:

import BIDMach.models.GLM._
import BIDMach.updaters._

// Basic in-memory GLM learner with explicit target matrix and d=1 for Logistic-Reg.
def learner(mat0:Mat, targ:Mat, d:Int) = {
    class LearnOptions extends Learner.Options with GLM.Opts with MatSource.Opts with MHTest.Opts with ADAGrad.Opts with L1Regularizer.Opts
    val mopts = new LearnOptions;
    if (mopts.links == null) mopts.links = izeros(1,targ.nrows)
    mopts.links.set(d)
    val model = new GLM(mopts)
    val mm = new Learner( 
        new MatSource(Array(mat0, targ), mopts), 
        model, 
        mkRegularizer(mopts),
        new MHTest(mopts), 
        null,
        mopts)
    (mm, mopts)
}

val (mm, mopts) = learner(rand(10,10), FMat(zeros(1,10)), 1)
mopts.matrixOfScores = true

For some reason the code cannot find matrixOfScores:

seita@stout:~/BIDMach$ ./bidmach odd_test.ssc 
Loading /home/seita/BIDMach/lib/bidmach_init.scala...
import BIDMat.{CMat, CSMat, DMat, Dict, FMat, FND, GMat, GDMat, GIMat, GLMat, GSMat, GSDMat, GND, HMat, IDict, Image, IMat, LMat, Mat, SMat, SBMat, SDMat, TMat}
import BIDMat.MatFunctions._
import BIDMat.SciFunctions._
import BIDMat.Solvers._
import BIDMat.Plotting._
import BIDMach.Learner
import BIDMach.models.{Click, FM, GLM, KMeans, KMeansw, LDA, LDAgibbs, Model, NMF, SFA, RandomForest, SVD}
import BIDMach.networks.Net
import BIDMach.datasources.{DataSource, MatSource, FileSource, SFileSource}
import BIDMach.datasinks.{DataSink, MatSink}
import BIDMach.mixins.{CosineSim, Perplexity, Top, L1Regularizer, L2Regularizer}
import BIDMach.updaters.{ADAGrad, Batch, BatchNorm, Grad, IncMult, IncNorm, Telescoping}
import BIDMach.causal.IPTW
2 CUDA devices found, CUDA version 8.0

Loading odd_test.ssc...
import BIDMach.models.GLM._
import BIDMach.updaters._
learner: (mat0: BIDMat.Mat, targ: BIDMat.Mat, d: Int)(BIDMach.Learner, BIDMach.Learner.Options with BIDMach.models.GLM.Opts with BIDMach.datasources.MatSource.Opts with BIDMach.updaters.MHTest.Opts with BIDMach.updaters.ADAGrad.Opts with BIDMach.mixins.L1Regularizer.Opts)
mm: BIDMach.Learner = Learner(BIDMach.datasources.MatSource@3efca5a,BIDMach.models.GLM@73cddcba,[LBIDMach.mixins.Mixin;@505672bb,BIDMach.updaters.MHTest@5b867c31,null,LearnOptions$1@5a43a3e8)
mopts: BIDMach.Learner.Options with BIDMach.models.GLM.Opts with BIDMach.datasources.MatSource.Opts with BIDMach.updaters.MHTest.Opts with BIDMach.updaters.ADAGrad.Opts with BIDMach.mixins.L1Regularizer.Opts = LearnOptions$1@5a43a3e8
<console>:38: error: value matrixOfScores is not a member of BIDMach.Learner.Options with BIDMach.models.GLM.Opts with BIDMach.datasources.MatSource.Opts with BIDMach.updaters.MHTest.Opts with BIDMach.updaters.ADAGrad.Opts with BIDMach.mixins.L1Regularizer.Opts
val $ires0 = mopts.matrixOfScores
                   ^
<console>:35: error: value matrixOfScores is not a member of BIDMach.Learner.Options with BIDMach.models.GLM.Opts with BIDMach.datasources.MatSource.Opts with BIDMach.updaters.MHTest.Opts with BIDMach.updaters.ADAGrad.Opts with BIDMach.mixins.L1Regularizer.Opts
       mopts.matrixOfScores = true

The strange thing is, this same exact script will work (that is, it correctly identifies matrixOfScores as a member of GLM.scala) on my personal machine, which are both Linux computers set on the latest version for BIDMach on the master branch (d772c15).

In other words, if I run this on my personal machine, the code runs without errors, but on stout, it doesn't? I also noticed that if I try to modify an existing GLM.scala parameter, it will work. Maybe it's a compiling issue? I git pull from the master branch and compile with mvn package. I also updated BIDMat this way (before updating BIDMach).

What is the correct way for me to get matrixOfScores as a recognizable parameter? Also, @byeah and @xinleipan if you could confirm or dis-confirm that you get this error please do so.

Hi Daniel,
Please just ask questions like this offline. This has nothing to do with BIDMach. For some reason, you're running old code on stout. Whatever your local set up is, the new compiled version isnt being called. There are a variety of reasons this could be happening. You would need a more thorough issue report to determine what it is.

If you're only calling "mvn package" then the new jar is available to maven, but is not copied into the lib directory. If you follow BIDMach installation instructions, you should do "mvn install" which will copy the jar in to lib as well.

Sorry, I didn't realize this was not an online question.

I tried mvn install and then mvn package (and I explicitly checked to make sure that GLM.scala contained the updated option matrixOfScores). However, I still seem to get the error. I will post a more detailed issue report this afternoon if it continues to be a problem.