Questions tagged [prediction]

For questions related to statistical prediction, especially for programming tasks.

In science, a prediction is a rigorous, often quantitative, statement, forecasting what will happen under specific conditions; for example, if an apple falls from a tree it will be attracted towards the center of the earth by gravity with a specified and constant acceleration. The scientific method is built on testing assertions that are logical consequences of scientific theories. This is done through repeatable experiments or observational studies.

Mathematical equations and models, and computer models (e.g., ), are frequently used to describe the past and future behaviour of a process within the boundaries of that model.

In microprocessors, permits avoidance of pipeline emptying at branch instructions. In engineering, possible failure modes are predicted and avoided by correcting the mechanism causing the failure.

2391 questions
80
votes
7 answers

Accuracy Score ValueError: Can't Handle mix of binary and continuous target

I'm using linear_model.LinearRegression from scikit-learn as a predictive model. It works and it's perfect. I have a problem to evaluate the predicted results using the accuracy_score metric. This is my true Data : array([1, 1, 0, 0, 0, 0, 1, 1, 0,…
72
votes
5 answers

Getting Warning: " 'newdata' had 1 row but variables found have 32 rows" on predict.lm

I found peculiarity while using predict and lm function in R. I got different results for data frame and vector for same data. DataFrame code: data(mtcars) fitCar<-lm(mtcars$mpg~mtcars$wt) predict(fitCar, data.frame(x=mean(mtcars$wt)), …
Kush Patel
  • 2,901
  • 4
  • 32
  • 53
59
votes
4 answers

ValueError: Wrong number of items passed - Meaning and suggestions?

I am receiving the error: ValueError: Wrong number of items passed 3, placement implies 1, and I am struggling to figure out where, and how I may begin addressing the problem. I don't really understand the meaning of the error; which is making it…
Gary
  • 1,837
  • 3
  • 16
  • 36
44
votes
5 answers

Keep same dummy variable in training and testing data

I am building a prediction model in python with two separate training and testing sets. The training data contains numerical type categorical variable, e.g., zip code,[91521,23151,12355, ...], and also string categorical variables, e.g., city…
nimning
  • 447
  • 1
  • 4
  • 5
36
votes
3 answers

xgboost in R: how does xgb.cv pass the optimal parameters into xgb.train

I've been exploring the xgboost package in R and went through several demos as well as tutorials but this still confuses me: after using xgb.cv to do cross validation, how does the optimal parameters get passed to xgb.train? Or should I calculate…
snowneji
  • 960
  • 1
  • 10
  • 18
31
votes
1 answer

Why Bother With Recurrent Neural Networks For Structured Data?

I have been developing feedforward neural networks (FNNs) and recurrent neural networks (RNNs) in Keras with structured data of the shape [instances, time, features], and the performance of FNNs and RNNs has been the same (except that RNNs require…
28
votes
2 answers

Working with neuralnet in R for the first time: get "requires numeric/complex matrix/vector arguments"

I'm in the process of attempting to learn to work with neural networks in R. As a learning problem, I've been using the following problem over at Kaggle: Don't worry, this problem is specifically designed for people to learn with, there's no reward…
user2548029
  • 405
  • 2
  • 6
  • 10
27
votes
1 answer

AttributeError: 'Model' object has no attribute 'predict_classes'

I'm trying to predict on the validation data with pre-trained and fine-tuned DL models. The code follows the example available in the Keras blog on "building image classification models using very little data". Here is the code: import numpy as…
shiva
  • 811
  • 2
  • 10
  • 18
27
votes
2 answers

Error in terms.formula(formula) : '.' in formula and no 'data' argument

I'm tring to use neuralnet for prediction. Create some X: x <- cbind(seq(1, 50, 1), seq(51, 100, 1)) Create Y: y <- x[,1]*x[,2] Give them a names colnames(x) <- c('x1', 'x2') names(y) <- 'y' Make data.frame: dt <- data.frame(x, y) And now, I got…
luckyi
  • 425
  • 2
  • 6
  • 9
26
votes
3 answers

How to train the network only on one output when there are multiple outputs?

I am using a multiple output model in Keras model1 = Model(input=x, output=[y2, y3]) model1.compile((optimizer='sgd', loss=cutom_loss_function) my custom_loss function is def custom_loss(y_true, y_pred): y2_pred = y_pred[0] y2_true =…
shaaa
  • 473
  • 1
  • 4
  • 15
24
votes
2 answers

How to get a classifier's confidence score for a prediction in sklearn?

I would like to get a confidence score of each of the predictions that it makes, showing on how sure the classifier is on its prediction that it is correct. I want something like this: How sure is the classifier on its prediction? Class 1: 81%…
user3377126
  • 1,743
  • 4
  • 23
  • 38
24
votes
2 answers

Extract prediction band from lme fit

I have following model x <- rep(seq(0, 100, by=1), 10) y <- 15 + 2*rnorm(1010, 10, 4)*x + rnorm(1010, 20, 100) id <- NULL for(i in 1:10){ id <- c(id, rep(i,101)) } dtfr <- data.frame(x=x,y=y, id=id) library(nlme) with(dtfr, summary( lme(y~x,…
ECII
  • 8,377
  • 17
  • 70
  • 114
23
votes
3 answers

Predicting a multiple forward time step of a time series using LSTM

I want to predict certain values that are weekly predictable (low SNR). I need to predict the whole time series of a year formed by the weeks of the year (52 values - Figure 1) My first idea was to develop a many-to-many LSTM model (Figure 2) using…
Lucas Brito
  • 1,026
  • 1
  • 17
  • 34
21
votes
3 answers

How to train a RNN with LSTM cells for time series prediction

I'm currently trying to build a simple model for predicting time series. The goal would be to train the model with a sequence so that the model is able to predict future values. I'm using tensorflow and lstm cells to do so. The model is trained with…
Jakob
  • 339
  • 1
  • 2
  • 9
20
votes
2 answers

How does predict.lm() compute confidence interval and prediction interval?

I ran a regression: CopierDataRegression <- lm(V1~V2, data=CopierData1) and my task was to obtain a 90% confidence interval for the mean response given V2=6 and 90% prediction interval when V2=6. I used the following code: X6 <-…
Mitty
  • 355
  • 1
  • 2
  • 8
1
2 3
99 100