Skip to content

Instantly share code, notes, and snippets.

@agamemnonc
Created July 18, 2016 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agamemnonc/4c9ddb472cd7c3ac84718cee1d2f6ce6 to your computer and use it in GitHub Desktop.
Save agamemnonc/4c9ddb472cd7c3ac84718cee1d2f6ce6 to your computer and use it in GitHub Desktop.
Comparison of predicted probability for LDA classifier with MATLAB and sklearn
clear
load iris_dataset.mat % Load iris dataset (same order as in sklearn)
X = irisInputs';
[~, y] = max(irisTargets); y = y'; % Transform target
lda_clf = fitcdiscr(X,y,'DiscrimType','linear'); % Classifier
[~,post_probs] = predict(lda_clf,X); % Predicted probability for training data
disp(post_probs(52,:)) % Display predicted probability for datum 52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment