Regularized discriminant analysis is the same as quadratic discriminant analysis with an additional parameter.
The additional parameter, lambda, represents the amount of shrinkage of each class covariance matrix towards the overall covariance matrix that is used in LDA. A value of lambda = 1 will result in linear discriminant analysis whereas a value of lambda = 0 will result in quadratic discriminant analysis. However, in both cases it is not recommended to use this generalized method and instead use the specialized methods lda or qda.
- julia> rda_mod = rda(fm, iris[train,:], lambda=0.5)
- Formula: Species ~ :(+(Sepal_Length,Sepal_Width,Petal_Length,Petal_Width))
- Response:
- 3x3 DataFrame:
- Group Prior Count
- [1,] "setosa" 0.333333 37
- [2,] "versicolor" 0.333333 37
- [3,] "virginica" 0.333333 38
- Lambda: 0.5
- Gamma: 0
- Class means:
- 3x5 DataFrame:
- Group Sepal_Length Sepal_Width Petal_Length Petal_Width
- [1,] "setosa" 5.01622 3.48649 1.46757 0.243243
- [2,] "versicolor" 5.87297 2.77568 4.23514 1.32973
- [3,] "virginica" 6.68158 2.98158 5.59474 2.03421
- julia> rda_pred = predict(rda_mod,iris[test,:])
- 38x1 PooledDataArray{UTF8String,Uint32,2}:
- "setosa"
- ⋮
- "virginica"
- julia> 100*sum(rda_pred .== y[test])/length(y[test])
- 100.0


雷达卡



京公网安备 11010802022788号







