Contrary to the offline version, online Bayesian change point detection does not rely on decomposition techniques. It emphasizes causal predictive filtering, a method that generates an accurate distribution of the upcoming, unseen data point in the sequence using only the information from previously observed data.
import hana_ml
from hana_ml import dataframe
cc = dataframe.ConnectionContext(address='', port=30x15, user='', password='')#account details omitted

The simulated dataset consists of two segments: the first segment has a length of 40, and the second spans 60 units. These segments are separated by a red vertical line in the graph. The data is stored in two separate database tables named 'PAL_ONLINE_BCPD_MOCK_TBL_PART1' and 'PAL_ONLINE_BCPD_MOCK_TBL_PART2'. To create corresponding hana_ml.DataFrame objects for these tables, we can utilize the table() function of the ConnectionContext.
mocking_df_part1 = cc.table('PAL_ONLINE_BCPD_MOCK_TBL_PART1')
mocking_df_part2 = cc.table('PAL_ONLINE_BCPD_MOCK_TBL_PART2')from hana_ml.algorithms.pal.tsa.changepoint import OnlineBCPD
obcpd_with_prune = OnlineBCPD(threshold=0.5, prune=True)
obcpd_without_prune = OnlineBCPD(threshold=0.5, prune=False)model_with_prune, cp_part1_with_prune = obcpd_with_prune.fit_predict(data=conn.table("PAL_ONLINE_BCPD_MOCK_TBL_PART1"), model=None)
model_without_prune, cp_part1_without_prune = obcpd_without_prune.fit_predict(data=conn.table("PAL_ONLINE_BCPD_MOCK_TBL_PART1"), model=None)print("The length of the model with prune is {}\nand the legnth of model without prune is {}".format(len(model_with_prune.collect()), len(model_without_prune.collect())))
print(cp_part1_with_prune.collect())
print(cp_part1_without_prune.collect())
model_with_prune, cp_part2 = obcpd_with_prune.fit_predict(data=conn.table("PAL_ONLINE_BCPD_MOCK_TBL_PART2"), model=model_with_prune)
print(cp_part2.collect())


def createTableFromDataFrame(df, table_name, cc):
dropTable(table_name, cc)
dt_ml = dataframe.create_dataframe_from_pandas(cc, df, table_name = table_name)
return dt_ml
obcpd = OnlineBCPD(threshold=0.5, prune=True)
figure(num=None, figsize=(16, 4), dpi=80, facecolor='w', edgecolor='k')
plt.plot(data)
for i in range(15):
createTableFromDataFrame(df_sensor[i * 100 : (i + 1) * 100], "PAL_ONLINE_BCPD_SENSOR_DATA_TBL", conn)
model_with_prune, cp = obcpd_with_prune.fit_predict(data=conn.table("PAL_ONLINE_BCPD_SENSOR_DATA_TBL"))
for pos in cp.collect()["POSITION"]:
plt.axvline(x=pos, color='orange', linestyle='dashed')
Weibull Analysis using Python machine learning client for SAP HANA
Outlier Detection using Statistical Tests in Python Machine Learning Client for SAP HANA
Outlier Detection by Clustering using Python Machine Learning Client for SAP HANA
Outlier Detection with One-class Classification using Python Machine Learning Client for SAP HANA
Additive Model Time-series Analysis using Python Machine Learning Client for SAP HANA
COPD study, explanation and interpretability with Python machine learning client for SAP HANA
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 26 | |
| 19 | |
| 19 | |
| 15 | |
| 13 | |
| 11 | |
| 10 | |
| 9 | |
| 6 | |
| 4 |