PLS-DA is really a "trick" to use PLS for categorical results instead of the usual continuous vector / matrix. The trick is to create a fictitious identical matrix of zeros / ones that represents membership in each of the categories. Therefore, if you have a predicted binary result (i.e. Male / Female, Yes / No, etc.), your dummy matrix will have two columns representing membership in any category.
For example, consider the gender outcome for four people: 2 men and 2 women. The dummy matrix should be encoded as follows:
import numpy as np dummy=np.array([[1,1,0,0],[0,0,1,1]]).T
where each column represents membership in two categories (male, female)
Then your model for the data in the Xdata variable (form 4 rows, arbitrary columns) will be:
myplsda=PLSRegression().fit(X=Xdata,Y=dummy)
Predicted categories can be extracted from comparing two indicator variables in mypred:
mypred= myplsda.predict(Xdata)
For each row / case, the predicted gender is such that it has the highest predicted membership.
source share