コード例 #1
0
        public override RegressionModel Train(BaseVector[] x, int[] nominal, double[] y, Parameters param, int ntheads, Action <double> reportProgress)
        {
            x = ClassificationMethod.ToOneHotEncoding(x, nominal);
            int       k        = param.GetParam <int>("Number of neighbours").Value;
            IDistance distance = Distances.GetDistanceFunction(param);

            return(new KnnRegressionModel(x, y, k, distance));
        }
コード例 #2
0
        public override RegressionModel Train(BaseVector[] x, int[] nominal, double[] y, Parameters param, int nthreads, Action <double> reportProgress)
        {
            x = ClassificationMethod.ToOneHotEncoding(x, nominal);
            ParameterWithSubParams <int> kernelParam = param.GetParamWithSubParams <int>("Kernel");
            SvmParameter sp = new SvmParameter {
                kernelFunction = KernelFunctions.GetKernelFunction(kernelParam.Value, kernelParam.GetSubParameters()),
                svmType        = SvmType.EpsilonSvr,
                c = param.GetParam <double>("C").Value
            };
            SvmModel model = SvmMain.SvmTrain(new SvmProblem(x, y), sp);

            return(new SvmRegressionModel(model));
        }
コード例 #3
0
 public override RegressionModel Train(BaseVector[] x, int[] nominal, double[] y, Parameters param, int nthreads, Action <double> reportProgress)
 {
     x = ClassificationMethod.ToOneHotEncoding(x, nominal);
     throw new System.NotImplementedException();
 }