Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/07/09 11:58:21 (15 years ago)
Author:
gkronber
Message:

Updated LibSVM project to latest version. #774

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/LibSVM/Parameter.cs

    r1819 r2415  
    1919
    2020using System;
     21using System.Linq;
     22using System.Collections.Generic;
    2123
    2224namespace SVM
    2325{
    24     /// <remarks>
     26    /// <summary>
    2527    /// Contains all of the types of SVM this library can model.
    26     /// </remarks>
     28    /// </summary>
    2729    public enum SvmType {
    2830        /// <summary>
     
    4749        NU_SVR
    4850    };
    49     /// <remarks>
     51    /// <summary>
    5052    /// Contains the various kernel types this library can use.
    51     /// </remarks>
     53    /// </summary>
    5254    public enum KernelType {
    5355        /// <summary>
     
    7375    };
    7476
    75     /// <remarks>
     77    /// <summary>
    7678    /// This class contains the various parameters which can affect the way in which an SVM
    7779    /// is learned.  Unless you know what you are doing, chances are you are best off using
    7880    /// the default values.
    79     /// </remarks>
     81    /// </summary>
    8082  [Serializable]
    8183  public class Parameter : ICloneable
     
    9193        private double _eps;
    9294
    93         private int _weightCount;
    94         private int[] _weightLabels;
    95         private double[] _weights;
     95        private Dictionary<int, double> _weights;
    9696        private double _nu;
    9797        private double _p;
     
    116116            _shrinking = true;
    117117            _probability = false;
    118             _weightCount = 0;
    119             _weightLabels = new int[0];
    120             _weights = new double[0];
     118            _weights = new Dictionary<int, double>();
    121119        }
    122120
     
    234232            }
    235233        }
    236         /// <summary>
    237         /// Number of weights.
    238         /// </summary>
    239         public int WeightCount
    240         {
    241             get
    242             {
    243                 return _weightCount;
    244             }
    245             set
    246             {
    247                 _weightCount = value;
    248             }
    249         }
    250         /// <summary>
    251         /// Array of indicies corresponding to the Weights array (for C-SVC)
    252         /// </summary>
    253         public int[] WeightLabels
    254         {
    255             get
    256             {
    257                 return _weightLabels;
    258             }
    259             set
    260             {
    261                 _weightLabels = value;
    262             }
    263         }
    264         /// <summary>
    265         /// The parameter C of class i to weight*C in C-SVC (default 1)
    266         /// </summary>
    267         public double[] Weights
    268         {
    269             get
    270             {
     234
     235        /// <summary>
     236        /// Contains custom weights for class labels.  Default weight value is 1.
     237        /// </summary>
     238        public Dictionary<int,double> Weights
     239        {
     240            get{
    271241                return _weights;
    272242            }
    273             set
    274             {
    275                 _weights = value;
    276             }
    277         }
     243        }
     244
    278245        /// <summary>
    279246        /// The parameter nu of nu-SVC, one-class SVM, and nu-SVR (default 0.5)
Note: See TracChangeset for help on using the changeset viewer.