示例#1
0
 public static extern ErrorType batch_cached_double(SvmKernelType kernelType,
                                                    MatrixElementType type,
                                                    SvmBatchTrainerType trainerType,
                                                    IntPtr trainer,
                                                    double minLearningRate,
                                                    int cacheSize,
                                                    out IntPtr ret);
示例#2
0
 public static extern ErrorType verbose_batch_cached_float(SvmKernelType kernelType,
                                                           MatrixElementType type,
                                                           SvmBatchTrainerType trainerType,
                                                           IntPtr trainer,
                                                           float minLearningRate,
                                                           int cacheSize,
                                                           out IntPtr ret);
示例#3
0
 public static extern ErrorType batch_trainer_train(SvmKernelType kernel_type,
                                                    MatrixElementType type,
                                                    SvmBatchTrainerType trainer_type,
                                                    IntPtr trainer,
                                                    IntPtr x,
                                                    IntPtr y,
                                                    out IntPtr ret);
示例#4
0
        internal static NativeMethods.SvmKernelType ToNativeKernelType(this SvmKernelType kernelType)
        {
            switch (kernelType)
            {
            case SvmKernelType.HistogramIntersection:
                return(NativeMethods.SvmKernelType.Histogramintersection);

            case SvmKernelType.Linear:
                return(NativeMethods.SvmKernelType.Linear);

            case SvmKernelType.Offset:
                return(NativeMethods.SvmKernelType.Offset);

            case SvmKernelType.Polynomial:
                return(NativeMethods.SvmKernelType.Polynomial);

            case SvmKernelType.RadialBasis:
                return(NativeMethods.SvmKernelType.RadialBasis);

            case SvmKernelType.Sigmoid:
                return(NativeMethods.SvmKernelType.Sigmoid);

            default:
                throw new ArgumentOutOfRangeException(nameof(kernelType), kernelType, null);
            }
        }
示例#5
0
 public static extern ErrorType kcentroid_operator_float(SvmKernelType kernelType,
                                                         MatrixElementType type,
                                                         int templateRows,
                                                         int templateColumns,
                                                         IntPtr obj,
                                                         IntPtr sample,
                                                         out float ret);
示例#6
0
 public static extern ErrorType kkmeans_operator(SvmKernelType kernelType,
                                                 MatrixElementType type,
                                                 int templateRows,
                                                 int templateColumns,
                                                 IntPtr kkmeans,
                                                 IntPtr sample,
                                                 out uint ret);
示例#7
0
        public static void GetTypes <TScalar, TTrainer>(out Type trainerType,
                                                        out NativeMethods.SvmBatchTrainerType svmTrainerType,
                                                        out SvmKernelType svmKernelType,
                                                        out MatrixElementTypes sampleType)
            where TScalar : struct
            where TTrainer : Trainer <TScalar>
        {
            trainerType = typeof(TTrainer);
            var svmTrainer = trainerType.GetGenericTypeDefinition();

            if (!BatchTrainerTypesRepository.Types.TryGetValue(svmTrainer, out svmTrainerType))
            {
                throw new ArgumentException();
            }

            var kernelType = trainerType.GenericTypeArguments[1].GetGenericTypeDefinition();

            if (!KernelTypesRepository.KernelTypes.TryGetValue(kernelType, out svmKernelType))
            {
                throw new ArgumentException();
            }

            var elementType = trainerType.GenericTypeArguments[0];

            if (!KernelTypesRepository.ElementTypes.TryGetValue(elementType, out sampleType))
            {
                throw new ArgumentException();
            }
        }
示例#8
0
 public static extern ErrorType krls_train_double(SvmKernelType kernelType,
                                                  MatrixElementType type,
                                                  int templateRows,
                                                  int templateColumns,
                                                  IntPtr obj,
                                                  IntPtr x,
                                                  double y);
示例#9
0
 public static extern ErrorType deserialize_krls(byte[] filName,
                                                 SvmKernelType kernelType,
                                                 MatrixElementType matrixElementType,
                                                 int templateRows,
                                                 int templateColumns,
                                                 IntPtr obj,
                                                 out IntPtr errorMessage);
示例#10
0
 public static extern ErrorType normalized_function_set_function(SvmKernelType kernelType,
                                                                 MatrixElementType type,
                                                                 int templateRows,
                                                                 int templateColumns,
                                                                 SvmFunctionType function_type,
                                                                 IntPtr function,
                                                                 IntPtr sub_function);
示例#11
0
 public static extern ErrorType kkmeans_get_kcentroid(SvmKernelType kernelType,
                                                      MatrixElementType type,
                                                      int templateRows,
                                                      int templateColumns,
                                                      IntPtr kkmeans,
                                                      uint i,
                                                      out IntPtr kcentroid);
示例#12
0
 public static extern ErrorType decision_function_operator_float(SvmKernelType kernelType,
                                                                 MatrixElementType type,
                                                                 int templateRows,
                                                                 int templateColumns,
                                                                 IntPtr function,
                                                                 IntPtr sample,
                                                                 out float ret);
示例#13
0
 public static extern ErrorType krls_operator_double(SvmKernelType kernelType,
                                                     MatrixElementType type,
                                                     int templateRows,
                                                     int templateColumns,
                                                     IntPtr obj,
                                                     IntPtr sample,
                                                     out double ret);
示例#14
0
 public static extern ErrorType normalized_function_get_normalizer(SvmKernelType kernelType,
                                                                   MatrixElementType type,
                                                                   int templateRows,
                                                                   int templateColumns,
                                                                   SvmFunctionType function_type,
                                                                   IntPtr function,
                                                                   out IntPtr ret);
示例#15
0
 public static extern ErrorType deserialize_decision_function(byte[] filName,
                                                              SvmKernelType kernelType,
                                                              MatrixElementType matrixElementType,
                                                              int templateRows,
                                                              int templateColumns,
                                                              out IntPtr function,
                                                              out IntPtr errorMessage);
示例#16
0
 public static extern ErrorType svm_pegasos_new2_double(SvmKernelType kernelType,
                                                        MatrixElementType type,
                                                        IntPtr kernel,
                                                        double lambda,
                                                        double tolerance,
                                                        uint max_num_sv,
                                                        out IntPtr ret);
示例#17
0
        public static TKernel Create <TKernel, TScalar, TSample>(IntPtr ptr,
                                                                 SvmKernelType kernelType,
                                                                 int templateRow,
                                                                 int templateColumn,
                                                                 bool isEnabledDispose = true)
            where TKernel : KernelBase
            where TScalar : struct
            where TSample : Matrix <TScalar>, new()
        {
            switch (kernelType)
            {
            case SvmKernelType.HistogramIntersection:
                return(new HistogramIntersectionKernel <TScalar, TSample>(ptr, templateRow, templateColumn, isEnabledDispose) as TKernel);

            case SvmKernelType.Linear:
                return(new LinearKernel <TScalar, TSample>(ptr, templateRow, templateColumn, isEnabledDispose) as TKernel);

            case SvmKernelType.Polynomial:
                return(new PolynomialKernel <TScalar, TSample>(ptr, templateRow, templateColumn, isEnabledDispose) as TKernel);

            case SvmKernelType.RadialBasis:
                return(new RadialBasisKernel <TScalar, TSample>(ptr, templateRow, templateColumn, isEnabledDispose) as TKernel);

            case SvmKernelType.Sigmoid:
                return(new SigmoidKernel <TScalar, TSample>(ptr, templateRow, templateColumn, isEnabledDispose) as TKernel);

            default:
                throw new ArgumentOutOfRangeException(nameof(kernelType), kernelType, null);
            }
        }
示例#18
0
 public KernelBaseParameter(SvmKernelType kernelType, MatrixElementTypes sampleType, int templateRows, int templateColumns)
 {
     this.KernelType      = kernelType;
     this.SampleType      = sampleType;
     this.TemplateRows    = templateRows;
     this.TemplateColumns = templateColumns;
 }
示例#19
0
 public static extern ErrorType rank_features(SvmKernelType kernelType,
                                              MatrixElementType type,
                                              int templateRows,
                                              int templateColumns,
                                              IntPtr kcentroid,
                                              IntPtr samples,
                                              IntPtr labels,
                                              out IntPtr ret);
示例#20
0
 public static extern ErrorType krls_new(SvmKernelType kernelType,
                                         MatrixElementType type,
                                         int templateRows,
                                         int templateColumns,
                                         IntPtr kernel,
                                         double tolerance,
                                         uint maxDictionarySize,
                                         out IntPtr ret);
示例#21
0
 public static extern ErrorType spectral_cluster(SvmKernelType kernelType,
                                                 MatrixElementType type,
                                                 int templateRows,
                                                 int templateColumns,
                                                 IntPtr kernel,
                                                 IntPtr samples,
                                                 uint numClusters,
                                                 out IntPtr ret);
示例#22
0
 public static extern ErrorType kkmeans_train(SvmKernelType kernelType,
                                              MatrixElementType type,
                                              int templateRows,
                                              int templateColumns,
                                              IntPtr kkmeans,
                                              IntPtr samples,
                                              IntPtr centers,
                                              uint max_iter);
示例#23
0
 public static extern ErrorType serialize_krls(SvmKernelType kernelType,
                                               MatrixElementType type,
                                               int templateRows,
                                               int templateColumns,
                                               IntPtr obj,
                                               byte[] fileName,
                                               int fileNameLength,
                                               out IntPtr errorMessage);
示例#24
0
 public static extern ErrorType serialize_probabilistic_decision_function(SvmKernelType kernelType,
                                                                          MatrixElementType type,
                                                                          int templateRows,
                                                                          int templateColumns,
                                                                          IntPtr function,
                                                                          byte[] fileName,
                                                                          int fileNameLength,
                                                                          out IntPtr errorMessage);
示例#25
0
 public static extern ErrorType normalized_function_operator_float(SvmKernelType kernel_type,
                                                                   MatrixElementType type,
                                                                   int templateRows,
                                                                   int templateColumns,
                                                                   SvmFunctionType function_type,
                                                                   IntPtr function,
                                                                   IntPtr sample,
                                                                   out float ret);
示例#26
0
 public static extern ErrorType batch_trainer_new2_float(SvmKernelType kernelType,
                                                         MatrixElementType type,
                                                         SvmBatchTrainerType trainerType,
                                                         IntPtr trainer,
                                                         float minLearningRate,
                                                         bool verbose,
                                                         bool useCache,
                                                         int cacheSize,
                                                         out IntPtr ret);
示例#27
0
 public static extern ErrorType reduced2(SvmKernelType kernel_type,
                                         MatrixElementType type,
                                         int templateRows,
                                         int templateColumns,
                                         SvmTrainerType trainer_type,
                                         IntPtr trainer,
                                         uint num_bv,
                                         double eps,
                                         out IntPtr ret);
示例#28
0
 public static extern ErrorType kcentroid_new(SvmKernelType kernelType,
                                              MatrixElementType type,
                                              int templateRows,
                                              int templateColumns,
                                              IntPtr kernel,
                                              double tolerance,
                                              uint maxDictionarySize,
                                              bool removeOldestFirst,
                                              out IntPtr ret);
示例#29
0
 public static extern ErrorType normalized_function_serialize(SvmKernelType kernel_type,
                                                              MatrixElementType type,
                                                              int templateRows,
                                                              int templateColumns,
                                                              SvmFunctionType function_type,
                                                              IntPtr function,
                                                              byte[] file_name,
                                                              int file_name_length,
                                                              out IntPtr error_message);
示例#30
0
 public static extern ErrorType pick_initial_centers(SvmKernelType kernelType,
                                                     MatrixElementType elementType,
                                                     int templateRows,
                                                     int templateColumns,
                                                     long num_centers,
                                                     IntPtr centers,
                                                     IntPtr samples,
                                                     IntPtr k,
                                                     double percentile);