Beispiel #1
0
        /// <summary>
        ///   Creates a <see cref="SupportVectorMachine"/> that
        ///   attends the requisites specified in this model.
        /// </summary>
        ///
        /// <returns>A <see cref="SupportVectorMachine"/> that represents this model.</returns>
        ///
        public SupportVectorMachine CreateMachine()
        {
            // TODO: Add the option for creating Sparse machines from model definitions

            switch (type)
            {
            case LibSvmSolverType.Unknown:
                break;

            case LibSvmSolverType.L2RegularizedLogisticRegression:
            case LibSvmSolverType.L1RegularizedLogisticRegression:
            case LibSvmSolverType.L2RegularizedLogisticRegressionDual:
            case LibSvmSolverType.L2RegularizedL2LossSvc:
            case LibSvmSolverType.L2RegularizedL1LossSvcDual:
            case LibSvmSolverType.L2RegularizedL2LossSvcDual:
            case LibSvmSolverType.L1RegularizedL2LossSvc:
            case LibSvmSolverType.L2RegularizedL2LossSvr:
            case LibSvmSolverType.L2RegularizedL2LossSvrDual:
            case LibSvmSolverType.L2RegularizedL1LossSvrDual:
            {
                return(SupportVectorMachine.FromWeights(Weights, 0));
            }
            }

            throw new NotSupportedException("This solver type is unknown or not supported.");
        }
Beispiel #2
0
        /// <summary>
        ///   Creates a <see cref="SupportVectorMachine"/> that
        ///   attends the requisites specified in this model.
        /// </summary>
        ///
        /// <returns>A <see cref="SupportVectorMachine"/> that represents this model.</returns>
        ///
        public SupportVectorMachine CreateMachine()
        {
            switch (type)
            {
            case LibSvmSolverType.Unknown:
                break;

            case LibSvmSolverType.L2RegularizedLogisticRegression:
            case LibSvmSolverType.L1RegularizedLogisticRegression:
            case LibSvmSolverType.L2RegularizedLogisticRegressionDual:
            {
                var svm = SupportVectorMachine.FromWeights(Weights);
                svm.Link = new LogLinkFunction();
                return(svm);
            }

            case LibSvmSolverType.L2RegularizedL2LossSvc:
            case LibSvmSolverType.L2RegularizedL1LossSvcDual:
            case LibSvmSolverType.L2RegularizedL2LossSvcDual:
            case LibSvmSolverType.L1RegularizedL2LossSvc:
            case LibSvmSolverType.L2RegularizedL2LossSvr:
            case LibSvmSolverType.L2RegularizedL2LossSvrDual:
            case LibSvmSolverType.L2RegularizedL1LossSvrDual:
            {
                return(SupportVectorMachine.FromWeights(Weights));
            }
            }

            throw new NotSupportedException("This solver type is unknown or not supported.");
        }
Beispiel #3
0
 /// <summary>
 ///   Creates a <see cref="SupportVectorMachine"/> that
 ///   attends the requisites specified in this model.
 /// </summary>
 ///
 /// <returns>A <see cref="SupportVectorMachine"/> that represents this model.</returns>
 ///
 public SupportVectorMachine CreateMachine()
 {
     // TODO: Add the option for creating Sparse machines from model definitions
     return(SupportVectorMachine.FromWeights(Weights, 0));
 }