RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

RunMat® is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

/
See all docs
Builtin Reference
    • bayesopt
    • classify
    • confusionmat
    • crossvalind
    • cvpartition
    • fitclinear
    • fitctree
    • fitlm
    • kmeans
    • knnsearch
    • lasso
    • lassoglm
    • linkage
    • lscov
    • mnrfit
    • nlparci
    • optimizableVariable
    • pdist
    • pdist2
    • perfcurve
    • predict
    • regress
    • ridge
    • squareform
    • test
    • training
    • tsne

perfcurve — Compute classifier performance curves and AUC values.

perfcurve(labels,scores,posclass) treats posclass as the positive class, all other nonmissing classes as negative classes, and returns ROC false-positive-rate values. [X,Y,T,AUC,OPTROCPT,SUBY,SUBYNAMES] = perfcurve(...) returns the Y criterion, thresholds, trapezoidal AUC, optimal ROC point, per-negative-subclass Y values, and subclass labels as a cell array.

Syntax

X = perfcurve(labels, scores, posclass)
X = perfcurve(labels, scores, posclass, Name, Value)
[X,Y,T,AUC,OPTROCPT,SUBY,SUBYNAMES] = perfcurve(___)

Inputs

labels
Type
Any
Required
Yes
Description
True class labels.
scores
Type
NumericArray
Required
Yes
Description
Classifier scores for the positive class.
posclass
Type
Any
Required
Yes
Description
Positive class label.
nameValuePairs
Type
Any
Required
Variadic
Description
Name-value options such as XCrit, YCrit, NegClass, Weights, Prior, Cost, TVals, XVals, UseNearest, and ProcessNaN.
NameTypeRequiredDefaultDescription
labelsAnyYes—True class labels.
scoresNumericArrayYes—Classifier scores for the positive class.
posclassAnyYes—Positive class label.
nameValuePairsAnyVariadic—Name-value options such as XCrit, YCrit, NegClass, Weights, Prior, Cost, TVals, XVals, UseNearest, and ProcessNaN.

Returns

X
Type
NumericArray
Description
X-coordinate criterion values for the performance curve.
Y
Type
NumericArray
Description
Y-coordinate criterion values for the performance curve.
T
Type
NumericArray
Description
Score thresholds used to compute the curve.
AUC
Type
NumericScalar
Description
Area under the X/Y performance curve.
OPTROCPT
Type
NumericArray
Description
Optimal operating point on the ROC curve.
SUBY
Type
NumericArray
Description
Y-criterion values computed for each negative subclass.
SUBYNAMES
Type
Any
Description
Negative subclass labels corresponding to columns of SUBY.
NameTypeDescription
XNumericArrayX-coordinate criterion values for the performance curve.
YNumericArrayY-coordinate criterion values for the performance curve.
TNumericArrayScore thresholds used to compute the curve.
AUCNumericScalarArea under the X/Y performance curve.
OPTROCPTNumericArrayOptimal operating point on the ROC curve.
SUBYNumericArrayY-criterion values computed for each negative subclass.
SUBYNAMESAnyNegative subclass labels corresponding to columns of SUBY.

Returned values from perfcurve depend on how many outputs the caller requests.

Errors

RunMat:perfcurve:InvalidArgument
When
Labels, scores, class selections, criteria, thresholds, weights, priors, costs, or name-value options are malformed.
Message
perfcurve: invalid argument
RunMat:perfcurve:Unsupported
When
A documented advanced mode requires confidence bounds, bootstrap/cross-validation outputs, or score matrix class-column inference that is not implemented yet.
Message
perfcurve: unsupported mode
RunMat:perfcurve:Internal
When
RunMat cannot allocate or construct perfcurve outputs.
Message
perfcurve: internal error
IdentifierWhenMessage
RunMat:perfcurve:InvalidArgumentLabels, scores, class selections, criteria, thresholds, weights, priors, costs, or name-value options are malformed.perfcurve: invalid argument
RunMat:perfcurve:UnsupportedA documented advanced mode requires confidence bounds, bootstrap/cross-validation outputs, or score matrix class-column inference that is not implemented yet.perfcurve: unsupported mode
RunMat:perfcurve:InternalRunMat cannot allocate or construct perfcurve outputs.perfcurve: internal error

Labels, scores, and missing rows

Labels may be numeric, logical, string, character rows, categorical values, or cell strings. Text label families can be mixed between string, char, cell-string, and categorical inputs. Typed-integer labels are a RunMat-mode extension and remain exact during class comparison, including adjacent 64-bit values above flintmax; typed-integer scores and numeric options must be exactly representable in double before entering curve computation.

scores must be a numeric vector with one score per label. Score matrices for class-column inference are rejected explicitly until the classifier object/class-order surface is available. Rows with missing labels, zero weights, or NaN scores are omitted by default. "ProcessNaN","addtofalse" keeps NaN scores: positive-class NaN scores are false negatives and negative-class NaN scores are false positives at every threshold.

Criteria, thresholds, and outputs

Default thresholds include an initial reject-all point whose threshold duplicates the highest score, followed by each unique finite score in descending order. "TVals",t uses explicit thresholds and cannot be combined with "XVals". "XCrit" and "YCrit" accept fpr, tpr/sens/reca, tnr/spec, fnr/miss, ppv/prec, npv, accu, tp, fn, fp, tn, tp+fp, rpp, rnp, and ecost.

"NegClass",labels restricts negative classes. SUBY contains one Y-criterion column per selected negative subclass and SUBYNAMES returns the corresponding labels as an n-by-1 cell array. "XVals",x returns curve values at requested X positions and cannot be combined with TVals. UseNearest defaults to true: nearest mode returns actual X values in requested order; false sorts requested X values and linearly interpolates finite X/Y points. AUC is computed over the full curve interval covered by XVals.

OPTROCPT is [NaN NaN] for non-ROC criteria. Confidence-bound and bootstrap modes such as NBoot are not implemented and return a dedicated unsupported-mode error. A call that requests no outputs still checks compatibility, integer exactness, and host-visible argument and option forms, then returns without downloading resident inputs or computing the curve; finite-score and other curve-specific data checks are not performed in that case.

Weights, prior, cost, and execution

"Weights",w applies nonnegative observation weights. Prior accepts empirical, uniform, or a two-element positive/negative prior vector and rescales class weights. Cost accepts a nonnegative 2-by-2 matrix and is used for ecost and standard ROC optimal-point selection.

Admitted gpuArray inputs are materialized to host. Label handling, threshold sweeps, and AUC calculation run on CPU; there is no provider-native perfcurve reduction or fusion. Runtime-owned gathering may suspend. The output curves are host double arrays and subclass names are a host cell array.

Examples

Compute a basic ROC curve and AUC

labels = [1; 0; 1; 0]; scores = [0.9; 0.8; 0.4; 0.1]; [X,Y,T,AUC] = perfcurve(labels, scores, 1)

Compute precision-recall values at explicit thresholds

labels = [1;0;1;0]; scores = [0.9;0.8;0.4;0.1]; [R,P] = perfcurve(labels, scores, 1, "XCrit", "reca", "YCrit", "prec", "TVals", [0.8 0.4])

Restrict negative classes

labels = ["hit";"miss";"hit";"other"]; scores = [0.9;0.8;0.4;0.1]; [X,Y,T,AUC,opt,suby,names] = perfcurve(labels, scores, "hit", "NegClass", "miss")

Using perfcurve with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how perfcurve changes the result.

Run a small perfcurve example, explain the result, then change one input and compare the output.

FAQ

Does perfcurve train a classifier?⌄

No. It evaluates existing classifier scores against known labels. Train or evaluate a model separately and pass the score vector for the positive class.

Why are confidence intervals not returned?⌄

RunMat implements deterministic curve, threshold, AUC, optimal-point, weighting, prior, cost, and subclass outputs. Bootstrap confidence-bound modes require separate statistical resampling and are rejected explicitly.

Related Stats functions

Ml

bayesopt · classify · confusionmat · crossvalind · cvpartition · fitclinear · fitctree · fitlm · kmeans · knnsearch · lasso · lassoglm · linkage · lscov · mnrfit · nlparci · optimizableVariable · pdist · pdist2 · predict · regress · ridge · squareform · test · training · tsne

Summary

anova1 · binocdf · binscatter · boxplot · cdf · cdfplot · chi2cdf · corr · corrcoef · corrcov · cov · cov2corr · dummyvar · ecdf · filloutliers · fitdist · geomean · grpstats · harmmean · icdf · isoutlier · ksdensity · kstest · kurtosis · lsline · mad · mode · nanmax · normalize · normcdf · norminv · normpdf · onehotdecode · onehotencode · pca · pdf · prctile · qqplot · quantile · refline · rmse · scatterhist · skewness · tabulate · tcdf · tiedrank · tinv · tpdf · ttest · ttest2 · wblinv

Random

binornd · bootstrp · datasample · dividerand · exprnd · gamrnd · gpurng · lhsdesign · mvnrnd · normrnd · random · randsample · rng · trnd · unidrnd · unifrnd · wblrnd

Hist

histc · histcounts · histcounts2

Options

statget · statset

Source you can read

Every RunMat function's source is public. Read exactly how perfcurve is executed, line by line, in Rust.

  • View the source for perfcurve in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • Labels, scores, and missing rows
  • Criteria, thresholds, and outputs
  • Weights, prior, cost, and execution
  • Examples
  • Compute a basic ROC curve and AUC
  • Compute precision-recall values at explicit thresholds
  • Restrict negative classes
  • Using perfcurve with coding agents
  • FAQ
  • Related Stats functions
  • Ml
  • Summary
  • Random
  • Hist
  • Options
  • Source you can read
  • About RunMat