Example #1
0
        public object Clone()
        {
            SVMNode clone = new SVMNode();

            clone.copy(this);
            return(clone);
        }
Example #2
0
        public void Copy(SVMModel rhs)
        {
            _param = rhs._param;
            _numberClass = rhs._numberClass;
            _totalNumberSV = rhs._totalNumberSV;            // total #SV
            _SV = new SVMNode[rhs._SV.Length][];    // SVs (SV[l])

            for (int i = 0; i < rhs._SV.Length; ++i)
            {
                _SV[i] = new SVMNode[rhs._SV[i].Length];
                for (int j = 0; j < rhs._SV[i].Length; ++j)
                {
                    _SV[i][j] = (SVMNode)rhs._SV[i][j].Clone();
                }
            }

            _coefSV = new double[rhs._coefSV.Length][];    // coefficients for SVs in decision functions (sv_coef[k-1][l])
            for (int i = 0; i < rhs._coefSV.Length; ++i)
            {
                _coefSV[i] = (double[])rhs._coefSV[i].Clone();
            }

            _rho = rhs._rho == null ? null : (double[]) rhs._rho.Clone();        // constants in decision functions (rho[k*(k-1)/2])
            ProbA = rhs.ProbA == null ? null : (double[]) rhs.ProbA.Clone();         // pariwise probability information
            ProbB = rhs.ProbB == null ? null : (double[]) rhs.ProbB.Clone();
            _indicesSV = rhs._indicesSV == null ? null : (int[]) rhs._indicesSV.Clone();       // sv_indices[0,...,nSV-1] are values in [1,...,num_traning_data] to indicate SVs in the training set

            // for classification only

            Label = rhs.Label == null ? null : (int[]) rhs.Label.Clone();        // label of each class (label[k])
            _numberSV4EachClass = rhs._numberSV4EachClass == null ? null : (int[]) rhs._numberSV4EachClass.Clone();        // number of SVs for each class (nSV[k])
        }
Example #3
0
 public void copy(SVMNode rhs)
 {
     index = rhs.index;
     value = rhs.value;
 }