The time series database TDengine is integrated with the advanced analysis software Seeq. Let’s take a look at the operation manual.

As an advanced analytics software for manufacturing and the Industrial Internet of Things (IIOT), Seeq enables innovative new capabilities using machine learning in process manufacturing organizations. These capabilities enable organizations to deploy their own or third-party machine learning algorithms to advanced analytics applications used by frontline process engineers and subject matter experts, allowing the efforts of a single data scientist to scale to many frontline employees. Through the TDengine Java connector, Seeq can easily support querying time series data provided by TDengine , and provide functions such as data presentation, analysis, and prediction. This article will introduce this.  

How to configure Seeq to access TDengine

  • View data storage location
sudo seeq config get Folders/Data
sudo seeq restart
  • Enter License

Use a browser to access ip:34216 and enter the license according to the instructions.

Use Seeq to analyze TDengine time series data

The following will demonstrate how to use Seeq software with TDengine to perform time series data analysis.

Scene introduction

The example scenario is a power system where users collect power consumption data from power station meters every day and store it in the TDengine cluster. Now users want to predict how power consumption will evolve and buy more devices to support it. User power consumption varies with monthly order changes, and taking into account seasonal changes, power consumption will vary. The city is in the northern hemisphere, so it uses more electricity in the summer. We simulate the data to reflect these assumptions.

Data Schema

CREATE STABLE meters (ts TIMESTAMP, num INT, temperature FLOAT, goods INT) TAGS (device NCHAR(20));
create table goods (ts1 timestamp, ts2 timestamp, goods float);

Time series database TDengine + advanced analysis software Seeq, helping enterprises tap the potential of time series data - TDengine Database time series database

Construct data method

python mockdata.py
taos -s "insert into power.goods select _wstart, _wstart + 10d, avg(goods) from power.meters interval(10d);"

The source code is hosted at https://github.com/sangshuduo/td-forecasting . 

Data analysis using Seeq

Configure data source (Data Source)

Log in with an account with the Seeq administrator role and create a new data source.

  • Power
{
    "QueryDefinitions": [
        {
            "Name": "PowerNum",
            "Type": "SIGNAL",
            "Sql": "SELECT  ts, num FROM meters",
            "Enabled": true,
            "TestMode": false,
            "TestQueriesDuringSync": true,
            "InProgressCapsulesEnabled": false,
            "Variables": null,
            "Properties": [
                {
                    "Name": "Name",
                    "Value": "Num",
                    "Sql": null,
                    "Uom": "string"
                },
                {
                    "Name": "Interpolation Method",
                    "Value": "linear",
                    "Sql": null,
                    "Uom": "string"
                },
                {
                    "Name": "Maximum Interpolation",
                    "Value": "2day",
                    "Sql": null,
                    "Uom": "string"
                }
            ],
            "CapsuleProperties": null
        }
    ],
    "Type": "GENERIC",
    "Hostname": null,
    "Port": 0,
    "DatabaseName": null,
    "Username": "root",
    "Password": "taosdata",
    "InitialSql": null,
    "TimeZone": null,
    "PrintRows": false,
    "UseWindowsAuth": false,
    "SqlFetchBatchSize": 100000,
    "UseSSL": false,
    "JdbcProperties": null,
    "GenericDatabaseConfig": {
        "DatabaseJdbcUrl": "jdbc:TAOS-RS://127.0.0.1:6041/power?user=root&password=taosdata",
        "SqlDriverClassName": "com.taosdata.jdbc.rs.RestfulDriver",
        "ResolutionInNanoseconds": 1000,
        "ZonedColumnTypes": []
    }
}
  • Goods
{
    "QueryDefinitions": [
        {
            "Name": "PowerGoods",
            "Type": "CONDITION",
            "Sql": "SELECT ts1, ts2, goods FROM power.goods",
            "Enabled": true,
            "TestMode": false,
            "TestQueriesDuringSync": true,
            "InProgressCapsulesEnabled": false,
            "Variables": null,
            "Properties": [
                {
                    "Name": "Name",
                    "Value": "Goods",
                    "Sql": null,
                    "Uom": "string"
                },
                {
                    "Name": "Maximum Duration",
                    "Value": "10days",
                    "Sql": null,
                    "Uom": "string"
                }
            ],
            "CapsuleProperties": [
                {
                    "Name": "goods",
                    "Value": "${columnResult}",
                    "Column": "goods",
                    "Uom": "string"
                }
            ]
        }
    ],
    "Type": "GENERIC",
    "Hostname": null,
    "Port": 0,
    "DatabaseName": null,
    "Username": "root",
    "Password": "taosdata",
    "InitialSql": null,
    "TimeZone": null,
    "PrintRows": false,
    "UseWindowsAuth": false,
    "SqlFetchBatchSize": 100000,
    "UseSSL": false,
    "JdbcProperties": null,
    "GenericDatabaseConfig": {
        "DatabaseJdbcUrl": "jdbc:TAOS-RS://127.0.0.1:6041/power?user=root&password=taosdata",
        "SqlDriverClassName": "com.taosdata.jdbc.rs.RestfulDriver",
        "ResolutionInNanoseconds": 1000,
        "ZonedColumnTypes": []
    }
}
  • Temperature
{
    "QueryDefinitions": [
        {
            "Name": "PowerNum",
            "Type": "SIGNAL",
            "Sql": "SELECT  ts, temperature FROM meters",
            "Enabled": true,
            "TestMode": false,
            "TestQueriesDuringSync": true,
            "InProgressCapsulesEnabled": false,
            "Variables": null,
            "Properties": [
                {
                    "Name": "Name",
                    "Value": "Temperature",
                    "Sql": null,
                    "Uom": "string"
                },
                {
                    "Name": "Interpolation Method",
                    "Value": "linear",
                    "Sql": null,
                    "Uom": "string"
                },
                {
                    "Name": "Maximum Interpolation",
                    "Value": "2day",
                    "Sql": null,
                    "Uom": "string"
                }
            ],
            "CapsuleProperties": null
        }
    ],
    "Type": "GENERIC",
    "Hostname": null,
    "Port": 0,
    "DatabaseName": null,
    "Username": "root",
    "Password": "taosdata",
    "InitialSql": null,
    "TimeZone": null,
    "PrintRows": false,
    "UseWindowsAuth": false,
    "SqlFetchBatchSize": 100000,
    "UseSSL": false,
    "JdbcProperties": null,
    "GenericDatabaseConfig": {
        "DatabaseJdbcUrl": "jdbc:TAOS-RS://127.0.0.1:6041/power?user=root&password=taosdata",
        "SqlDriverClassName": "com.taosdata.jdbc.rs.RestfulDriver",
        "ResolutionInNanoseconds": 1000,
        "ZonedColumnTypes": []
    }
}

Using Seeq Workbench

Log in to the Seeq service page and create a new Seeq Workbench. By selecting the data source search results and selecting different tools as needed, you can perform data presentation or prediction. For detailed usage, please refer to the official knowledge base: https://support.seeq.com/space/ KB/146440193/Seeq+Workbench .

Time series database TDengine + advanced analysis software Seeq, helping enterprises tap the potential of time series data - TDengine Database time series database

Use Seeq Data Lab Server for further data analysis

Log in to the Seeq service page and create a new Seeq Data Lab. You can further use Python programming or other machine learning tools to perform more complex data mining functions.

from seeq import spy
spy.options.compatibility = 189
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import mlforecast
import lightgbm as lgb
from mlforecast.target_transforms import Differences
from sklearn.linear_model import LinearRegression

ds = spy.search({'ID': "8C91A9C7-B6C2-4E18-AAAF-XXXXXXXXX"})
print(ds)

sig = ds.loc[ds['Name'].isin(['Num'])]
print(sig)

data = spy.pull(sig, start='2015-01-01', end='2022-12-31', grid=None)
print("data.info()")
data.info()
print(data)
#data.plot()

print("data[Num].info()")
data['Num'].info()
da = data['Num'].index.tolist()
#print(da)

li = data['Num'].tolist()
#print(li)

data2 = pd.DataFrame()
data2['ds'] = da
print('1st data2 ds info()')
data2['ds'].info()

#data2['ds'] = pd.to_datetime(data2['ds']).to_timestamp()
data2['ds'] = pd.to_datetime(data2['ds']).astype('int64')
data2['y'] = li
print('2nd data2 ds info()')
data2['ds'].info()
print(data2)

data2.insert(0, column = "unique_id", value="unique_id")

print("Forecasting ...")

forecast = mlforecast.MLForecast(
    models = lgb.LGBMRegressor(),
    freq = 1,
    lags=[365],
    target_transforms=[Differences([365])],
)

forecast.fit(data2)
predicts = forecast.predict(365)

pd.concat([data2, predicts]).set_index("ds").plot(title = "current data with forecast")
plt.show()

The output of running the program is:

Time series database TDengine + advanced analysis software Seeq, helping enterprises tap the potential of time series data - TDengine Database time series database

write at the end

By integrating Seeq and TDengine, users can make full use of TDengine's high-performance time series data storage and retrieval to ensure efficient data processing; they will also benefit from the powerful data visualization and analysis functions provided by Seeq, such as data visualization, anomaly detection, correlation Sexual analysis and predictive modeling allow users to obtain valuable data insights and make decisions based on this.

In the future, Seeq and TDengine will jointly provide comprehensive solutions for time series data analysis in various industries such as manufacturing, industrial Internet of Things, and power systems. They will combine efficient data storage and advanced data analysis to give enterprises the ability to deeply tap the potential of time series data. Drive business development and improvement. If you want to know more about Seeq's more comprehensive settings and the specific connection details between Seeq and the fully managed cloud service platform TDengine Cloud, please go to the official document https://docs.taosdata.com/third-party/seeq/ to check it out.  

Microsoft launches new "Windows App" .NET 8 officially GA, the latest LTS version Xiaomi officially announced that Xiaomi Vela is fully open source, and the underlying kernel is NuttX Alibaba Cloud 11.12 The cause of the failure is exposed: Access Key Service (Access Key) exception Vite 5 officially released GitHub report : TypeScript replaces Java and becomes the third most popular language Offering a reward of hundreds of thousands of dollars to rewrite Prettier in Rust Asking the open source author "Is the project still alive?" Very rude and disrespectful Bytedance: Using AI to automatically tune Linux kernel parameter operators Magic operation: disconnect the network in the background, deactivate the broadband account, and force the user to change the optical modem
{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/u/4248671/blog/10142928