2
$\begingroup$

I'm trying to combine a PredictorMeasurements["ComparisonPlot"] plot with another plot, but the problem is that the plot generated by PredictorMeasurements has plot markers that are far too large. Any way to change them?

$\endgroup$
  • 1
    $\begingroup$ PredictorMeasurements[p, testset, "ComparisonPlot" ]/. PointSize[_]:>PointSize[Tiny]? $\endgroup$ – kglr Nov 2 '16 at 22:45
  • $\begingroup$ Thanks so much! That worked perfectly. So to be clear, if I want to pass any plot option to the plot, I would use this sort of method? So say I want to make the points small and red, I would use PredictorMeasurements[p, testset, "ComparisonPlot" ]/. {PointSize[_]:>PointSize[Tiny],PlotStyle[_]:>PlotStyle[Red]} $\endgroup$ – VGP Nov 3 '16 at 18:37
3
$\begingroup$

Using an example from the docs

points = {##, Cos[#1*#2] + RandomReal[{-.2, .2}]} & @@@ RandomReal[{-2, 2}, {1000, 2}];

trainingset = {#1, #2} -> #3 & @@@ points[[;; 800]];
testset = {#1, #2} -> #3 & @@@ points[[801 ;;]];
p = Predict[trainingset];
pm = PredictorMeasurements[p, testset];
cp = pm["ComparisonPlot"]

Mathematica graphics

Post-process cp to change the directives like PointSize and color:

cp /. {{dir___, p:Point[___]}:>{dir, PointSize[Tiny], Red, p}, 
      pl:PointLegend[__]:>(pl /. RGBColor[___]:>Red)}

Mathematica graphics

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.