Exemplo n.º 1
0
 public void Load(BinarySerializer reader)
 {
     Utils.ThrowException(reader == null ? new ArgumentNullException("reader") : null);
     Dispose();
     // the following statements throw serialization-related exceptions
     mVerbosityLevel = (SvmLightVerbosityLevel)reader.ReadInt();
     mC = reader.ReadDouble();
     mBiasedHyperplane   = reader.ReadBool();
     mKernelType         = (SvmLightKernelType)reader.ReadInt();
     mKernelParamGamma   = reader.ReadDouble();
     mKernelParamD       = reader.ReadDouble();
     mKernelParamS       = reader.ReadDouble();
     mKernelParamC       = reader.ReadDouble();
     mBiasedCostFunction = reader.ReadBool();
     mCustomParams       = reader.ReadString();
     mEps     = reader.ReadDouble();
     mMaxIter = reader.ReadInt();
     mIdxToLbl.Load(reader);
     mLblCmp = reader.ReadObject <IEqualityComparer <LblT> >();
     if (reader.ReadBool())
     {
         SvmLightLib.ReadByteCallback rb = delegate() { return(reader.ReadByte()); };
         mModelId = SvmLightLib.LoadModelBinCallback(rb);
         GC.KeepAlive(rb);
     }
 }
Exemplo n.º 2
0
 public void Load(BinarySerializer reader)
 {
     Utils.ThrowException(reader == null ? new ArgumentNullException("reader") : null);
     Dispose();
     // the following statements throw serialization-related exceptions
     mVerbosityLevel = (SvmLightVerbosityLevel)reader.ReadInt();
     mC = reader.ReadDouble();
     mBiasedHyperplane   = reader.ReadBool();
     mKernelType         = (SvmLightKernelType)reader.ReadInt();
     mKernelParamGamma   = reader.ReadDouble();
     mKernelParamD       = reader.ReadDouble();
     mKernelParamS       = reader.ReadDouble();
     mKernelParamC       = reader.ReadDouble();
     mBiasedCostFunction = reader.ReadBool();
     mCustomParams       = reader.ReadString();
     mEps     = reader.ReadDouble();
     mMaxIter = reader.ReadInt();
     mIdxToLbl.Load(reader);
     mLblCmp = reader.ReadObject <IEqualityComparer <LblT> >();
     if (reader.ReadBool())
     {
         SvmLightLib.ReadByteCallback rb = delegate() { return(reader.ReadByte()); };
         try
         {
             mModelId = SvmLightLib.LoadModelBinCallback(rb);
         }
         catch (BadImageFormatException e)
         {
             string assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
             throw new BadImageFormatException(e.Message + "\n assembly path: " + assemblyPath, e);
         }
         GC.KeepAlive(rb);
     }
 }