Questions tagged [linear-discriminant]

103 questions
0
votes
1 answer

Is there a way to extract the coefficient of linear discriminant into a data frame?

Using the iris dataset as an example, I understand to perform LDA, you can use this: library(MASS) iris[1:4] <- scale(iris[1:4]) sample <- sample(c(TRUE, FALSE), nrow(iris), replace=TRUE, prob=c(0.7,0.3)) train <- iris[sample, ] test <-…
0
votes
1 answer

Python - sklearn LDA got unexpected keyword argument 'covariance_estimator'

I ran this code import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import make_blobs from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from sklearn.covariance import OAS n_train = 20 # samples for…
bensw
  • 2,818
  • 5
  • 21
  • 31
0
votes
0 answers

SPSS Syntax to R for discriminant analysis

I have been working in SPSS and need to know how to run a discriminant analysis in R. I imagine my syntax which look like this in SPSS > GET DATA /TYPE=XLSX >/FILE='C:\Users\Downloads\Initial Diabetics Data 10000.xlsx' >/SHEET=name 'Initial…
rawdata
  • 35
  • 8
0
votes
0 answers

Discriminant Function Analysis in R

I'm trying to match a stepwise DFA output from SPSS (which gives a % classification) in R, which I believe uses glm or lda, but it seems so convoluted. Basically, I want to predict who failed an exam (dataframe=examscores, passedfail is the…
0
votes
1 answer

Finding the means of the three classes the data have been assigned to in LDA

I am looking at example code for how to calculate Fisher’s LDA, which is based on Q = W^{-1}B. The data is imported as follows: aircraft = read_csv(file = "aircraft.csv") %>% mutate( Period = factor( Period )) I have the following example for…
The Pointer
  • 2,226
  • 7
  • 22
  • 50
0
votes
1 answer

Coefficients of the LDA using Matlab fitcdiscr

I'm using Matlab command fitcdiscr to implement an LDA with 379 features and 8 classes. I would like to get a global weight for each feature, to investigate their influence in the prediction. How can I obtain it from the pairwise (for each pair of…
0
votes
0 answers

How to plot linear discriminant function in coordinate axes?

I have a discriminant function for y but I need to plot it in the coordinate axes (x1, x3) along with the data. How do I do that on R? > fdmin13.lda Call: lda(min13[, 5] ~ min13[, 1] + min13[, 3], data = min13) Prior probabilities of groups: …
hello
  • 37
  • 9
0
votes
0 answers

results from PCA and LDA using scikit-learn

I am really confused about this result.. the same dataset for 2 classes and the result from PCA and LDA.. is it reasonable or something may be wrong? Thanks for any answering! enter image description here X = data.drop(['label'], axis=1) y =…
M. C
  • 1
  • 2
0
votes
0 answers

Discriminant Analysis of Principal Components for Candidate SNPs

I just ran a redundancy analysis on my SNP dataset, and I have candidate SNPs from it. I would like to run a DAPC on this data, but the tutorial has left me a little confused. This is because I believe I already have my data in the clusters and I…
0
votes
0 answers

Is it possible to write a function in R to perform a discriminant analysis with a cumulative, variable number of factors?

I am attempting to perform a least discriminant analysis on geometric morphometric data. Because geometric morphometric data typically produces large numbers of variables and discriminant analyses require more data points than variables to…
user2352714
  • 314
  • 1
  • 15
0
votes
1 answer

LDA covariance matrix not match calculated covariance matrix

I'm looking to better understand the covariance_ attribute returned by scikit-learn's LDA object. I'm sure I'm missing something, but I expect it to be the covariance matrix associated with the input data. However, when I compare .covariance_…
0
votes
1 answer

How to calculate the weighted mean (when weighting factor is not given) for some groups of respondents using a statistical method?

We have 4 cohorts (15, 10, 5, 20 people) and out of these we got responses from few of them in each cohorts (10, 6, 5,16 ) to measure the weight (gained or lost) in a week (in kg) when having a medicine. We have to calculate a weighting factor for…
0
votes
0 answers

keeps getting error while running lda function

I am new to machine learning. I am having trouble in lda function in r. Below is my code library(MASS) folds <- createFolds(ForwardPlayers$Rating, k = 10) cv_lda <- lapply(folds, function(x) { # start of function # in the next two lines we will…
0
votes
1 answer

Scale LDA decision boundary

I have a rather unconventional problem and having a hard time finding a solution to this. Would really appreciate your help. I have 4 genes(features) and my classification here is binary(0 and 1). After a lot of back and forth, I have finalized on…
Sia
  • 43
  • 5
0
votes
0 answers

How can I use the LDA for classification of dog and cat datas?

im pretty new in the world of R. I have a little projekt by programming with R. We have 2 Datasets, a dataset with dog datas and one with cat datas (to be clear, 80 Dog row datas and 80 cat row datas). Each of these row is a 64x64 Pixel IMG just…