Exemplo n.º 1
0
        // *** ISerializable interface implementation ***

        public void Save(BinarySerializer writer)
        {
            Utils.ThrowException(writer == null ? new ArgumentNullException("writer") : null);
            // the following statements throw serialization-related exceptions
            writer.WriteInt((int)mVerbosityLevel);
            writer.WriteDouble(mC);
            writer.WriteBool(mBiasedHyperplane);
            writer.WriteInt((int)mKernelType);
            writer.WriteDouble(mKernelParamGamma);
            writer.WriteDouble(mKernelParamD);
            writer.WriteDouble(mKernelParamS);
            writer.WriteDouble(mKernelParamC);
            writer.WriteBool(mBiasedCostFunction);
            writer.WriteString(mCustomParams);
            writer.WriteDouble(mEps);
            writer.WriteInt(mMaxIter);
            mIdxToLbl.Save(writer);
            writer.WriteObject(mLblCmp);
            writer.WriteBool(mModelId != -1);
            if (mModelId != -1)
            {
                SvmLightLib.WriteByteCallback wb = delegate(byte b) { writer.WriteByte(b); };
                SvmLightLib.SaveModelBinCallback(mModelId, wb);
                GC.KeepAlive(wb);
            }
        }
Exemplo n.º 2
0
        // *** ISerializable interface implementation ***

        public void Save(BinarySerializer writer)
        {
            Utils.ThrowException(writer == null ? new ArgumentNullException("writer") : null);
            // the following statements throw serialization-related exceptions
            //writer.WriteDouble(mC);
            //writer.WriteDouble(mEps);
            mIdxToLbl.Save(writer);
            writer.WriteObject(mLblCmp);
            writer.WriteBool(mModelId != -1);
            if (mModelId != -1)
            {
                SvmLightLib.WriteByteCallback wb = delegate(byte b) { writer.WriteByte(b); };
                SvmLightLib.SaveModelBinCallback(mModelId, wb);
                GC.KeepAlive(wb);
            }
        }