浏览代码

fixes to novelty semseg

janetzki 11 年之前
父节点
当前提交
acb47ec1be
共有 3 个文件被更改,包括 20 次插入5 次删除
  1. 15 0
      FMKGPHyperparameterOptimization.cpp
  2. 2 2
      GPHIKClassifier.cpp
  3. 3 3
      algebra/LogDetApproxBaiAndGolub.cpp

+ 15 - 0
FMKGPHyperparameterOptimization.cpp

@@ -1796,6 +1796,19 @@ void FMKGPHyperparameterOptimization::restore ( std::istream & is, int format )
     is >> binaryLabelPositive;
     is >> tmp; // " binaryLabelNegative: "
     is >> binaryLabelNegative;          
+
+    is >> tmp; // "labels: "
+    is >> this->labels;
+
+    // first inefficient solution
+//    std::map<int, NICE::Vector> binaryLabels;
+  //  prepareBinaryLabels ( binaryLabels, this->labels , knownClasses );
+    knownClasses.clear();
+
+    for ( std::map<int, PrecomputedType>::const_iterator itA = precomputedA.begin(); itA != precomputedA.end(); itA++)
+    {
+        knownClasses.insert ( itA->first );
+    }
   }
   else
   {
@@ -1917,6 +1930,8 @@ void FMKGPHyperparameterOptimization::store ( std::ostream & os, int format ) co
     
     //store the class numbers for binary settings (if mc-settings, these values will be negative by default)
     os << "binaryLabelPositive: " << binaryLabelPositive << " binaryLabelNegative: " << binaryLabelNegative << std::endl;
+
+    os << "labels: " << this->labels << std::endl;
   }
   else
   {

+ 2 - 2
GPHIKClassifier.cpp

@@ -273,7 +273,7 @@ void GPHIKClassifier::restore ( std::istream & is, int format )
     is.precision (numeric_limits<double>::digits10 + 1);
     
     string tmp;
-    is >> tmp;    
+    is >> tmp;
     is >> confSection;
     
     if (pf != NULL)
@@ -352,4 +352,4 @@ void GPHIKClassifier::addMultipleExamples( const std::vector< const NICE::Sparse
     return;
   
   gphyper->addMultipleExamples( newExamples, newLabels, performOptimizationAfterIncrement );
-}
+}

+ 3 - 3
algebra/LogDetApproxBaiAndGolub.cpp

@@ -80,9 +80,9 @@ double LogDetApproxBaiAndGolub::getLogDetApproximationUpperBound(const double &
   if (  (lambdaUpperBound*n-mu1) != 0)
     tUpper = (lambdaUpperBound*mu1 - mu2) / (lambdaUpperBound*n-mu1);
 
-  if ( tUpper < 1e-10 ) {
-    fthrow(Exception, "LogDetApproxBaiAndGolub::getLogDetApproximationLowerBound: tUpper < 0.0 !! " << mu1 << " " << mu2 << " " << n << " " << lambdaUpperBound );
-  }
+//  if ( tUpper < 1e-10 ) {
+//    fthrow(Exception, "LogDetApproxBaiAndGolub::getLogDetApproximationLowerBound: tUpper < 0.0 !! " << mu1 << " " << mu2 << " " << n << " " << lambdaUpperBound );
+//  }
 
   // boundUpper = [log(beta) , log(tUpper)] * ([beta , tUpper; power(beta,2), power(tUpper,2)]^-1 * [mu1;mu2]);
   //inversion of a 2x2-matrix can be done explicitely: A^{-1} = \frac{1}{ad-bc} \bmatrix{ d & -b \\ -c & a}