3
$\begingroup$

I did a classification using Classify. I sampled 20 times. To calculate the mean accuracy, etc., is easy. But is there also a way to overlay the calculated ROC curves? If one uses Overlay the output is not really pretty

enter image description here

I think it would be nice the overlay the graphs with decreasing opacity, so that one could see the different curves. I tried with Opacity but could not get it to work.

Edit:

I made some sample data available here: Klick It lasted a while to generate it - I usually have more than 5GB, this is now about 5MB. For whose who do not want to download, here a few lines of code to generate an example:

dataset = ExampleData[{"MachineLearning", "Titanic"}, "Data"];

classifier functions:

cfuns = Table[
   Classify[dataset[[1 ;; 500]], Method -> "DecisionTree"], {3}];

classifier measures:

cmeasures = ClassifierMeasurements[#, dataset[[501 ;;]]] & /@ cfuns;

extract plots:

plots = Through[cmeasures["ROCCurve"]];
plots = #["died"] & /@ plots

delivers three ROC curves, to be combined:

enter image description here

$\endgroup$
  • 2
    $\begingroup$ If this is a question about plotting, it should include the necessary data to be used for the plot. $\endgroup$ – C. E. Sep 28 at 6:32
  • 1
    $\begingroup$ To come up with an answer, most of us would want to run tests with your code and your data. But you give us no code and no data. I think you are unlikely to get an answer unless you edit your question to provide the code you to make the plot you posted. It should include a the data needed to reproduce your plot.. $\endgroup$ – m_goldberg Sep 28 at 7:49
  • $\begingroup$ Instead of overlaying many plots, you should have a list of lists of curve data i.e you have curves = {{curve1}, {curve2}, ... , {curveN}} and just plot curves once. You'll get coloured curves out, but you can use a single colour by adding PlotStyle -> Directive[Blue, Opacity[.1]]. You can add the line with Epilog -> Line[{{0,0}, {1,1}}] $\endgroup$ – flinty Sep 28 at 13:20
  • $\begingroup$ @m_goldberg Just edited the question with example data - this took a while - unfortunately. $\endgroup$ – mgamer Sep 28 at 16:10
  • 1
    $\begingroup$ It's hacky, but you should try: SortBy[#, First] & /@ plots[[All, 1, 1, 2, 1]] which appears to extract the line out of the graphics - see here: pastebin.com/7jddYrr1 - if anybody has time, maybe this could be fleshed out into a full answer. $\endgroup$ – flinty Sep 28 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.