⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svm_struct_common.c

📁 svm(支持向量机)分类算法本质上是二类分类器
💻 C
字号:
/***********************************************************************/
/*                                                                     */
/*   svm_struct_common.h                                               */
/*                                                                     */
/*   Functions and types used by multiple components of SVM-struct.    */
/*                                                                     */
/*   Author: Thorsten Joachims                                         */
/*   Date: 03.07.04                                                    */
/*                                                                     */
/*   Copyright (c) 2004  Thorsten Joachims - All rights reserved       */
/*                                                                     */
/*   This software is available for non-commercial use only. It must   */
/*   not be modified and distributed without prior permission of the   */
/*   author. The author is not responsible for implications from the   */
/*   use of this software.                                             */
/*                                                                     */
/***********************************************************************/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "svm_struct_common.h"

long struct_verbosity;                   /* verbosity level (0-4) */

void printIntArray(int* x, int n)
{
  int i;
  for(i=0;i<n;i++)
    printf("%i:",x[i]);
}

void printDoubleArray(double* x, int n)
{
  int i;
  for(i=0;i<n;i++)
    printf("%f:",x[i]);
}

void printWordArray(WORD* x)
{
  int i=0;
  for(;x[i].wnum!=0;i++)
    if(x[i].weight != 0)
      printf(" %i:%.2f ",(int)x[i].wnum,x[i].weight);
}

void printW(double *w, long sizePhi, long n,double C)
{
  int i;
  printf("---- w ----\n");
  for(i=0;i<sizePhi;i++)
    {
      printf("%f  ",w[i]);
    }
  printf("\n----- xi ----\n");
  for(;i<sizePhi+2*n;i++)
    {
      printf("%f ",1/sqrt(2*C)*w[i]);
    }
  printf("\n");

}
/**** end print methods ****/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -