Random SAST (RSAST) is a method based on STC and SAST, that generates shapelets randomly, guided by statistical criteria, reducing the search space of shapelets.
![]() |
![]() |
|---|
![]() |
![]() |
![]() |
|---|
In order to explore another alternatives for the default length method of the shapelets (ACF&PACF) some supplementary length methods are examined: Max PACF and None.
-
The default behaviour implies chose all significant values from ACF and PACF tests.

-
Max ACF, makes reference to the generation of subsequences considering solely the highest significant value from the Partial Autocorrelation Function (PACF).

-
"None" variation, involves generating subsequences with a single random length chosen from the range between 3 and the size of the time series for each randomly selected instance.

import os, numpy as np
from utils_sast import load_dataset, format_dataset
from sast import RSAST
from sklearn.linear_model import RidgeClassifierCV
ds='Coffee' # Chosing a dataset
path=os.getcwd()+"/data"
ds_train , ds_test = load_dataset(ds_folder=path,ds_name=ds,shuffle=False)
X_test, y_test = format_dataset(ds_test)
X_train, y_train = format_dataset(ds_train)
clf = RidgeClassifierCV(alphas=np.logspace(-3, 3, 10))
rsast_ridge = RSAST(n_random_points=10, nb_inst_per_class=10, len_method="both", classifier=clf)
rsast_ridge.fit(X_train, y_train)
print('rsast score :', rsast_ridge.score(X_test, y_test))









