Jump to content

Recommended Posts

  • Administrators

The following steps will create a prediction model for every capsule in a condition.

Step 1.  pick a condition with capsules that isolate the desired area of regression.  Any condition with non-overlapping capsules will work as long as there are enough sample points within its duration. For this example, an increasing temperature condition will be used.  However, periodic conditions and value search conditions will work as well.

Step 2. Create a time counter for each capsule in the condition.  This can be done with the new timesince() function in the formula tool. The timesince() function will have samples spaced depending on the selected period so it is important to select a period that has enough points to build a model with.  See below for details on the timesince() formula setup.

Capture1.PNG

Step 3. In this step a condition with capsule properties that hold the regression constants will be made.  This will be done in the formula tool with one formula.  The concept behind the formula below is to split the condition from step one into individual capsules and use each of the capsules as the training window for a regression model. Once the regression model is done for one capsule the coefficients of the model are assigned as properties to the capsule used for the training window.  

The formula syntax for a linear model-based condition can be seen below.  An example of a polynomial regression model can be found in the post below.

$Condtition.removeLongerThan(24h).transform($cap->
             {
              $model=$SignalToModel.validValues().regressionModelOLS( group($cap),false,$Time)
              $cap.setProperty('Slope',$model.get('coefficient1'))
              .setProperty('Intercept',$model.get('intercept'))})
 

Below is a screenshot of how the formula looks in Seeq.

Capture2.PNG

Note: The regression constants can be added to the capsule pane by clicking on the black stats button and selecting add column. Below is a screen shot of the results.

Capture3.PNG

Step 4. Once a condition with the regression coefficients has been created the information will need to be extracted to a signal form. The following formula syntax will extract the information. This will need to be repeated for every constant from your regression model. e.g.(So for a linear model this must be done for both the slope and for the intercept.)

The formula syntax for extracting the regression coefficients can be seen below.

$signal=$Condition.transformToSamples(
  $cap -> sample($cap.getmiddle(), 
              $cap.getProperty('Intercept').toNumber()), 1min)

$signal.aggregate(average(),$Condition,durationKey())

Below is a screenshot of the formula in Seeq.

Capture4.PNG

Below is a screenshot of the display window of how the signals should look.

Capture5.PNG

Step 5. Use the formula tool to plot the equation. See screenshot below for details.

Capture6.PNG

Final Result
Capture8.PNG

Edited by Teddy
  • Like 1
Link to post
Share on other sites
  • Administrators

Here is the syntax for a polynomial regression based condition. 

$condition.removeLongerThan(15h).transform($cap->{

        $model=$signaltomodel.regressionModelOLS(group($cap), false, $Time, $Time^2)
        $cap.setProperty('Coeff1',$model.get('coefficient1'))
              .setProperty('Coeff2',$model.get('coefficient2'))
              .setProperty('Intercept',$model.get('intercept'))})

Below is a screenshot of it setup in the formula tool. 

Capture9.PNG

The result
Capture10.PNG

  • Like 1
Link to post
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...