예제 #1
0
        public double[] GetLinearWeights()
        {
            Utils.ThrowException(mModelId == -1 ? new InvalidOperationException() : null);
            Utils.ThrowException(mKernelType != SvmLightKernelType.Linear ? new InvalidOperationException() : null);
            if (mWeights != null)
            {
                return(mWeights);
            }
            int featureCount = SvmLightLib.GetFeatureCount(mModelId);

            double[] weights = new double[featureCount];
            for (int i = 0; i < featureCount; i++)
            {
                weights[i] = SvmLightLib.GetLinearWeight(mModelId, i);
            }
            mWeights = weights;
            return(weights);
        }