【问题标题】:Linear discriminant analysis using alglib使用 alglib 进行线性判别分析
【发布时间】:2015-07-27 08:25:34
【问题描述】:

我被要求对我的一个项目的一组数据执行线性判别分析。我正在使用 ALGLIB(C++ 版本),它具有 fisherlda 函数,但我需要一些帮助来了解如何使用它。

用户回答了一组 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);

【问题讨论】:

    标签: c++ alglib


    【解决方案1】:

    您正在使用作为 LDA 算法实现的 fisherlda 函数。

    LDA(线性判别分析)旨在找到最能表征或区分两类或更多类对象或事件的特征的线性组合。

    假设 y=wx(w,x 在这里都代表一个矩阵),所以 Fisherlad 的给定结果是一个一维的系数数组,即 w。那么你可以使用这条线来确定答案属于哪个类.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-05-22
      • 2013-06-19
      • 2019-05-21
      • 2013-12-10
      • 2018-07-08
      • 2022-06-22
      • 2012-05-09
      相关资源
      最近更新 更多