Jump to content
  • To Search the Seeq Knowledgebase:

    button_seeq-knowledgebase.png.ec0acc75c6f5b14c9e2e09a6e4fc8d12.png.4643472239090d47c54cbcd358bd485f.png

Search the Community

Showing results for tags 'regression'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Community Technical Forums
    • Tips & Tricks
    • General Seeq Discussions
    • Seeq Data Lab
    • Seeq Developer Club
    • Seeq Admin Forum
    • Feature Requests

Categories

  • Seeq FAQs
  • Online Manual
    • General Information

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Company


Title


Level of Seeq User

Found 5 results

  1. Capsule Based Back Prediction or Back-Casting Scenario: Instead of forecasting data into the future, there may be a need to extrapolate a signal back in time based on data from an event or period of interest. The following steps will allow you to backcast a target signal from every capsule within a condition. Data Target Signal – a signal that you would like to backcast. Event – a condition that encapsulates the event or period of interest from which you would like to backcast the target signal. The target signal must have sufficient sample points within each capsule to create an accurate regression model. Method Step 1. Create a new extended event that will combine the capsules from the original event with a prediction window for backcasting. In this example, the prediction window is 1 hr and a maximum capsule duration of 40h is defined. $prediction_window = $event.beforeStart(1h) $prediction_window.join($event, 40h) Step 2. Create a new time since signal that quantifies the time since the beginning of each capsule in the extended event condition. This new signal will be the independent variable in the regression model. $extended_event.timeSince(1min) Replace 1min with a sample frequency sufficient for your use case. Step 3. In formula, use the example below to create a regression model for the target signal, with data from the event as training data, and the time since signal as an independent variable. Assign the regression model coefficients as capsule properties for a new condition called regression condition. $event.transform($cap-> {$model=$target_signal.validValues().regressionModelOLS( group($cap),false,$time_since,$time_since^2) $cap .setProperty('m1',$model.get('coefficient1')) .setProperty('m2',$model.get('coefficient2')) .setProperty('c',$model.get('intercept'))}) The formula above creates a second-order polynomial ordinary least squares regression model. The order of the polynomial can be modified (from linear up to 9th) by adding sequential 'timesince^n' statements on line 2 and defining all coefficients as is on lines 4 and 5. See the example below of how to adjust the formula for a third-order polynomial model. Step 4. Using the regression model coefficients from the regression condition, and the time since signal, the target signal can then be backcast over the prediction window. $c = $regression_condition.toSignal('c',durationKey()).aggregate(average(),$extended_event,durationKey()) $m1 = $regression_condition.toSignal('m1',durationKey()).aggregate(average(),$extended_event,durationKey()) $m2 = $regression_condition.toSignal('m2',durationKey()).aggregate(average(),$extended_event,durationKey()) return $m1*$time_since+$m2*$time_since^2 + $c The example above is for a second-order polynomial and the formula needs to be modified depending on the order of the polynomial defined in Step 3. See the example below for a linear model. Note that it may be required to manually set the units (using setunits() function) of each part of the polynomial equation. Result The result is a new signal which backcasts the target signal for the duration of the prediction window prior to the event or period of interest.
  2. 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. 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. 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. 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. Below is a screenshot of the display window of how the signals should look. Step 5. Use the formula tool to plot the equation. See screenshot below for details. Final Result
  3. Another common question through the support portal this morning that is of general interest To help with this example I am going to create a quick polynomial prediction using Data from Area C in the example set. Our target is going to be to try to predict compressor power as a function of all of the input weather signals If you wanted to re-create this prediction model in excel or another tool you need the coefficients from block #1 in the screenshot above and the y-intercept from block #2 in the screenshot. Inside of the workbench tool you will see rounded values for each of the coefficients and intercepts but the full values are available when you copy them to the clipboard by clicking the little button highlighted in red. To fill out the example in excel the formula will look like the following $temperature^2 * -0.000230 + $temperature * 0.0607 + $WB^2 * 0.000646 + $WB * -0.101 + 6.5946 A final point to mention here is that for multi-variable regressions with many input signals it is important to take a minute and evaluate the p-values listed in the coefficient table. If the p-values for any coefficient are above 0.05 it is best practices to rethink if that signal needs to be included in the model at all or if you may need to perform data data cleansing or re-alignment to create a better performing model. Good blog post on P-values - https://medium.com/analytics-vidhya/understanding-the-p-value-in-regression-1fc2cd2568af Great reference post on how to optimize regression models using time shifting -
  4. Scenario: I have created a regression or prediction model for my process but i want to apply that same regression model to another set of signals or a different period of time. This could be helpful for comparing how one piece of equipment is operating when compared against a regression built for another system. It could be used to predict how a system will behave based on how some other similar system behaved. It could be used predict how a system will behave before you have enough information to build that system or run its own model, or any number of applications where we might want to apply a regression or prediction model built on one set of signals to another set of signals. Solution: First off, we have to build a prediction model! In this case i have modeled a Filtration system, predicting filter head loss. I took into account the time the filter has been in service, the raw water turbidity, and the Filter turbidity. Next, if i click on the information icon for my prediction signal, i am able to see the formula that was used to create this prediction. We will need to copy this formula: Next, I need to identify my new signals. In my case, i am going to apply this prediction model to Filter 12. Once i have all of my signals that will be sued to the prediction i can paste my formula into a new formula and make sure all my variables line up (or, alternately and a bit easier, just use the duplicate to formula function from the information screen shown above by clicking on the down arrow next to the duplicate button). Finally, I need to update the PREDICT section of my formula denoted by the .predict() function with the signals i will apply my prediction model to. I can do this by using the search button in the formula tool to add my new signals, and then update the .predict() section of my formula with my new variables, make sure to put them in correctly and in the right order otherwise your model will be off! Finally, i can use my prediction model that i built for Filter 1 on Filter 12 and derive further insight, in this case i might question whether my systems are truly as similar as i think they are or whether there is something causing my model to deviate from what was expected for filter 12. In my case, both prediction models are in red:
  5. Hi! I have two sets of data in Seeq, namely the flow through an unit with several pieces of equipment and the total pressure drop. The trend is clear visible in a X-Y scatter plot (although a certain dispersion is present) and now I would like to make a regression (2nd order polynomial) and get the equation coefficients (y=a+b*X+c*X^2). I used to the same with the trendline function of Excel. I tried to use the Prediction tool, but the coefficients returned by Seeq seem not to fit the data. Moreover, i don't see the regressed function plotted on the X-Y scatter plot. Anyone can tell me if it possible and, if so, how can I get it? Thanks in advance for any help. Regards, Giovanni
×
×
  • Create New...