New to PyTorch and the PyTorch Forecasting library and trying to predict multiple targets using the Temporal Fusion Transformer model. I have 7 targets in a list as my targets variable. I'm using MultiLoss as my loss function with a list of 7 CrossEntropy loss functions (1 per target variable) -- In the problem I'm trying to model, there are 7 possible outcomes per time step and I'm trying to find which option is most likely. I'm looking for a …
I have sales data which is seasonal and has no trend. The frequency of this series is 15 mins. I don't know how to compute the exact period of seasonality - whether it is daily or weekly or monthly or yearly. But, from plotting it, I think there is a yearly pattern. I tried removing seasonality before forecasting by lagging the series by a year and differencing the two but even the result has a yearly pattern. Code with what …
I just started to use recurrent neural networks (RNN) with Keras for time-series forecasting and I found this tutorial Forecasting with RNN. I have difficulties understanding how to build the training data both regarding the syntax and the format of the input data. Here is the code: import pandas as pd import numpy as np import tensorflow as tf from tensorflow import keras from matplotlib import pyplot as plt # Read the data for the parameters from a csv file …
I am trying to forecast some sales data with monthly values, I have been trying some classical models as well ML models like XGBOOST. My data with a feature set looks like this with a length of 110 months and I am trying to forecast for next 12 months, When it comes to XGBOOST, I've been spending time mostly on hyperparameter optimization with Gridsearch and also state-of-art packages like optuna. My currently best set of parameters looks like this, parameters …
TL;DR: Are there one-sided decomposition alternatives to the naive seasonal_decompose from statsmodels? Are there approaches to adapt intrinsically two-sided algorithms (like STL from statsmodels) to forecasting applications? I'm attempting to perform time-series forecasting. For this I want to decompose a time-series into trend and seasonal parts. I picked STL implementation from statsmodels to handle this. I gravitated towards STL instead of seasonal_decompose, since even the docs down the bottom encourage more sophisticated approaches: I noticed, however, that the decomposition is …
I am working on a project to predict the proper staffing needed for a customer service team using historical data. I am new to machine learning, and I am not sure if my approach to this problem is the right one. First I saw it as a multiple linear regression, but the more I think of the outcome I want, the more I realize regression is not the solution. I have a sample historical data with these fields: Number of …
I have a collection of time series data with data points of around 2 years of daily data. I am thinking of a way to increase the number of data points in it so that the neural network gets a better understanding of the fluctuations in the data. I am suggesting a hypothesis where I try to cluster similar time-series data following similar distribution, in order to increase the number of data points fed into the neural network. Is this …
I have a dataset of a couple of EV charging stations (10 min frequency) over 1 year. This data consists of lots of 0s, since there is no continuous flow of cars coming to charge, but rather reoccurring charging events as peaks (for example from 7-9am seems to be a frequent charging timeframe when people are coming to the office). I have also aggregated weather and weekday/holiday data to be used as features. I now wish to predict the energy …
I'm working on an implementation of LSTM neural network to forecast energy consumption. I have a dataset with load, series of weather parameters and indicator of it's bank holiday or not. I first did a network with input of 24 lag (using function from this tutorial). So I have a dataset like this, but with 18 variables and from ($t_{-24}$) var1(t-1) var2(t-1) var1(t) var2(t) 1 0.0 50.0 1 51 2 1.0 51.0 2 52 3 2.0 52.0 3 53 4 …
I tried to implement LSTM model for time-series prediction. Below is my trial code. This code runs without error. metrics = ['mean_squared_error', 'mean_absolute_error', 'mean_absolute_percentage_error'] # define model model = Sequential() model.add(LSTM(100, activation='relu', input_shape=(n_past, 6), return_sequences=True)) model.add(LSTM(100, activation='relu', return_sequences=True)) model.add(LSTM(50, activation='relu')) model.add(Dense(2, activation='relu')) model.compile(optimizer='adam', loss='mse', metrics=metrics) model.summary() ) The forecast correctly predicts the peaks, but the constant values should be 0 and you cannot predict it. However, prediction is extremely poor. How to improve the predictin? Do you have any ideas …
I have a machine learning model that I fitted with xgboost and linear regression. My dataset has thirteen features and has price as the target. Is there any way to make the model predict values in the future? I have date time as one of the variables. From searching on internet, I learned about fb prophet, and that this is a time series problem. But if my xgboost is doing well, is there a way to make it predict future …
Working on a forecast model that should output an End of monthly value, the interesting part is that we already have partial (90%) of that data available at the prediction point (max 30 days away). The purpose is to take into account the current monthly trend and project that out until the end of the month, but also take into consideration that we already know those future points with 90% confidence. For example: Let's say we're in the 3rd day …
Firstly, I am a beginner in this field of Data Science and have tried to implement some time series models for wind speed forecasting. Also, I am aware of the fact that some regression models might give better results, but still, my aim is to crack the same with the help of VAR I tried to implement multivariate time series forecasting - VAR in python. To start with I followed the code in this article- https://towardsdatascience.com/simple-multivariate-time-series-forecasting-7fa0e05579b2 However, the forecasted value …
I am really stumped at the moment about how to solve a particular problem. I have many time series like this: This represents the number of hours a person spends on a website each day throughout the year. Any days where they are not seen to be using the website have zero values, rather than missing values. What I really want to do is to calculate a metric telling me to what extent there is a consistent "1 hour per …
This is a sample of my dataset: dolar selic barril diesel ipca data 2012-01-02 1.7376 0.039270 193.79 2.040 0.47 2012-01-03 1.7152 0.039270 210.87 2.042 0.26 2012-01-04 1.7152 0.039270 210.87 2.042 0.26 2012-01-05 1.7152 0.039270 210.87 2.042 0.26 2012-01-06 2.0350 0.031976 185.79 2.045 0.07 I need to predict the diesel variable for the next 30, 60 and 90 days. My dataset has values from 2012-01-02 to 2022-03-16. dolar selic barril diesel ipca count 3727.000000 3727.000000 3727.000000 3727.000000 3727.000000 mean 3.500505 0.032195 …
I have monthly snapshots (3 years) of all the contract data. It includes following information: Contract status [Categorical]: Proposed, tracked, submitted, won, lost, etc Contract stages [Categorical]: Prospecting, engaged, tracking, submitted, etc. Duration of contract [Date/Time] : months and years Bid Start date [Date/Time]: Date (But this changes when the contracts are delayed) Contract value [Numerical] : Value of the contract in local currency Future revenue projection [Numerical]: Currency value breakdown of revenue for next 5 years (this value is …
I'm quite new to machine learning and statistics. I've a dataset from some ecommerce sale's history. It's almost 2k instances, and features include personId (string), productCategory (string/discrete), amountPaid (float/continuous), purchaseTime (string/Time(DD/MM/YYYY)). Person can purchase product at any time (irregular time interval so I can't use time series analysis, I guess). I want to know when will the same person (attr with person Id) make just next purchase in a category (attr with productCategory). What ML model should I use for …
I have log data with 100k records. And These parameters. It looks like this. message types can be helpful for anomaly type detection. Out of total 15 message 5 message considered as anomaly. e.g. invalid user, connection closed by invalid user. Option 1 - Text classification model Create a classification model using text message, where it classifies the record based on message text. But I want to to use predictive analytics using date/time parameters so that it can help for …
I'm trying to forecast timeseries with ARIMA. As you can see from the plot, the forecast is one step ahead of the expected values. I read in some other threads that this behavior is expected but how? How can I synchronize? The code I used: history = [x for x in train] predictions = list() for t in range(len(test)): model = ARIMA(history,order=(2, 2, 1)) model_fit = model.fit(disp=0) output = model_fit.forecast(alpha=0.05) yhat = output[0] predictions.append(yhat) obs = test[t] history.append(obs) print('predicted=%f, expected=%f' …