Пример #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static SVMNode[] Normalize(SVMNode[] x, SVMNormType type)
 {
     double norm_l = (double)(int)type;
     double norm = x.Sum(a => Math.Pow(a.Value, norm_l));
     norm = Math.Pow(norm, 1 / norm_l);
     SVMNode[] y = x.Select(a => new SVMNode(a.Index, a.Value / norm)).ToArray();
     return y;
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="x"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static SVMNode[] Normalize(SVMNode[] x, SVMNormType type)
        {
            double norm_l = (double)(int)type;
            double norm   = x.Sum(a => Math.Pow(a.Value, norm_l));

            norm = Math.Pow(norm, 1 / norm_l);
            SVMNode[] y = x.Select(a => new SVMNode(a.Index, a.Value / norm)).ToArray();
            return(y);
        }
Пример #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="problem"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static SVMProblem Normalize(SVMProblem problem, SVMNormType type)
 {
     SVMProblem temp = new SVMProblem();
     for (int i = 0; i < problem.Length; i++)
     {
         SVMNode[] x = SVMNodeHelper.Normalize(problem.X[i], type);
         temp.Add(x, problem.Y[i]);
     }
     return temp;
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="problem"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static SVMProblem Normalize(SVMProblem problem, SVMNormType type)
        {
            SVMProblem temp = new SVMProblem();

            for (int i = 0; i < problem.Length; i++)
            {
                SVMNode[] x = SVMProblemHelper.Normalize(problem.X[i], type);
                temp.Add(x, problem.Y[i]);
            }
            return(temp);
        }
Пример #5
0
 public static SVMNode[] Normalize(this SVMNode[] x, SVMNormType type)
 {
     return(SVMNodeHelper.Normalize(x, type));
 }
Пример #6
0
 public static SVMProblem Normalize(this SVMProblem problem, SVMNormType type)
 {
     return(SVMProblemHelper.Normalize(problem, type));
 }
Пример #7
0
 public static SVMNode[] Normalize(this SVMNode[] x, SVMNormType type)
 {
     return SVMNodeHelper.Normalize(x, type);
 }
 public static SVMProblem Normalize(this SVMProblem problem, SVMNormType type)
 {
     return SVMProblemHelper.Normalize(problem, type);
 }