Time Series Forecasting for Humidity
I have following input values and wants to predict the humidity values for the values present in timestamps list
startDate = "2013-01-01"
endDate = "2013-01-01"
knownTimestamps = ['2013-01-01 00:00','2013-01-01 01:00','2013-01-01 02:00','2013-01-01 03:00','2013-01-01 04:00',
'2013-01-01 05:00','2013-01-01 06:00','2013-01-01 08:00','2013-01-01 10:00','2013-01-01 11:00',
'2013-01-01 12:00','2013-01-01 13:00','2013-01-01 16:00','2013-01-01 17:00','2013-01-01 18:00',
'2013-01-01 19:00','2013-01-01 20:00','2013-01-01 21:00','2013-01-01 23:00']
humidity = ['0.62','0.64','0.62','0.63','0.63','0.64','0.63','0.64','0.48','0.46','0.45','0.44','0.46','0.47','0.48','0.49','0.51','0.52','0.52']
timestamps = ['2013-01-01 07:00','2013-01-01 09:00','2013-01-01 14:00','2013-01-01 15:00','2013-01-01 22:00']
and I am using following function to predict the humidity values using AR model in python
from statsmodels.tsa.arima_model import ARIMA
def predictMissingHumidity(startDate, endDate, knownTimestamps, humidity, timestamps):
data_prediction = pd.DataFrame({'knownTimestamps': knownTimestamps,'humidity': humidity})
print(data_prediction.head(10))
history = [float(x) for x in data_prediction.humidity]
predictions =
test = timestamps
for t in range(len(test)):
model = ARIMA(history, order=(2,2,0))
model_fit = model.fit(disp=0)
output = model_fit.forecast()
yhat = output[0]
predictions.append(float(yhat))
print(predictions)
return predictions
The model predict the same value of humidity for the values in time stamp list.
res = predictMissingHumidity(startDate, endDate, knownTimestamps, humidity, timestamps)
print(res)
output = [0.5287247355700563, 0.5287247355700563, 0.5287247355700563,
0.5287247355700563, 0.5287247355700563]
Can someone help me with where I am going wrong
python pandas machine-learning time-series arima
add a comment |
I have following input values and wants to predict the humidity values for the values present in timestamps list
startDate = "2013-01-01"
endDate = "2013-01-01"
knownTimestamps = ['2013-01-01 00:00','2013-01-01 01:00','2013-01-01 02:00','2013-01-01 03:00','2013-01-01 04:00',
'2013-01-01 05:00','2013-01-01 06:00','2013-01-01 08:00','2013-01-01 10:00','2013-01-01 11:00',
'2013-01-01 12:00','2013-01-01 13:00','2013-01-01 16:00','2013-01-01 17:00','2013-01-01 18:00',
'2013-01-01 19:00','2013-01-01 20:00','2013-01-01 21:00','2013-01-01 23:00']
humidity = ['0.62','0.64','0.62','0.63','0.63','0.64','0.63','0.64','0.48','0.46','0.45','0.44','0.46','0.47','0.48','0.49','0.51','0.52','0.52']
timestamps = ['2013-01-01 07:00','2013-01-01 09:00','2013-01-01 14:00','2013-01-01 15:00','2013-01-01 22:00']
and I am using following function to predict the humidity values using AR model in python
from statsmodels.tsa.arima_model import ARIMA
def predictMissingHumidity(startDate, endDate, knownTimestamps, humidity, timestamps):
data_prediction = pd.DataFrame({'knownTimestamps': knownTimestamps,'humidity': humidity})
print(data_prediction.head(10))
history = [float(x) for x in data_prediction.humidity]
predictions =
test = timestamps
for t in range(len(test)):
model = ARIMA(history, order=(2,2,0))
model_fit = model.fit(disp=0)
output = model_fit.forecast()
yhat = output[0]
predictions.append(float(yhat))
print(predictions)
return predictions
The model predict the same value of humidity for the values in time stamp list.
res = predictMissingHumidity(startDate, endDate, knownTimestamps, humidity, timestamps)
print(res)
output = [0.5287247355700563, 0.5287247355700563, 0.5287247355700563,
0.5287247355700563, 0.5287247355700563]
Can someone help me with where I am going wrong
python pandas machine-learning time-series arima
I don't see you returningpredictions
in the function or calling the function.
– Optimesh
Jan 7 at 13:19
yes I didn't include that part in the question, I'll make the changes
– niranjan272
Jan 10 at 1:56
add a comment |
I have following input values and wants to predict the humidity values for the values present in timestamps list
startDate = "2013-01-01"
endDate = "2013-01-01"
knownTimestamps = ['2013-01-01 00:00','2013-01-01 01:00','2013-01-01 02:00','2013-01-01 03:00','2013-01-01 04:00',
'2013-01-01 05:00','2013-01-01 06:00','2013-01-01 08:00','2013-01-01 10:00','2013-01-01 11:00',
'2013-01-01 12:00','2013-01-01 13:00','2013-01-01 16:00','2013-01-01 17:00','2013-01-01 18:00',
'2013-01-01 19:00','2013-01-01 20:00','2013-01-01 21:00','2013-01-01 23:00']
humidity = ['0.62','0.64','0.62','0.63','0.63','0.64','0.63','0.64','0.48','0.46','0.45','0.44','0.46','0.47','0.48','0.49','0.51','0.52','0.52']
timestamps = ['2013-01-01 07:00','2013-01-01 09:00','2013-01-01 14:00','2013-01-01 15:00','2013-01-01 22:00']
and I am using following function to predict the humidity values using AR model in python
from statsmodels.tsa.arima_model import ARIMA
def predictMissingHumidity(startDate, endDate, knownTimestamps, humidity, timestamps):
data_prediction = pd.DataFrame({'knownTimestamps': knownTimestamps,'humidity': humidity})
print(data_prediction.head(10))
history = [float(x) for x in data_prediction.humidity]
predictions =
test = timestamps
for t in range(len(test)):
model = ARIMA(history, order=(2,2,0))
model_fit = model.fit(disp=0)
output = model_fit.forecast()
yhat = output[0]
predictions.append(float(yhat))
print(predictions)
return predictions
The model predict the same value of humidity for the values in time stamp list.
res = predictMissingHumidity(startDate, endDate, knownTimestamps, humidity, timestamps)
print(res)
output = [0.5287247355700563, 0.5287247355700563, 0.5287247355700563,
0.5287247355700563, 0.5287247355700563]
Can someone help me with where I am going wrong
python pandas machine-learning time-series arima
I have following input values and wants to predict the humidity values for the values present in timestamps list
startDate = "2013-01-01"
endDate = "2013-01-01"
knownTimestamps = ['2013-01-01 00:00','2013-01-01 01:00','2013-01-01 02:00','2013-01-01 03:00','2013-01-01 04:00',
'2013-01-01 05:00','2013-01-01 06:00','2013-01-01 08:00','2013-01-01 10:00','2013-01-01 11:00',
'2013-01-01 12:00','2013-01-01 13:00','2013-01-01 16:00','2013-01-01 17:00','2013-01-01 18:00',
'2013-01-01 19:00','2013-01-01 20:00','2013-01-01 21:00','2013-01-01 23:00']
humidity = ['0.62','0.64','0.62','0.63','0.63','0.64','0.63','0.64','0.48','0.46','0.45','0.44','0.46','0.47','0.48','0.49','0.51','0.52','0.52']
timestamps = ['2013-01-01 07:00','2013-01-01 09:00','2013-01-01 14:00','2013-01-01 15:00','2013-01-01 22:00']
and I am using following function to predict the humidity values using AR model in python
from statsmodels.tsa.arima_model import ARIMA
def predictMissingHumidity(startDate, endDate, knownTimestamps, humidity, timestamps):
data_prediction = pd.DataFrame({'knownTimestamps': knownTimestamps,'humidity': humidity})
print(data_prediction.head(10))
history = [float(x) for x in data_prediction.humidity]
predictions =
test = timestamps
for t in range(len(test)):
model = ARIMA(history, order=(2,2,0))
model_fit = model.fit(disp=0)
output = model_fit.forecast()
yhat = output[0]
predictions.append(float(yhat))
print(predictions)
return predictions
The model predict the same value of humidity for the values in time stamp list.
res = predictMissingHumidity(startDate, endDate, knownTimestamps, humidity, timestamps)
print(res)
output = [0.5287247355700563, 0.5287247355700563, 0.5287247355700563,
0.5287247355700563, 0.5287247355700563]
Can someone help me with where I am going wrong
python pandas machine-learning time-series arima
python pandas machine-learning time-series arima
edited Dec 2 at 3:04
asked Jan 7 at 2:32
niranjan272
108
108
I don't see you returningpredictions
in the function or calling the function.
– Optimesh
Jan 7 at 13:19
yes I didn't include that part in the question, I'll make the changes
– niranjan272
Jan 10 at 1:56
add a comment |
I don't see you returningpredictions
in the function or calling the function.
– Optimesh
Jan 7 at 13:19
yes I didn't include that part in the question, I'll make the changes
– niranjan272
Jan 10 at 1:56
I don't see you returning
predictions
in the function or calling the function.– Optimesh
Jan 7 at 13:19
I don't see you returning
predictions
in the function or calling the function.– Optimesh
Jan 7 at 13:19
yes I didn't include that part in the question, I'll make the changes
– niranjan272
Jan 10 at 1:56
yes I didn't include that part in the question, I'll make the changes
– niranjan272
Jan 10 at 1:56
add a comment |
1 Answer
1
active
oldest
votes
For me it looks you just repeat same calculation n times where n is len(test). The iteration variable t is never used and all arguments are the same every time.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48133827%2ftime-series-forecasting-for-humidity%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
For me it looks you just repeat same calculation n times where n is len(test). The iteration variable t is never used and all arguments are the same every time.
add a comment |
For me it looks you just repeat same calculation n times where n is len(test). The iteration variable t is never used and all arguments are the same every time.
add a comment |
For me it looks you just repeat same calculation n times where n is len(test). The iteration variable t is never used and all arguments are the same every time.
For me it looks you just repeat same calculation n times where n is len(test). The iteration variable t is never used and all arguments are the same every time.
answered Jun 13 at 13:34
Sasha Shipka
2114
2114
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48133827%2ftime-series-forecasting-for-humidity%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I don't see you returning
predictions
in the function or calling the function.– Optimesh
Jan 7 at 13:19
yes I didn't include that part in the question, I'll make the changes
– niranjan272
Jan 10 at 1:56