Questions tagged [predict]

Prediction of values based on model objects.

Predictive models are statistical or algorithmic models for use in prediction tasks. These tend to arise in data-intensive contexts, hence there is a strong association with statistics and machine learning.

Tag Usage

Questions on tag should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

1574 questions
11
votes
0 answers

XGBoost model: train on GPU, run on CPU without GPU RAM allocation

How can I train an XGBoost model on a GPU but run predictions on CPU without allocating any GPU RAM? My situation: I create an XGBoot model (tree_method='gpu_hist') in Python with predictor='cpu_predictor', then I train it on GPU, then I save…
S.V
  • 2,149
  • 2
  • 18
  • 41
11
votes
3 answers

Python ARIMA exogenous variable out of sample

I am trying to predict a time series in python statsmodels ARIMA package with the inclusion of an exogenous variable, but cannot figure out the correct way to insert the exogenous variable in the predict step. See here for docs. import numpy as…
Jim Crozier
  • 1,378
  • 2
  • 16
  • 28
10
votes
2 answers

H2O AutoML error Test/Validation dataset has a non-categorical column which is categorical in the training data" on predict

I have trained and saved my H2O AutoML model. after reloading, while I am using predict method, I am getting below error: java.lang.IllegalArgumentException: Test/Validation dataset has a non-categorical column 'response' which is categorical in the…
ATUL AGARWAL
  • 101
  • 1
  • 3
10
votes
1 answer

Getting different results from Keras model.evaluate and model.predict

I have trained a model to predict topic categories using word2vec and an lstm model using keras and got about 98% accuracy during training, I saved the model then loaded it into another file for trying on the test set, I used model.evaluate and…
Mina Melek
  • 185
  • 1
  • 14
10
votes
1 answer

linear model with `lm`: how to get prediction variance of sum of predicted values

I'm summing the predicted values from a linear model with multiple predictors, as in the example below, and want to calculate the combined variance, standard error and possibly confidence intervals for this sum. lm.tree <- lm(Volume ~ poly(Girth,2),…
CCID
  • 1,368
  • 5
  • 19
  • 35
10
votes
6 answers

Deciding threshold for glm logistic regression model in R

I have some data with predictors and a binary target. Eg: df <- data.frame(a=sort(sample(1:100,30)), b= sort(sample(1:100,30)), target=c(rep(0,11),rep(1,4),rep(0,4),rep(1,11))) I trained a logistic regresion model using…
user2175594
  • 799
  • 3
  • 9
  • 17
10
votes
1 answer

How to deal with NA in a panel data regression?

I am trying to predict fitted values over data containing NAs, and based on a model generated by plm. Here's some sample code: require(plm) test.data <- data.frame(id=c(1,1,2,2,3), time=c(1,2,1,2,1), y=c(1,3,5,10,8), x=c(1, NA, 3,4,5)) model <-…
Rodrigo
  • 473
  • 4
  • 14
10
votes
3 answers

How to predict x values from a linear model (lm)

I have this data set: x <- c(0, 40, 80, 120, 160, 200) y <- c(6.52, 5.10, 4.43, 3.99, 3.75, 3.60) I calculated a linear model using lm(): model <- lm(y ~ x) I want know the predicted values of x if I have new y values, e.g. ynew <- c(5.5, 4.5,…
alexmulo
  • 751
  • 4
  • 11
  • 23
9
votes
0 answers

Using `ordinal::clmm` model to make predictions on new data

I have some repeated measures, ordinal response data: dat <- data.frame( id = factor(sample(letters[1:5], 50, replace = T)), response = factor(sample(1:7, 50, replace = T), ordered = T), x1 = runif(n = 50, min = 1, max = 10), x2 = runif(n =…
jrudd
  • 91
  • 2
9
votes
2 answers

Predicting Missing Words in a sentence - Natural Language Processing Model

I have the sentence below : I want to ____ the car because it is cheap. I want to predict the missing word ,using an NLP model. What NLP model shall I use? Thanks.
alyssaeliyah
  • 2,214
  • 6
  • 33
  • 80
9
votes
2 answers

fastai learner requirements and batch prediction

I previously trained a resnet34 model using the fastai library, and have the weights.h5 file saved. With the latest version of fastai, do I still need to have non-empty train and valid folders in order to import my learner and predict on the test…
Austin
  • 6,921
  • 12
  • 73
  • 138
9
votes
1 answer

Inconsistent predictions from predict.gbm()

UPDATE: I have tried running the code on https://rdrr.io/snippets/ and it works fine. Therefore, I suspect a problem with my R installation, but it is extremely worrying that this can happen without errors or warnings. What are the best steps to…
Robert Long
  • 5,722
  • 5
  • 29
  • 50
9
votes
2 answers

predict.svm does not predict new data

unfortunately I have problems using predict() in the following simple example: library(e1071) x <- c(1:10) y <- c(0,0,0,0,1,0,1,1,1,1) test <- c(11:15) mod <- svm(y ~ x, kernel = "linear", gamma = 1, cost = 2,…
Richard
  • 201
  • 1
  • 3
  • 5
9
votes
1 answer

Predicting responses for new observations using a model developed with multiple imputation via MICE

I have developed a model via multiple imputation using mice. I want to use this model to predict responses for new observations (containing no missing data), including standard errors. Passing the model object created in mice to predict doesn't…
wjchulme
  • 1,928
  • 1
  • 18
  • 28
9
votes
1 answer

Prediction - Neural network for regression predicts same value

I am trying to predict median value of owner-occupied homes, its a worked example which is giving a good…
Sam
  • 191
  • 1
  • 12