Closed fkgruber closed 7 years ago
Thanks for your suggestion. Precrec offers two formats for as.data.frame
.
The as.data.frame
function currently shows the format 2 for the mmcurves
object by default since it ignores the raw_curves
option that has been set in the evalmod
function. I'll fix this issue and include it in the next release.
For the time being, you can explicitly set the raw_curves option with as.data.frame.
> # Create sample datasets with 100 positives and 100 negatives
> samps <- create_sim_samples(10, 100, 100, "all")
> mdat <- mmdata(samps[["scores"]], samps[["labels"]],
+ modnames = samps[["modnames"]],
+ dsids = samps[["dsids"]])
>
> # Generate an mscurve object that contains ROC and Precision-Recall curves
> mmcurves <- evalmod(mdat, raw_curves = TRUE)
>
> # Convert mmcurves to a data frame **Set raw_curves = TRUE again here!!!**
> mmcurves.df <- as.data.frame(mmcurves, raw_curves = TRUE)
>
> # Show data frame
> head(mmcurves.df)
x y modname dsid type
1 0.000 0 random 1 ROC
2 0.001 0 random 1 ROC
3 0.002 0 random 1 ROC
4 0.003 0 random 1 ROC
5 0.004 0 random 1 ROC
6 0.005 0 random 1 ROC
thanks that works
Hi, I tried the multiple models multiple datasets example with the as.data.frame function but it did not return the dataset id. I imagine that given that this example have multiple datasets that I would want to distinguish between datasets.
samps <- create_sim_samples(10, 100, 100, "all") mdat <- mmdata(samps[["scores"]], samps[["labels"]], modnames = samps[["modnames"]], dsids = samps[["dsids"]])
mmcurves <- evalmod(mdat, raw_curves = TRUE)
as.data.frame(mmcurves)
thanks Fred