RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

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.

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

predict — Predict responses from a fitted model.

predict(mdl,Xnew) evaluates supported fitted model objects, including LinearModel from fitlm, ClassificationTree from fitctree, and supported Deep Learning network objects, on new predictor data.

Syntax

ypred = predict(mdl, Xnew)
[ypred, yci] = predict(mdl, Xnew)
[ypred, yci] = predict(mdl, Xnew, Name, Value)
label = predict(tree, Xnew)
[label,score,node,cnum] = predict(tree, Xnew)
[label,score] = predict(linearClassifier, Xnew)

Inputs

NameTypeRequiredDefaultDescription
mdlAnyYes—Supported fitted model object, such as LinearModel from fitlm, ClassificationTree from fitctree, or ClassificationLinear from fitclinear.
XnewAnyYes—New predictor table or matrix.
optionsAnyVariadic—Prediction name-value options such as Alpha, Prediction, and Simultaneous.

Returns

NameTypeDescription
ypredNumericArrayPredicted response values.
yciNumericArrayPointwise confidence intervals for the predicted response.
labelAnyPredicted class labels.
scoreNumericArrayPosterior probabilities for each class.
nodeNumericArrayOne-based terminal node index for each prediction.
cnumNumericArrayOne-based class number for each predicted label.
scoreNumericArrayClassification scores or posterior probabilities.

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

Errors

IdentifierWhenMessage
RunMat:predict:InvalidArgumentThe model, predictor data, or prediction options are malformed or unsupported.predict: invalid argument
RunMat:predict:InternalRunMat cannot construct prediction outputs.predict: internal error

How predict works

  • Typed-integer predictors and numeric controls for implemented statistical models are independently gated RunMat-mode extensions with checked double boundaries; supported deep-learning models retain their documented integer-input contract.
  • Xnew can be a numeric matrix with the same predictor column count used during fitting.
  • For table input, predictor variables are selected by the model's PredictorNames property.
  • For LinearModel, [ypred,yci] = predict(...) returns pointwise confidence intervals for curve predictions by default.
  • For ClassificationTree, [label,score,node,cnum] = predict(...) returns predicted class labels, posterior probabilities, one-based leaf node ids, and one-based class-number predictions.
  • For dlnetwork, SeriesNetwork, and DAGNetwork compatibility objects, predict(net,Xnew) returns the score/activation matrix for the supported sequential feed-forward layer subset also used by forward.
  • Deep Learning prediction accepts ObservationsIn with rows or columns; column-observation input is transposed before execution.
  • Linear-model name-value options Alpha, Prediction, and Simultaneous are accepted. Prediction can be curve or observation; Simultaneous must be false because simultaneous intervals are not supported yet.
  • Classification-tree prediction currently accepts matrix or table predictor data and raises explicit errors for unsupported pruning/subtree options.

Examples

Predict from a linear model

mdl = fitlm([0; 1; 2; 3], [1; 3; 5; 7]);
yhat = predict(mdl, [4; 5])

Expected output:

yhat is approximately [9; 11].

Return confidence intervals

[yhat, yci] = predict(mdl, [4; 5], 'Alpha', 0.01)

Expected output:

yci is a two-column matrix with lower and upper bounds.

Predict classes from a classification tree

tree = fitctree([0; 1; 2; 3], [0; 0; 1; 1], 'MaxNumSplits', 1, 'MinParentSize', 2);
[label,score] = predict(tree, [0.5; 2.5])

Expected output:

label is [0; 1], and score has one posterior-probability column per class.

Predict from a dlnetwork

layers = {featureInputLayer(2,'Name','in'); fullyConnectedLayer(2,'Name','fc'); softmaxLayer('Name','prob')};
net = dlnetwork(layers);
scores = predict(net, [1 2; 3 4])

Expected output:

scores has one row per observation.

Using predict with coding agents

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

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

FAQ

Which model classes are supported?⌄

Currently predict supports LinearModel objects returned by fitlm, ClassificationTree objects returned by fitctree, and supported Deep Learning network compatibility objects.

Related Stats functions

Ml

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

Summary

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

Random

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

Hist

histc · histcounts · histcounts2

Options

statget · statset

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how predict is executed, line by line, in Rust.

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

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 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
  • How predict works
  • Examples
  • Predict from a linear model
  • Return confidence intervals
  • Predict classes from a classification tree
  • Predict from a dlnetwork
  • Using predict with coding agents
  • FAQ
  • Related Stats functions
  • Ml
  • Summary
  • Random
  • Hist
  • Options
  • Open-source implementation
  • About RunMat