The issue I was facing that I trained timeseries model and did the validation test as well.
The third step was to test a model my testing script looked like this
tes_df was dataframe to be tested
X2, y2 = df2xy(tes_df, target_col='target')
X2=X2.reshape(-1,2,35)
splits2 = get_splits(y2, train_only=True ,shuffle = False, stratify=False)
tfms2 = [None, [Categorize()]]
dsets2 = TSDatasets(X2, y2, tfms=tfms2,splits=splits2,)
dls2 = TSDataLoaders.from_dsets(dsets2, shuffle=False,bs=bs_, shuffle_train=False, drop_last = False)
test_probas, test_targets, test_preds = learn.get_preds(dl=dls2.train,with_decoded=True, reorder=False)
print("\n\n#######################################################\n\n ")
print("Tests",test_probas,test_targets, test_preds)
print("\n\n#######################################################\n\n ")
test_targets[test_targets == test_preds]
print("\n\n#######################################################\n\n ")
print("Patient ", " Test Results :" ,(test_targets == test_preds).float().mean())
print("\n\n#######################################################\n\n ")
I was facing above mentioned error on excution of learn.get_preds
I changed my script to following and resolve that issue
df is data frame
df=R1[4]
X2, y2 = df2xy(df, target_col='target')
test_eq(X2.shape, (df.shape[0], 1, df.shape[1]-1))
test_eq(y2.shape, (df.shape[0], ))
X2=X2.reshape(-1,2,35)
balance_=False
splits2 = get_splits(y2,balance=balance_,valid_size=0.2,test_size=0.0,shuffle = False)
df=df.sample(frac=1).reset_index(drop=True)
bs=128
tfms2 = [None, [Categorize()]]
dsets2 = TSDatasets(X2, y2, tfms=tfms2,splits=splits2)
dls2 = TSDataLoaders.from_dsets(dsets2.train,dsets2.valid, train_shuffle=False,bs=[bs, bs*2])
learn.get_preds(dl=dls2.valid) ```
Following were my error debugging techniques
make sure your following are equal
for i in dls.train:
print(i)
for i in dls2.train:
print(i)