Pt Predict Regression Model
Run a trained regressor on new inputs and get a prediction tensor back
- model
- inputs
- y_hat
PtPredictRegressionModel is the inference node for the pack's regression side: feed a trained model a tensor of inputs, get back a prediction tensor (y_hat). It's the counterpart to Pt Predict Classification Model, but for models that output continuous values - the linear-regression and custom-math workflows in the examples, where the answer is a number, not a class label. If you've trained a model with Pt Train Regression Model, this is how you use it on data it hasn't seen.
How it works
The node runs your model in inference mode and returns the raw output tensor. Three inputs:
- model (PTMODEL) - the trained regressor.
- inputs (TENSOR) - the features to predict on. One small convenience is built in: if you pass a 1D tensor (a single sample's features), the node adds a trailing feature axis for you, so you don't have to remember the exact expected rank. Multi-sample inputs pass through as-is.
- use_gpu - off by default; enable to move the model and input to CUDA.
Output is a single TENSOR named y_hat - the model's prediction(s). There's no softmax, no argmax, no name mapping: regression gives you raw numbers, and that's the point. Wire y_hat into a display node, a comparison against ground truth, or a chart like the pack's Pt Scatter for a scatter plot of predictions.
What's worth knowing
Because the output is a raw tensor, you'll typically pair this node with a bit more downstream plumbing than the classification variant - flatten or index it to extract a single predicted value, or feed it straight into a plotting node to visualize fit. The pack's simple_linear_regression_train.json example does exactly this: train on synthetic data, predict on a range, and scatter the results against ground truth to see the fitted line. Note also that inference is gradient-free here, so it's cheap to call repeatedly - handy for sweeping predictions across an input range to inspect model behavior.
The gotcha
There's no class_id_to_name_map here, which means no safety net for shape: if your inputs tensor has the wrong feature count for what the model was trained on, you'll hit a shape mismatch at runtime. The 1D auto-expansion helps with rank, but not with feature count. And like every node in this pack, the model you connect is the model that runs - load the right saved checkpoint before predicting, or your y_hat will be trained-on-nothing garbage.
Installing it
Part of ComfyUI-Pt-Wrapper (HowToSD's no-code PyTorch pack, a spin-off of ComfyUI-Data-Analysis). ComfyUI Manager → search "ComfyUI-Pt-Wrapper", or:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper
Restart after; first boot is slow while pandas, scikit-learn, transformers, sentencepiece, peft and friends install. No model files needed for the node itself.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| model | PTMODEL | — | |
| inputs | TENSOR | — | |
| use_gpu | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| y_hat | TENSOR | — |