Jump to content

A signal for training duration parameter in ForecastLinear


Recommended Posts

Hi all,

So I am trying to create a linear forecast that has a constantly changing training duration as one of the parameter.

For example : $inputsignal.ForecastLinear($durationsignal,forecastduration)

This is because sometimes the input signal has a step change and I would want to reset the forecast duration to start again from this step change.

Is this something possible to execute? or is there any alternative method?

Thanks all.

Edited by Bayu Aryadica
Link to comment
Share on other sites

  • Super Seeqer

Unfortunately currently (R53) the ForecastLinear() operator does not allow for a calculated scalar to be passed in as a parameter to the function. However, I came up with this two step work around that should help get you started on your workflow 

Step 1 - Create a scalar for the time interval since your last step change In my example here I am going to use the time since the Example -> Area A -> Compressor Stage signal last changed values. You will need to create a similar calculation for your workflow

$cond = $cs.toCondition().removeLongerThan(40h)
//Create a condition with a capsule that starts each time you want to reset your training range
$currentCap = $cond.toGroup(capsule(now()-1min,now())).pick(1)
//Pick the most capsule closest to "Now" 
$currentCap.duration().convertUnits("min")
//Plot the duration of the most recent capsule as a scalar value

 

image.png

 

Step 2 - Manually generate linear forecast

$trainingCapsule = capsule(now()-$Step1DurationScalar,now()+4h)
//Create training range and distance you want to project signal into the future -- 4h in this example
$training = group($trainingCapsule)
//Convert capsule into a group for use in regression tool
$timeSince = timeSince(condition(30d,$trainingCapsule),1min)
//Create a signal which is a time counter since the start of your mode of interest -- 1min is sampling rate of new signal
$model = $signal.regressionModelOLS($training,false,$timeSince).predict($timeSince)
//Train model and project it into the future 

$signal.forecastSplice($model)
//splice model into the orignal signal

image.png

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...