# Emily Johnston

Seeq Team

13

10

2. ## How do I apply Machine Learning Algorithm at Scale in Seeq?

Thanks for sharing this video, Sanman. As a follow-up, could you advise on best practices for sharing these results once they've been pushed into Seeq?
3. ## Creating Manual Limits in Seeq

Another option for manual limits, is to use the csv 2.0 functionality to import the limits into Seeq as a signal. This may be useful if you're limit values are already in a spreadsheet format. More information on csv import 2.0 can be found in this Seeq Knowledge Base Article.
4. ## Creating Manual Limits in Seeq

Often times, limits are added manually in Seeq as a simple scalar value using formula: However, it is sometimes useful to be able to add limits manually, where the limit value may change over time. This can also be done using Seeq formula. The approach is to use the sample() function to specify the timestamp and value of the limit, and then to add new samples with a timestamp of when the limit changed and the new value. These samples will be inputs to a signal that can be displayed in Seeq. Keep in mind that the maximum interpolation will need to be set to an interval large enough to interpolate between limit value changes. In the below example, this is set for 10 days: signal(InterpolationMethod.Step, 10d, sample('2020-09-23T00:00:00Z', 80), sample('2020-09-24T00:00:00Z', 90), sample('2020-09-30T00:00:00Z', 95)) In order to adjust this signal to extend the last limit value (or last sample) to the current time, we will add another sample with a timestamp at now and a value holding the previous sample value: signal(InterpolationMethod.Step, 10d, sample('2020-09-23T00:00:00Z', 80), sample('2020-09-24T00:00:00Z', 90), sample('2020-09-30T00:00:00Z', 95), sample(now(), SCALAR.INVALID)) Finally, we will resample the signal in order to reduce the maximum interpolation of the result. This step can help improve the performance of this signal if it is used in further calculations, particularly if it will be spliced with another signal. signal(InterpolationMethod.Step, 10d, sample('2020-09-23T00:00:00Z', 80), sample('2020-09-24T00:00:00Z', 90), sample('2020-09-30T00:00:00Z', 95), sample(now(), SCALAR.INVALID)) .resample(1d) Now this code can be commented to ensure ease of future manual updates. These are done by simply adding a new sample with the timestamp and value of the limit change. signal(InterpolationMethod.Step, 10d, sample('2020-09-23T00:00:00Z', 80), sample('2020-09-24T00:00:00Z', 90), sample('2020-09-30T00:00:00Z', 95), //Insert next limit value as a new sample above this line //Code below extends last limit value to current time and resamples result to improve performance sample(now(), SCALAR.INVALID)) .resample(1d) The result is a limit signal created and updated manually in Seeq!
5. ## Push Scorecard from Seeq Data Lab

The SPy Documentation for spy.assets includes an example of specifying metrics as attributes in asset classes. It is also possible to push scorecard metrics using the spy.push functionality by defining the appropriate metadata. An example of this process is given in the code snippets below: #import relevant libraries import pandas as pd from seeq import spy Log in to the SPY module if running locally using spy.login, or skip this step if running Seeq Data Lab. #Search for data that will be used to create the scorecard. This example will search the Example asset tree to find tags in Area A. search_result = spy.search({'Path': 'Example >> Cooling Tower 1 >> Area A'}) The next code segment creates and pushes a signal that will be used as a threshold limit in the scorecard metric. This can be skipped if threshold signals will not be used in the final metric. #Define data frame for low limit threshold signal. my_lo_signal = { 'Type': 'Signal', 'Name': 'Lo Signal', 'Formula': '\$signal * 50', 'Formula Parameters': {'\$signal': search_result[search_result['Name'] == 'Optimizer']['ID'].iloc[0]} } #Push data frame for low limit threshold signal. lo_push_result = spy.push(metadata=pd.DataFrame([my_lo_signal]), workbook='Example Scorecard') Finally, create the and push the scorecard metric. This example metric measures the average temperature and apply a static high limit threshold of 90 and a moving low limit threshold using the signal defined above. #Define data frame for scorecard metric. my_metric_input = { 'Type': 'Metric', 'Name': 'My Metric', 'Measured Item': {'ID': search_result[search_result['Name'] == 'Temperature']['ID'].iloc[0]}, 'Statistic': 'Average', 'Thresholds': { 'Lo': {'ID': lo_push_result['ID'].iloc[0]}, 'Hi': 90 } } #Push data frame for scorecard metric. spy.push(metadata = pd.DataFrame([my_metric_input]), workbook='Example Scorecard') The final result can be seen in the created workbook.
6. ## Jupyter Docstring Shortcut

Sometimes users want to find more documentation on the SPy functions than what is provided in the SPy Documentation Notebooks. A quick way to access SPy object documentation from your notebook is by using the Shift + Tab shortcut to access the docstring documentation of the function. Example view of the docstrings after using the Shift + Tab shortcut: You can expand the docstrings to view more details by clicking the + button circled in red in the above image. Expanded docstrings: From here, you can scroll through the documentation in the pop-up window. Another useful shortcut is the Tab shortcut. This will show a list of available functions or methods for either the SPy module or any other python object you have in memory. Example view of the Tab shortcut:
7. ## Last Three Signal Values

A customer asked if there was a way to create a scorecard that outputs the 3 most recent samples within a signal. This can be done in Seeq by executing the following steps: 1) Transform the desired signal to discrete samples in order to remove any interpolation. \$signal.toDiscrete() 2) Create a condition with tiny capsules for each of the samples in the signal. \$signal.toCapsules() 3) Create a condition for the Last 3 Capsules using formula. First, define the search window that is looking back from "now" for long enough to capture the last three samples. Then use this search window when selecting the desired tiny capsules that represent the most recent three samples. //Create a capsule from 1 day before now, to now. The last three capsules should occur within this window. \$searchWindow = capsule(now()-1day, now()) //Create a condition consisting of the last 3 capsules of the Condition condition(1d, toGroup(\$searchWindow).last(), toGroup(\$searchWindow).pick(-2), toGroup(\$searchWindow).pick(-3)))) 4) Create a scorecard for the discrete values of the last 3 capsules condition. 5) Move the scorecard to an Organizer Topic and configure a custom date range that will auto-update. This way the scorecard will continue to update at the topic level.
8. ## Align Capsules - start time

Hello Robin, You can use the grouping functionality in the Capsule View to achieve this functionality. Below is an example of overlapping capsules that were created based on different input signals. When I view this display in the capsule time, I see both signals represented for both capsules. So I see 2 overlapping versions of each signal, as shown below. Instead, I want to see the Area A_Temperature signal only for the Signal A Hot condition, and I want to see the Area B_Temperature signal only for the Signal B Hot condition. To achieve this, I will click the "Group" button from the options at the top of my display, then assign the desired signals to the associated conditions. The clicks required for this are highlighted in the image below. Once I have assigned the grouping for both of my conditions, the result will show only the desired signals for each capsule that is compared in capsule view.
9. ## Calculated Batch Limit applied as a Scalar

Background: I want to calculate a limit for my process based on the average of my historical batches. I have calculated the average of each batch using signal from condition, but now I want to take the average of my last several historical batch averages and apply the result to future batches as a scalar in Seeq. Solution: 1) Start with the averages calculated for each campaign: 2) Add a custom condition for the historical range that you want to use for your calculation: 3) Using signal from condition, calculate the average of the averages over that historical range: 4) Convert the resulting value to a scalar in formula: Formula is - \$avg.toScalars(capsule('2019')).last() Where \$avg is your average of averages, and the Capsule(‘2019’) just needs to contain the year where that sample is placed. My signal from condition for Average of Averages placed the sample at the start of my historical range condition, so in this formula, I put the year in which my historical range capsule started, 2019. 5) Resulting view of the data outside of the historical range:
10. ## Scorecard to Represent Date Range in Organizer Topic

Sometimes it is helpful to show the date range of the Seeq content used in an Organizer Topic that is shown in the topic itself. One way to do this and reduce manual updates to the topic is to leverage a scorecard to achieve an auto-updating date range. The the below steps detail how to create a date range scorecard metric: 1) Create a string signal with descriptive text using formula. The string will be displayed in the scorecard. "Current Date Range".toSignal() 2) Create a simple scorecard metric that measures the string signal created in step 1. The result is a scorecard metric showing the date range in the header and the descriptive text in the cell. 3) Remove the column with the scorecard metric name by selecting the green "x" at the top of the metric. 4) Insert the scorecard into the Organizer Topic and apply the desired date range. The scorecard will reflect the date range configured and applied from the Topic.
11. ## Start and End values of a signal

Hello, You can use the pick() function to find the value at or just before now. The below formula will pick the last sample value of a signal that exists within a capsule created from 1 day before now, to now. The result is a scalar showing the value at now. \$signal.toScalars(capsule(now() - 1d, now())).pick(-1) To select the sample value just before now, change the pick() function in the formula. \$signal.toScalars(capsule(now() - 1d, now())).pick(-2) The scalar value given as the result of this formula will continue to update as new data comes in and updates the current value. Regards, Emily
12. ## Asset Swapping and Treeemap

Hello Ruben, The Asset Tree looks for the lowest-level "child" asset to do the swap. In your case, I would suggest updating your asset tree to combine the 2 child asset groups into a single group. That way you are swapping all of the inputs from child asset "x" to child asset "y", "z", etc. Asset Trees can be created in Seeq using the Tree File Connector. You can find more information about this in the Seeq Knowledge Base. Regarding your second question, the tree file connector will only display a box for assets where it finds an item that works for the swap. So if you have an asset without the desired item, that asset will not be included in the tree. Thanks, Emily
×
×
• Create New...