线性判别分析
Linear discriminant analysis using alglib
本文关键字:线性 更新时间:2023-10-16
我被要求对我的一个项目的一组数据进行线性判别分析。我正在使用ALGLIB (c++版本),它有一个渔场函数,但我需要一些帮助了解如何使用它。
用户回答了一组6个问题(答案是1-7之间的数字),这给了我一个示例数据集,例如{1,2,3,4,5,6}。然后我有5类,每类6个值,例如{0.765,0.895,1.345,2.456,0.789,5.678}。fisher lda函数接受一个二维的值数组,并返回另一个一维的值数组(我不知道它们是什么意思)。
据我所知,我需要看看哪个类的用户回答最适合?
如果能帮助我理解LDA和/或如何使用这个函数,我将不胜感激。
编辑:下面是我要使用的函数的定义:
/*************************************************************************
Multiclass Fisher LDA
Subroutine finds coefficients of linear combination which optimally separates
training set on classes.
INPUT PARAMETERS:
XY - training set, array[0..NPoints-1,0..NVars].
First NVars columns store values of independent
variables, next column stores number of class (from 0
to NClasses-1) which dataset element belongs to. Fractional
values are rounded to nearest integer.
NPoints - training set size, NPoints>=0
NVars - number of independent variables, NVars>=1
NClasses - number of classes, NClasses>=2
OUTPUT PARAMETERS:
Info - return code:
* -4, if internal EVD subroutine hasn't converged
* -2, if there is a point with class number
outside of [0..NClasses-1].
* -1, if incorrect parameters was passed (NPoints<0,
NVars<1, NClasses<2)
* 1, if task has been solved
* 2, if there was a multicollinearity in training set,
but task has been solved.
W - linear combination coefficients, array[0..NVars-1]
-- ALGLIB --
Copyright 31.05.2008 by Bochkanov Sergey
*************************************************************************/
void fisherlda(const real_2d_array &xy, const ae_int_t npoints, const ae_int_t nvars, const ae_int_t nclasses, ae_int_t &info, real_1d_array &w);
你正在使用的是fishlda函数,它是LDA算法的实现。
LDA(线性判别分析)旨在找到最能表征或分离两类或两类以上对象或事件的特征的线性组合。
假设y=wx(w,x在这里都代表一个矩阵),所以fishlad的给定结果是一个系数的1d数组,即w.然后您可以使用这行来确定答案属于哪个类。
相关文章:
- 向量上的线性搜索
- 二叉搜索如何比线性搜索更快?
- 线性丢番图方程 - 求给定区间内的解数和解
- 查找自动生成键并具有线性内存消耗的小型关联数组
- 为什么字符串比较的 == 运算符相对于任一字符串长度线性时间(似乎)?
- 线性优化目标函数中的绝对值
- 犰狳C++:带有模量计算的线性组合
- C++(线性搜索和排序)
- 一般采用可索引/可调用的线性组合
- C++线性搜索算法,确定数组中元素的数量
- 如何在 c++ 中线性搜索两个数组?
- 生成线性随机整数C++
- 使用本征求解线性方程组
- 在 SEAL 中重新线性化一个密文
- 如何在C++中实现线性探测?
- C++ 本征线性系统求解,数值问题?
- 曼哈顿距离比曼哈顿距离+线性冲突效果更好
- 变量未在此范围内声明 数组线性搜索
- 如何线性插值到不恒定的目的地
- 两个嵌套循环的运行时间复杂性:二次型还是线性