Regression forecasting and predicting - Practical Machine Learning Tutorial with Python p.5

Channel:
Subscribers:
1,410,000
Published on ● Video Link: https://www.youtube.com/watch?v=QLVMqwpOLPk



Category:
Tutorial
Duration: 14:28
346,995 views
2,350


In this video, make sure you define the X's like so. I flipped the last two lines by mistake:

X = np.array(df.drop(['label'],1))
X = preprocessing.scale(X)
X_lately = X[-forecast_out:]
X = X[:-forecast_out:]

To forecast out, we need some data. We decided that we're forecasting out 10% of the data, thus we will want to, or at least *can* generate forecasts for each of the final 10% of the dataset. So when can we do this? When would we identify that data? We could call it now, but consider the data we're trying to forecast is not scaled like the training data was. Okay, so then what? Do we just do preprocessing.scale() against the last 10%? The scale method scales based on all of the known data that is fed into it. Ideally, you would scale both the training, testing, AND forecast/predicting data all together. Is this always possible or reasonable? No. If you can do it, you should, however. In our case, right now, we can do it. Our data is small enough and the processing time is low enough, so we'll preprocess and scale the data all at once.

In many cases, you wont be able to do this. Imagine if you were using gigabytes of data to train a classifier. It may take days to train your classifier, you wouldn't want to be doing this every...single...time you wanted to make a prediction. Thus, you may need to either NOT scale anything, or you may scale the data separately. As usual, you will want to test both options and see which is best in your specific case.

With that in mind, let's handle all of the rows from the definition of X onward.
https://pythonprogramming.net/forecasting-predicting-machine-learning-tutorial/
https://twitter.com/sentdex
https://www.facebook.com/pythonprogramming.net/
https://plus.google.com/+sentdex




Other Videos By sentdex


2016-05-03Euclidean Distance - Practical Machine Learning Tutorial with Python p.15
2016-05-01K Nearest Neighbors Application - Practical Machine Learning Tutorial with Python p.14
2016-04-29Classification w/ K Nearest Neighbors Intro - Practical Machine Learning Tutorial with Python p.13
2016-04-26Testing Assumptions - Practical Machine Learning Tutorial with Python p.12
2016-04-23Programming R Squared - Practical Machine Learning Tutorial with Python p.11
2016-04-21R Squared Theory - Practical Machine Learning Tutorial with Python p.10
2016-04-18How to program the Best Fit Line - Practical Machine Learning Tutorial with Python p.9
2016-04-17How to program the Best Fit Slope - Practical Machine Learning Tutorial with Python p.8
2016-04-16Regression How it Works - Practical Machine Learning Tutorial with Python p.7
2016-04-14Pickling and Scaling - Practical Machine Learning Tutorial with Python p.6
2016-04-13Regression forecasting and predicting - Practical Machine Learning Tutorial with Python p.5
2016-04-12Regression Training and Testing - Practical Machine Learning Tutorial with Python p.4
2016-04-11Regression Features and Labels - Practical Machine Learning Tutorial with Python p.3
2016-04-10Regression Intro - Practical Machine Learning Tutorial with Python p.2
2016-04-10Practical Machine Learning Tutorial with Python Intro p.1
2016-03-16Building a Quadcopter p.5 - First flight and other Info
2016-03-14Building a Quadcopter p.4 - ESC Calibration with Hobbypower KK2.15
2016-03-11Building a Quadcopter p.3 - Assembly
2016-03-08Building a Quadcopter p.2 - Parts
2016-03-07Building a Quadcopter p.1 - Introduction
2016-03-04[See Description] Pipeline Tutorial - Python for Finance with Quantopian and Zipline 20



Tags:
machine learning
python
tutorial
artificial intelligence
scikit-learn
theano
tensorflow
regression
linear regression
linear regression code
forecast
predict