I am learning data science. I have the following dataset for train tickets:

1. order_date_meduim


2. order_ordercityA_ordercityB [some order has only 1 ordercity, I think ordercity means here which city is something like source and destination]


3. order_ticketcount,ticketclass


I need to forecast the ticket sales for a week and also the ordercity with medium of booking.

As I am new, could someone give a possible answer about how to create a prediction model that could predict the sales for 1 week? Also, I doubt the data is time-series data.

I code in Python.

  • $\begingroup$ Yes it's timeseries; work on adding more features to the data which you think could help the model to strengthen its preds.add various statistics and groupby cols, check for holidays and all, weekends, hour etc, etc and I truly recommend not to jump into Time series first without having proper aspect of ML or hands on experience on various datasets/comps/hacks $\endgroup$
    – Aditya
    Mar 10 '19 at 2:53

You have got yourself a time series forecasting problem. And with multiple input variables it is called multivariate time series forecasting.

What Is Time Series Forecasting?

You can start with EDA on your data and find out if you can see any trend or seasonality. ( You might need to add or update your current features to get underlying trend/seasonality )

After EDA, you can start looking into following models, all of them are the go-to for time series prediction problem:

  • Classical, Statistical
    • ARMA for stationary data
    • ARIMA for data with a trend - Refer
    • SARIMA for data with seasonality
    • Holt-Winters Forecasting - Refer
    • Theta method - Refer
    • Fourier Transformation - Refer
  • Machine Learning
    • Quantile Regression Forest(QRF)
    • Support Vector Regression(SVR)
    • Recurrent Neural Networks(RNNs) (LSTM)

If you are not comfortable with Statistics then I would advise you to start with LSTMs for forecasting - Refer

  • $\begingroup$ How to find out the ticketclass or so called categorical column using timeseries forecasting $\endgroup$ Mar 15 '19 at 17:21
  • 1
    $\begingroup$ This is an exact duplicate of another answer you posted. Please customize the answer to the actual question. This is pretty broad as advice. $\endgroup$
    – Sean Owen
    Mar 16 '19 at 20:33

Generally, the first step in modeling is merging all separate datasets into a single dataset. It looks like the data can be joined on order as a key.

Then, sort the data by date.

Next, visualize the data to see general trends and outliers.

The prophet package can estimate forecasts for time series data. A quick-start notebook is here.


The first step is to place all your variables on the same dataframe, so a date row would have a complete set of information for that specific date. The second step is to understand the data and make sure the data make sense. At this stage you have three different data set with a different number of rows. The exact same variable "order" has three different values across the three tables. Does that make sense?

You also have only 5 somewhat random data points. I think with just 5 random data points, you won't have enough information to develop a model that is anymore predictive than a simple average. Train ticket sales is most probably very highly seasonal (vacation, holidays, workweek, commuters, etc.). To do a good model I would venture you need at least a few years of data so you can observe the seasonal pattern from year to year.

If you are just learning data science, I may suggest start with another data set that is a heck of a lot larger than this. Here you have literally nothing to work with.

  • $\begingroup$ I only added the 6 first rows. The dataset is quite big. $\endgroup$ Mar 17 '19 at 15:49
  • $\begingroup$ There are still a lot of questions with your data set. With three separate variables with different values have exactly the same name "order" how do you know what "order" really means? $\endgroup$
    – Sympa
    Mar 18 '19 at 17:19
  • $\begingroup$ It is the order number which is a primary key for those tables. $\endgroup$ Mar 19 '19 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.