0

I am pretty new to the work with R and ML in general. During programming my first LDA on 'real' data and not just a trainings set with the mlr3-package, I've successfully got a prediction output which looks well. mlr3viz provides the plotting of these results in a stacked barplot. But I also would like to see my trained learner's plot. So how the different LD (especially 1/2) are seperatiing my data. As mlr3 works a bit differently than the MASS package (I guess), it is not possible to plot the data as in other google searches provided. May anybody help me on this topic?

Thank you all in advance :)!

...
#Learner
learner.lda <- lrn("classif.lda", predict.prior = c(1/7, 1/7, 1/7, 1/7, 1/7, 1/7, 1/7))
learner.lda$predict_type="prob"

#Train Learner
learner.lda$train(task_X,row_ids=train_set)

#Prediction of the test_set
prediction <- learner.lda$predict(task_X,row_ids=test_set)
autoplot(prediction, type="stacked")
bienexo
  • 35
  • 6
  • You can get the trained model through `learner.lda$model`, which you can then use to make further plots. – Lars Kotthoff Aug 12 '21 at 16:20
  • @LarsKotthoff Thank you! And how do I recieve the values for the single data points? which "$" to use? Tried all the suggested ones – bienexo Aug 13 '21 at 06:23
  • Do you mean the predictions? – Lars Kotthoff Aug 13 '21 at 14:44
  • I meant the scores for each measurement/individual. I solved it yesterday by multiplying the scores of the discriminants for each variable with the values of the variables for each individual measurement. That worked. I thought of this because in SPSS you get the values immediately. – bienexo Aug 14 '21 at 15:37
  • Ah, right. Things like this are really specific to the individual learner, and if the learner doesn't support it, mlr3 won't either. – Lars Kotthoff Aug 14 '21 at 16:53

0 Answers0