# Tag Info

34

In general time series are not really different from other machine learning problems - you want your test set to 'look like' your training set, because you want the model you learned on your training set to still be appropriate for your test set. That's the important underlying concept regarding stationarity. Time series have the additional complexity that ...

11

Random forest (as well as most of supervised learning models) accepts a vector $x=(x_1,...x_k)$ for each observation and tries to correctly predict output $y$. So you need to convert your training data to this format. The following pandas-based function will help: import pandas as pd def table2lags(table, max_lag, min_lag=0, separator='_'): """ Given a ...

7

As David states in the comments if you want to interpret a model you likely want to explore something besides neural nets. That said it you want to intuitively understand the network plot it is best to think of it with respect to images (something neural networks are very good at). The left-most nodes (i.e. input nodes) are your raw data variables. The ...

5

I want to know which model between additive and multiplicative best suits the above data. It is hard to tell just by looking at it. A multiplicative decomposition roughly corresponds to an additive decomposition of the logarithms. The additive decomposition is the most appropriate if the magnitude of the seasonal fluctuations, or the variation around the ...

4

It looks like that you are using scikit-learn. In this case use Grid Search Cross Validation or Randomized Search Cross Validation to find the best parameters. sklearn.grid_search.GridSearchCV(estimator, param_grid, scoring=None, cv=None, ...) In these approaches you basically loop over possible sets of your parameters, specified via param_grid. For each ...

3

I have two ideas here, maybe they will be helpful. Idea 1: Model time between events You might think of your data as being generated by two processes: the first is a distribution over time intervals, and the second is a distribution over purchase amounts. So to model your data you could create one distribution (gaussian?) over the nonzero values in your ...

3

No, it is not possible with Vanilla LSTM. It's not a Kera problem, but the fundamental structure of Vanilla LSTM. I think you have a bit of misunderstanding of how LSTM works. You are assuming given $x_0$...$x_{19}$ the LSTM is predicting $x_{20}$...$x_{39}$. This is NOT the case. In LSTM if your input sequence is $x_0$...$x_{19}$ then your output ...

3

I would try out regression in Python's scikit-learn library to predict the September headcount given all those other variables you have. Here is a basic example using a linear model. Once you have that working, you could try a more sophisticated algorithm. http://scikit-learn.org/stable/auto_examples/linear_model/plot_ols.html

3

If you have daily data you could create a dummy time calendar, i.e. you create a dummy variable for each day of the week and include your company's promotions for each product, Christmas, Easter, public holidays. Then use autoarima() or nnetar() (or combine them) to forecast the time horizon you want. This link is a good example. Another possible way to do ...

3

You bring up a number of good questions here Ans. I will do my best to cover each of them in turn. It isn't an exhaustive treatment but hopefully it helps... 1. How to normalize the categories. First, assess whether your categorical variables can be considered zero variance (e.g. all records possessing one category only) or near zero variance (vast ...

3

NARMAX Methodology and Residual analysis both address this issue. Search for the following articles:(Error = Residual = Noise) Chaotic Time Series Prediction with residual Analysis Method Using Hybrid Elman–NARX Neural Networks, Muhammad Ardalani-Farsa (2010) Orthogonal Least Squares Methods and their Application to Non-Linear System Identification, S. Chen,...

3

The model you are looking for is called ARIMA, which are time series models where you can obtain trends, cycles, etc. The ARIMA models lets you model your univariate data by detecting monthly/annual cycles, natural growth (trends) for a variable depending on the history of the same variable.

3

You may use the technique explained in the article "Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning" Very briefely the technique consists of applying dropout for training and predictions. In Keras this can be easily applied passing the training argument in the call of the Dropout layer. import keras input = ... x ...

3

Calculate one day returns. Plot histogram of daily returns. Calculate $log(\frac{price_{i+1}}{price_i})$. Plot histogram of above logarithm. If second plot is more likely to be normally distributed then choose multiplicative model. Else, choose additive model. You can also perform statistical test for normal distribution and check, which one has higher p-...

2

A couple of ways to improve your design: Consider a different normalization: The sigmoid function will attenuate large moves. It is likely precisely these large non-linear moves that attracted you to using neural networks in the first place. Why remove them? A simple whitening of the data may be better As pointed out by Nima, your model can only predict ...

2

I'm not sure what you mean by "performance", but if what you mean is fit the answer is clear. You need to be using the log-likelihood to differentiate between different models. Basically, when you are fitting the model you are trying to maximize the log-likelihood. Thus the log-likelihood is giving you some sense of how well the parameters of your model are ...

2

You could use Bass or Gamma/Shifted Gompertz method to do that. You could use diffusion package in R. Here an example (it is form documentation of the package) : library(diffusion) fitbass <- diffusion(tsChicken[, 2], type = "bass") fitgomp <- diffusion(tsChicken[, 2], type = "gompertz") fitgsg <- diffusion(tsChicken[, 2], type = "gsgompertz")...

2

I will try below steps: Find similar existing products: Clustering the brand new product with existing products. Interpolate the predicted sales for this brand new product: Since we already found a cluster of existing products which are similar to this brand new product, we can apply predicting algorithm on the existing products and interpolate the ...

2

Without any additional data description, i would try out something along these lines: Cluster the shapes of the sales curves using methods for longitudinal data clustering (K-means for longitudinal data / frechet distance...) Classify your products by using the features that you have as predictors and the cluster label as response (CHAID trees / random ...

2

For linear regression you want to use R's lm() function, like this: my.model <- lm(response.variable ~ predictor1 + predictor2, data = my.data) Look at the model using: summary(my.model) You can apply this model to a "test" dataset (your 20% split) by using predict(), like this: predict(my.model, test.data)

2

One important thing to start with is to check that your targets are in [-1, 1] range because you have a 'tanh' as output function. You should also analyze the distribution of your targets (True class). Then, one of the first steps that I would recommend is to try to overfit your model. Make a model 'complex enough' and overfit small proportion of your ...

2

Do you want to forecast sales by day over a series of days? That would be more like ARIMA. Do you want to forecast "How many widgets will we sell in the next month"? That would be more like a regression problem. As an aside, if the retailer you're working with has a large assortment of products that changes over time (e.g. seasonal clothing) then you should ...

2

If you're working with R language, I would suggest first to try use R ecosystem's abilities to parallelize the processing, if possible. For example, take a look at packages, mentioned in this CRAN Task View. Alternatively, if you're not comfortable or satisfied with the approaches, implemented by the above-referred packages, you can try some other ...

2

First thing first, when ever you use Time Series data you call it as Forecasting not Prediction as it is time dependent. To understand why you can go through this link Metrics to compare models When you are trying to compare between models you need to use AIC,BIC, AUC etc values. you can go though this link to understand better Metrics to Access the Model ...

2

ConvLSTM, keras has an implementation, therefore you can go with Python itself. If you want multiple outputs from the LSTM, you can have look at return_sequences and return_state feature in LSTM layers. Default values for them are None, But if you give True you can get multiple outputs for each timestep, and for everyone. This excellent blog post helped me ...

2

I'm glad to see this question because this site gets such few questions on models that are actually in a production state. If I was in your position, I would start to think about how I'm going to use this algorithm on a go-forward basis and start to log everything. Every new prediction that your algorithm makes is also a new data point for training. So ...

2

It's correct. The reason it sounds so weird is that a 1-layer-NN without activation function is simply a linear map, so it's equivalent to any linear model, the only difference being the inputs having some interpretation. This even holds true for any NN, no matter the number of layers, without activation functions. The reason: A k-layer-NN is just k matrix ...

1

I liked the way you put across your question! I think we cannot cannot say in specific will work well with data, it is most likely trial & error method, If ARIMA is not performing well and assuming that there is no trend in data then you can use AR, Exponential Smoothening. These are basic techniques but as you know in many scenarios basic models can ...

1

Like you stated, you get good predictions based on the information in the model. The model conflates demand and supply in the case of under-supply, since it has no information about unfulfilled demand: how many products were requested but not sold due to lack of supply. Instead it tracks $sold = min(demand,supply)$. Extend the Model The obvious solution ...

1

Not a fully complete answer, but some inputs. Your time series are correlated. I assume that the measure you want to forecast for a region is an aggregation of units forecasts. To address the first point, I usually use Vector Autoregressive Model (VAR) that forecast all time-series at once (each one being expressed as a regression using the others) The ...

Only top voted, non community-wiki answers of a minimum length are eligible