Forecasting attempts to predict
trends in the future. In Predictive Cloud Computing we are analyzing tennis and golf
scores, schedules, injuries, log data, tweets, and player popularity to determine future
cloud services demand. I’m Aaron Baughman, a Master Inventor and Senior Technical Staff
Member working with IBM Sports and Entertainment Group. I’ll be showing you how I configure
our forecasting framework for sinusoidal spiketrends in our data. First I want to show you our JSON file.
As you can see over here, we have a couple JSON files. These files configure the forecasting
framework we want to use within an event, such as Roland Garros. So if I look at
the turringsOracle, this one has both the cyclical patterns in our data as well as the spike trends. And
so at the top you can see curve order. Curve order determines the precedence level for
the type of curve order we’re going to show. So the first precedence is the calculated,
this is the one that we’re going to forecast the combined both the composite forecaster
that has the residual, cyclical, and the spike forecasting. Now if for some reason it fails,
then we go to the cached forecast. The cached forecast is a forecasted calculated curve
that was done at a previous event. Now if it’s stale, then we try to stretch and fit
the average curve from our historical data so that it is reasonable with respect to a
forecast. Otherwise, if we can’t get a good stretch fit average curve, then our last try
is the average curve. Where you basically take in for every time stamp or minute out
of 1,440 minutes in a day. We’re going to look and see if we get an average forecast
curve that makes sense. Then if we look here at config, we have a CompositeForecaster and
the class that we used is a CompositeForecaster and within it we have another class called
a CompositeForecastBuilder. So we use a whole bunch of different builders that are attached
to each of these Java classes. And we pass them into the builder the different types
of JSON configs. So, for example, for the event based forecast which looks at spikes,
we look ahead 180 minutes, and then we define the builder there which is the EventEnsembleForecastBuilder.
And then the forecaster which we’re going to select is a WatsonLinearImpact and the
parameters tell us where are the factors and the factors are the predictors for the multiple
regression. And then we want to know the model pack or where is it we we want to use the
model pack which is ustaLinearModel.txt file. And this is our multiple regression model
that gives us a continuous value out of that. Then, in order to coerce the shape of that
forecaster, we use a parabolic shape and we have a booster that says that I want to increase
the forecast number or amplitude by 10%. Usually I say that the center of this parabola should
be 720 minutes during the day and the peak is going to be 1s that always normalize it,
so 1 in this case. And then the slope. So we set all of this so we can coerce the shape
of the eventForecast into a parabola which is what historical data looks like. We can
also change this if the historical data changes as well. Next we go to the residualForecasters,
the residualForecaster is actually done after we combine the cyclical and the CompositeForecaster
or the event based forecaster in this case and we use a LoessResidualForecaster which
takes into account the mathematical error that we have whenever we do any type of interpolation.
Then I go into my cyclicalForecast which looks at my sinusoidal type of patterns. you can
see that I also design a residual type of forecaster here just for the cyclical forecast
because there’s also mathematical errors there as well. Then the forecasters, it’s a list
right? So my AdjustedAverageForecast, my VectorForecast, QuadraticForecast, PartialForecast, CubicForecast,
so I have five different forecasts that it defines, but I also have different post processors
that happen after I combine each of the different forecasts. And you can see it when NoisePostprocessor
waits for the postprocessor MovingAveragePostprocessor and a MinimumPostprocessor. Some of them have
parameters, some of them don’t. The parameters are used within the builder and I’ll show
you that in just a minute. Then I also define postprocessors to happen after the CompositeForecaster
and you can see the various forecasters that I have defined there. So let’s go ahead and
look at one of the forecasting frameworks, so how do we actually parse this? I go down
to my com.ibm.ei forecast package and then jump down to my framework. Then I want to
look at my forecasting configuration. So let’92s look at the CompositeForecast first. My CompositeForecast
I have a getBuilder for this interface CompositeForecast and then I have different lists. For my getResidualForecasters
because there can be list forecasters within the JSON file and I have my CyclicalForecast
where I see getCyclicalForecast is just a Java class. Likewise, with the events based
forecast. And then I have my Postprocessors defined here with my PostprocessorValue which
is a custom class. Within that class I also have a custom way of which I want to apply
the parsing of the JSON. if I look at the ForecastingConfiguration, this is where the
top level, so I showed you the CompositeForecast and you can see this here CompositeForecast
and then my getCompositeForecast and then this pretty much maps 1:1 to the top-level
elements in that JSON file. Here’s a builder an example of a static class within a forecasting
configuration.java class. So I have a private constructor here, and I don’t really do much
with it and that’s why it’s private. But I only use the static ForecastingConfiguration
so I build a pass and a ByteSource. The ByteSource is a JSON file itself and then I go ahead
and register modules into an ObjectMapper so that I know how I should be parsing out
the JSON. And I also want to know how should I be parsing the TIMESTAMPS. And then finally,
once I have the mapper configured, I want to read the value which is the input, my ByteSource
and then the class I want to marshal against would be the forecast.configuration.class.
This is the class I’m currently in so then it would try to go in and read the interface
and say Ok, I need to go in and find the CompositeForecast class, which was the class I showed you, this
one. And this is another interface and it says that this one uses a CyclicalForecast
then you can see here that I have my ResiduaForecasters defined. and they’re going to run after every
single CyclicalForecast has finished. But then I have a list of forecasters types. And
that can be one of 5 forecasters I have stored in this list. If I want to get to those forecasters,
I just call this method on that. Let’s look at the PostprocessorType. I’m going to go
ahead and go into it. At the very top you can see that the PostprocessorType is enumerated
in Java and I’ve set up the different types of Postprocessor. So I pass NoisePostprocessor,
then I know the class that I want to use is the NoisePostprocessor so I set up that for
each element in the enum what class do I want to use here, so then whenever I say ok, I
want to create a PostprocessorType, I pass in the type of Postprocessor, set it, and
then I can build it, the object that I want. With the Postprocessors, I generally want
to pass in a TrainingFold which has my training data and I also want to pass in my forecastParameter
and these parameters tell us what type of look aheads do I want. What is the moving
window? Those general types of parameters that are tied to each one of the PostProcessors.
System parameters are another type of params that I can set if I really need to. But in
this case I don’t need system parameters here. Then I create a new class of parameters and
I say that it’s going to be TrainingFold, parameter class, two parameter classes actually.
This tells reflection exactly how to set the instructor so now I want to get the constructor
from the Postprocessor which is what I passed in here. And once I have it, I just want to
check in here to make sure that constructor is not null. And once I do that, I say, ok
let’s create a new instance given the constructor from the postProcessor and that’s pass in
all the different objects. So every single postProcessor must have these 3 different parameters. So once
I do that, then I have my postProcessor that I in turn can apply and keep going forward.
There are just various ways that I can get postProcessorType. I can pass in name
if I want and I’d get the IIII value. And here are ways that I deserialize different
parts of the JSON properties. And then I create for example the maps that I’m going to use.
I have my values and my map here and I go through and I just read in all the values
that are available from the JSON file stick to params that are returning. So here’s the
static class of the post processor value. This is what I use to store all of the different
maps or map values or entries. I have a type and I have a param name. That’s how it works,
that’s how I create postProcessors and I also create forecasters in much the same way. So
let’s take a look at how I create forecasters. So here’s the EventBasedForecast and again
you see it’s an interface. If I go on into the EventBasedForecasterValue, then I can
see that much like the postProcessers, I have another enumerator except this one implements
the EventForecasterBuilder. I’ve defined each one of the different types of EventBasedForecasters.
The only one that we have been using through the experimental reasons and have been evaluated
is the linear multiple regression better than the quadratic and the cubic. Just use the
watsonlinear. I’d pass in and say that I just want to get to watsonlinear and go ahead and
build. Given the parameters of watsonlinear go ahead and build a WatsonImpactForecast
and return that value. Much like the others, I have other ways I can get to other types
of Watson forecasts. You can pass a name and I’ll get it back. And let’s look again
at the EventBasedForecast. So here’s the interface that each one of the EventBasedForecast must
implement. So it must be able to give a forecast,’a0a forecast given the interval of forecast as
well as all the events that we have simulated for the future. Then if I want to get the
typing forecaster, then I can get it and I can also retrieve the parameters. Let’s also
look at the Forecastertype so you can get another example. Here’s the Forecastertype,
I have the AdjustedAverageForecast, VectorForecast, QuadraticForecast, CubicForecast and PartialForecast.
The biggest difference here, is that each one of these will have a different FORECAST_HORIZON
so I just pass that into the enumerator and whenever I do that, then I have that available
so that I can pass in or I can retrieve the particular FORECAST_HORIZON. I want to
override from the ForecasterBuilder, so let’s go to the ForecasterBuilder and look.
This is the build where I need to have ForecastInstance. But I need to go ahead and override that.
So I have my own kind of builder that’s a new AdjustedAverageForecast, new average forecaster,
pass in the FORECAST_HORIZON and the trainingForecast. If I look at the instructor
for this so for this ForecasterType I have a duration ForecastHorizon and I set that
here. And I have getters and setters so that at the top I can getForecastHorizon, that’s
going to get the forecast that I have passed in to, not the method itself. Finally, I return
each one of the forecasters so that I can use them. Just look at one more JSON file.
This doesn’t have any curveOrders. This is just a test to see what happens if we don’t
find any of the curveOrders? In this case it would just fail. But it has much of the
same compositeForecast, eventBasedForecasters, as well as all of the eventBasedForecasters defined
here. And it has a ResidualForecasters that’s going to run after the Cyclical and event
based forecasters it can find. The CyclicalForecastBuilder has all the different forecasters AdjustedAverage,
Vector, Quadratic, Partial Cubic, 1, 2, 3, 4, 5, and then my Postprocessors are here
just for the Cyclical and you see the params are quite different between the Postprocess
and Cyclical contrasted to the Postprocess here. And so that’s how it works to configure
a forecast. You read into this file every 10 minutes so we have a quartz process that
runs in java and after that expires in 10 minutes so we reparse the forecast framework.
And once we have the framework then we can go ahead and the entire framework with the
cyclical and residual event with the Postprocessors that are defined in that configuration so
that we can get the most accurate forecast. Thanks a lot for listening and I hope you
enjoyed this video of the 9-part series in Predictive Cloud Computing.

Tagged : # # # # # # #

Dennis Veasley

Leave a Reply

Your email address will not be published. Required fields are marked *