1

I need to find recursive pattern on binary time series (on 3 channels). TS sample data:

channel1_data = [0, 1, 1, 0, 0, 1, 0, 1, 0, 0]
channel2_data = [0, 0, 0, 1, 1, 0, 1, 0, 1, 0] 
channel3_data = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1]

pattern I want to discover:

channel1_t = [0, 1] 
channel2_t = [0, 0] 
channel3_t = [1, 0]

enter image description here

I've tried sktime library,with Rocket transformer and Ridge classifier without success:

from sktime.transformations.panel.rocket import Rocket
from sklearn.pipeline import make_pipeline
from sklearn.linear_model import RidgeClassifierCV
import numpy as np
import pandas as pd

# Create sample data
channel1_data = [0, 1, 1, 0, 0, 1, 0, 1, 0, 0]
channel2_data = [0, 0, 0, 1, 1, 0, 1, 0, 1, 0] 
channel3_data = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1]
channel1_t = [0, 1] 
channel2_t = [0, 0] 
channel3_t = [1, 0]

X = pd.DataFrame({
    'channel1': [pd.Series(channel1_data)],
    'channel2': [pd.Series(channel2_data)],
    'channel3': [pd.Series(channel3_data)]
})

y = pd.DataFrame({
    'channel1': [pd.Series(channel1_t)],
    'channel2': [pd.Series(channel2_t)],
    'channel3': [pd.Series(channel3_t)]
})
# Create pipeline with Rocket transformer and Ridge classifier
clf = make_pipeline(Rocket(), RidgeClassifierCV())
# Fit pipeline to data
clf.fit(X,y)
# Predict on new data
y_pred = clf.predict(X)
print(y_pred)

this line:

clf.fit(X,y)

is generating this error:

AttributeError: 'bool' object has no attribute 'any'

I'm even not sure my approach is correct, looking for some direction/recommendation. Thx

user3925023
  • 667
  • 6
  • 25

0 Answers0