本程序为SVM语音识别源代码.rar

  • 我爱吃肉条
    了解作者
  • matlab
    开发工具
  • 71KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 12
    下载次数
  • 2019-05-22 13:09
    上传日期
此代码是svm的源码,可利用此程序进行支持向量机的分类处理
本程序为SVM语音识别源代码.rar
  • svm
  • Optimiser
  • qp.c
    7.1KB
  • pr_loqo.h
    2.3KB
  • qp.dll
    48KB
  • Makefile
    27B
  • pr_loqo.c
    16.3KB
  • Examples
  • Classification
  • iris2v13.mat
    2.6KB
  • iris1v23.mat
    2.6KB
  • linsep.mat
    672B
  • nlinsep.mat
    712B
  • iris3v12.mat
    2.6KB
  • Regression
  • example.mat
    744B
  • sinc.mat
    1KB
  • titanium.mat
    1.1KB
  • softmargin.m
    312B
  • svtol.m
    401B
  • svcerror.m
    837B
  • svcplot.m
    3KB
  • centrefig.m
    144B
  • uiregress.m
    5.5KB
  • svrerror.m
    1.2KB
  • svr.m
    3.9KB
  • binomial.m
    371B
  • svkernel.m
    2.5KB
  • uiclass.m
    5.3KB
  • svrplot.m
    1.8KB
  • nobias.m
    457B
  • README
    2.6KB
  • svc.m
    2.6KB
  • svdatanorm.m
    1.3KB
  • svcinfo.m
    1.2KB
  • uiregress.mat
    11.4KB
  • qp.dll
    48KB
  • uiclass.mat
    12.3KB
  • Contents.m
    1.1KB
  • svcoutput.m
    973B
  • svroutput.m
    711B
  • cmap.mat
    1.7KB
内容介绍
/* * File: pr_loqo.c * Purpose: solves quadratic programming problem for pattern recognition * for support vectors * * Author: Alex J. Smola * Created: 10/14/97 * Updated: 11/08/97 * Updated: 13/08/98 (removed exit(1) as it crashes svm lite when the margin * in a not sufficiently conservative manner) * * * Copyright (c) 1997 GMD Berlin - All rights reserved * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of GMD Berlin * The copyright notice above does not evidence any * actual or intended publication of this work. * * Unauthorized commercial use of this software is not allowed */ #include <math.h> #include <time.h> #include <stdlib.h> #include <stdio.h> #include "pr_loqo.h" #define max(A, B) ((A) > (B) ? (A) : (B)) #define min(A, B) ((A) < (B) ? (A) : (B)) #define sqr(A) ((A) * (A)) #define ABS(A) ((A) > 0 ? (A) : (-(A))) #define PREDICTOR 1 #define CORRECTOR 2 /***************************************************************** replace this by any other function that will exit gracefully in a larger system ***************************************************************/ void nrerror(char error_text[]) { printf("ERROR: terminating optimizer - %s\n", error_text); /* exit(1); */ } /***************************************************************** taken from numerical recipes and modified to accept pointers moreover numerical recipes code seems to be buggy (at least the ones on the web) cholesky solver and backsubstitution leaves upper right triangle intact (rows first order) ***************************************************************/ void choldc(double a[], int n, double p[]) { void nrerror(char error_text[]); int i, j, k; double sum; for (i = 0; i < n; i++){ for (j = i; j < n; j++) { sum=a[n*i + j]; for (k=i-1; k>=0; k--) sum -= a[n*i + k]*a[n*j + k]; if (i == j) { if (sum <= 0.0) { nrerror("choldc failed, matrix not positive definite"); sum = 0.0; } p[i]=sqrt(sum); } else a[n*j + i] = sum/p[i]; } } } void cholsb(double a[], int n, double p[], double b[], double x[]) { int i, k; double sum; for (i=0; i<n; i++) { sum=b[i]; for (k=i-1; k>=0; k--) sum -= a[n*i + k]*x[k]; x[i]=sum/p[i]; } for (i=n-1; i>=0; i--) { sum=x[i]; for (k=i+1; k<n; k++) sum -= a[n*k + i]*x[k]; x[i]=sum/p[i]; } } /***************************************************************** sometimes we only need the forward or backward pass of the backsubstitution, hence we provide these two routines separately ***************************************************************/ void chol_forward(double a[], int n, double p[], double b[], double x[]) { int i, k; double sum; for (i=0; i<n; i++) { sum=b[i]; for (k=i-1; k>=0; k--) sum -= a[n*i + k]*x[k]; x[i]=sum/p[i]; } } void chol_backward(double a[], int n, double p[], double b[], double x[]) { int i, k; double sum; for (i=n-1; i>=0; i--) { sum=b[i]; for (k=i+1; k<n; k++) sum -= a[n*k + i]*x[k]; x[i]=sum/p[i]; } } /***************************************************************** solves the system | -H_x A' | |x_x| = |c_x| | A H_y| |x_y| |c_y| with H_x (and H_y) positive (semidefinite) matrices and n, m the respective sizes of H_x and H_y for variables see pg. 48 of notebook or do the calculations on a sheet of paper again predictor solves the whole thing, corrector assues that H_x didn't change and relies on the results of the predictor. therefore do _not_ modify workspace if you want to speed tune anything in the code here's the right place to do so: about 95% of the time is being spent in here. something like an iterative refinement would be nice, especially when switching from double to single precision. if you have a fast parallel cholesky use it instead of the numrec implementations. side effects: changes H_y (but this is just the unit matrix or zero anyway in our case) ***************************************************************/ void solve_reduced(int n, int m, double h_x[], double h_y[], double a[], double x_x[], double x_y[], double c_x[], double c_y[], double workspace[], int step) { int i,j,k; double *p_x; double *p_y; double *t_a; double *t_c; double *t_y; p_x = workspace; /* together n + m + n*m + n + m = n*(m+2)+2*m */ p_y = p_x + n; t_a = p_y + m; t_c = t_a + n*m; t_y = t_c + n; if (step == PREDICTOR) { choldc(h_x, n, p_x); /* do cholesky decomposition */ for (i=0; i<m; i++) /* forward pass for A' */ chol_forward(h_x, n, p_x, a+i*n, t_a+i*n); for (i=0; i<m; i++) /* compute (h_y + a h_x^-1A') */ for (j=i; j<m; j++) for (k=0; k<n; k++) h_y[m*i + j] += t_a[n*j + k] * t_a[n*i + k]; choldc(h_y, m, p_y); /* and cholesky decomposition */ } chol_forward(h_x, n, p_x, c_x, t_c); /* forward pass for c */ for (i=0; i<m; i++) { /* and solve for x_y */ t_y[i] = c_y[i]; for (j=0; j<n; j++) t_y[i] += t_a[i*n + j] * t_c[j]; } cholsb(h_y, m, p_y, t_y, x_y); for (i=0; i<n; i++) { /* finally solve for x_x */ t_c[i] = -t_c[i]; for (j=0; j<m; j++) t_c[i] += t_a[j*n + i] * x_y[j]; } chol_backward(h_x, n, p_x, t_c, x_x); } /***************************************************************** matrix vector multiplication (symmetric matrix but only one triangle given). computes m*x = y no need to tune it as it's only of O(n^2) but cholesky is of O(n^3). so don't waste your time _here_ although it isn't very elegant. ***************************************************************/ void matrix_vector(int n, double m[], double x[], double y[]) { int i, j; for (i=0; i<n; i++) { y[i] = m[(n+1) * i] * x[i]; for (j=0; j<i; j++) y[i] += m[i + n*j] * x[j]; for (j=i+1; j<n; j++) y[i] += m[n*i + j] * x[j]; } } /***************************************************************** call only this routine; this is the only one you're interested in for doing quadratical optimization the restart feature exists but it may not be of much use due to the fact that an initial setting, although close but not very close the the actual solution will result in very good starting diagnostics (primal and dual feasibility and small infeasibility gap) but incur later stalling of the optimizer afterwards as we have to enforce positivity of the slacks. ***************************************************************/ int pr_loqo(int n, int m, double c[], double h_x[], double a[], double b[], double l[], double u[], double primal[], double dual[], int verb, double sigfig_max, int counter_max, double margin, double bound, int restart) { /* the knobs to be tuned ... */ /* double margin = -0.95; we will go up to 95% of the distance between old variables and zero */ /* double bound = 10; preset value for the start. small values give good initial feasibility but may result in slow convergence afterwards: we're too close to zero */ /* to be allocated */ double *workspace; double *diag_h_x; double *h_y; double *c_x; double *c_y; double *h_dot_x; double *rho; double *nu; double *tau; double *sigma; double *gamma_z; double *gamma_s; double *hat_nu; double *hat_tau; double *delta_x; double *delta_y; double *delta_s; double *delta_z; double *delta_g; double *delta_t; double *d; /* from the header - pointers into primal and dual */ double *x; double *y; double *g; double *z; double *s; double *t; /* auxiliary variables */ double b_plus_1; double c_plus_1; double x_h_x; double primal_inf; double dual_inf; double sigfig; double primal_obj, dual_obj; double mu; double alfa, step; int counte
评论
    相关推荐
    • c语言版本的支持向量机SVM
      C语言版的支持向量机源码,很好,很强大。
    • 支持向量机SVM引导
      代码可以直接运行,没有任何问题!基于VS2010+opencv2.4.10平台!
    • 支持向量机SVM的一个库
      是一个支持向量机的库,里面有多个函数,工具箱里面有多个文件
    • 支持向量机svm时序预测软件
      好东西共同分享。。。试用版,对时间序列的预测,希望对大家有用
    • 支持向量机svm算法课件
      两款svm算法介绍的课件,对于正在学习svm算法的同学很重要
    • 支持向量机SVM所使用的数据集
      支持向量机SVM所使用的数据集,包括非线性数据集train_kernel.txt 及test_kernel.txt;train_linear.txt 及test_linearl.txt;train_multi.txt 及test_multil.txt。
    • 11支持向量机SVM.zip
      机器学习之支持向量机SVM代码
    • 支持向量机SVM的smo算法
      该smo算法实现了两种smo算法,一种是简单的smo算法,即对a1的选择是随机的,一种是启发式smo算法,即对a1的选择是启发式选择,由于第一种是随机选择故其结果具有一定的随机性,而第二种是启发式,就很好的解决了随机...
    • 支持向量机SVM的SMO方法实现
      SMO方法实现的支持向量机。 使用方法: 1启动程序,鼠标左键在对话框中点出绿点,鼠标右键点出红点。【或点击画测试用点,将生成几个用于验证正确性的点】 2 设置惩罚因子C,默认为100 3 点击SVM-SMO按钮,训练找到...
    • 支持向量机SVM测试程序
      SVM支持向量机VS2015+OpenCV2.4.13测试程序。其中分三个部分1、线性可分下测试程序;2、线性不可分下测试程序;3、多个类别的SVM测试程序。内涵详细注释和源码解析,方便学习