Beispiel #1
0
 public SimpleLinearClassifier(SimpleLinearClassifier.ILoss loss, SimpleLinearClassifier.ILearningRateSchedule learningRateSchedule, double regularizationStrength, string modelFile)
 {
     if (modelFile != null)
     {
         try
         {
             if (modelFile.EndsWith(".tab.gz"))
             {
                 Timing.StartDoing("Reading " + modelFile);
                 this.weights = Counters.DeserializeStringCounter(modelFile);
                 Timing.EndDoing("Reading " + modelFile);
             }
             else
             {
                 this.weights = IOUtils.ReadObjectAnnouncingTimingFromURLOrClasspathOrFileSystem(log, "Loading coref model", modelFile);
             }
         }
         catch (Exception e)
         {
             throw new Exception("Error leading weights from " + modelFile, e);
         }
     }
     else
     {
         this.weights = new ClassicCounter <string>();
     }
     this.defaultLoss            = loss;
     this.regularizationStrength = regularizationStrength;
     this.learningRateSchedule   = learningRateSchedule;
     accessTimes  = new ClassicCounter <string>();
     examplesSeen = 0;
 }
Beispiel #2
0
 public SimpleLinearClassifier(SimpleLinearClassifier.ILoss loss, SimpleLinearClassifier.ILearningRateSchedule learningRateSchedule, double regularizationStrength)
     : this(loss, learningRateSchedule, regularizationStrength, null)
 {
 }
 public virtual PairwiseModel.Builder LearningRateSchedule(SimpleLinearClassifier.ILearningRateSchedule learningRateSchedule)
 {
     this.learningRateSchedule = learningRateSchedule;
     return(this);
 }