Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
41417df
Merge pull request #2 from DSIP-FBK/v1.1.3
agobbifbk Feb 11, 2025
60e44aa
ag create main
agobbifbk Feb 11, 2025
9477c95
warning fixing
agobbifbk Feb 11, 2025
2451452
warning fixing
agobbifbk Feb 11, 2025
b559dba
starting working on layers
agobbifbk Feb 12, 2025
eb55142
update notebook
agobbifbk Feb 13, 2025
fcbaa2f
update TEST notebook
agobbifbk Feb 13, 2025
f7fda64
added version of the test notebook 2
agobbifbk Feb 18, 2025
5fdd0de
added version of the test notebook 2
agobbifbk Feb 18, 2025
e9f8c4d
experiments with d1 and d2
xandie985 Feb 21, 2025
233ff88
updated temp edits
xandie985 Feb 24, 2025
22ed5c2
proposed code with zarr integration
sxandie-fbk Feb 24, 2025
3eb8067
ag update
agobbifbk Feb 24, 2025
237c7db
ag update
agobbifbk Feb 24, 2025
810ec7d
ag update
agobbifbk Feb 24, 2025
92f627b
Merge branch 'main' into experiments_d1d2
sxandie-fbk Mar 2, 2025
1a48b0c
updated code in separate folder
sxandie-fbk Mar 14, 2025
48ae5de
updates: D2 layer consolidation | precompute & weight handling | cach…
sxandie-fbk Mar 24, 2025
f18af6e
fixed some errors
sxandie-fbk Mar 24, 2025
a40e814
datasorting - max caching groups - total classes info in D2 metadata
sxandie-fbk Apr 7, 2025
9bc44ec
removed unecessary caching | consistent sorting while loading | time …
sxandie-fbk Apr 14, 2025
94d3d11
added unit test cases - fixed needed
sxandie-fbk Apr 14, 2025
def84c7
added precompute in the D2 layer to handle on demand and precompute d…
sxandie-fbk Apr 22, 2025
7fdf5cb
code for testing d1d2 layer functionality with modelling
sxandie-fbk Apr 22, 2025
48cfdf6
updated code for data loading from Monash using dsipts.data_managemen…
sxandie-fbk Apr 28, 2025
1358256
Added readme for test cases and reorganised d1d2_model_integration t…
sxandie-fbk Apr 29, 2025
f805ad0
Refactored metadata handling, improved split logic, and fixed batch s…
sxandie-fbk May 8, 2025
4d54e28
merged model_integration_test_with_d1d2
agobbifbk May 21, 2025
a54c7b1
setting up D1 layer
sxandie-fbk May 30, 2025
949b24e
setting up D2 layer
sxandie-fbk May 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@


# DSIPTS: unified library for timeseries modelling
> [!CAUTION]
> THIS IS THE OFFICIAL FORK OF THE ORIGINAL LIBRARY. IT MAY CONTAIN A LOT OF NOT WORKING LINKS, REFERENCES. PLEASE USE THE ORIGINAL ONE UNTIL WE FINISH THE UPDATES. IT MAY REQUIRE SOME TIME


This library allows to:

Expand Down
26 changes: 18 additions & 8 deletions dsipts/data_structure/data_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ def create_data_loader(self,data:pd.DataFrame,
shift:int=0,
keep_entire_seq_while_shifting:bool=False,
starting_point:Union[None,dict]=None,
skip_step:int=1
skip_step:int=1,
is_inference:bool=False

)->MyDataset:
""" Create the dataset for the training/inference step
Expand Down Expand Up @@ -448,7 +449,10 @@ def create_data_loader(self,data:pd.DataFrame,
xx = x_num_future[i-shift+skip_stacked:i+future_steps-shift+skip_stacked].mean()
else:
xx = 0.0
if np.isfinite(x_num_past[i-past_steps:i].min() + y_target[i+skip_stacked:i+future_steps+skip_stacked].min() + xx):
if is_inference is False:
xx+=y_target[i+skip_stacked:i+future_steps+skip_stacked].min()

if np.isfinite(x_num_past[i-past_steps:i].min() + xx):

x_num_past_samples.append(x_num_past[i-past_steps:i])
if len(self.future_variables)>0:
Expand All @@ -473,6 +477,7 @@ def create_data_loader(self,data:pd.DataFrame,
x_num_future_samples = np.stack(x_num_future_samples)
except Exception as e:
beauty_string('WARNING x_num_future_samples is empty and it should not','info',True)

y_samples = np.stack(y_samples)
t_samples = np.stack(t_samples)
g_samples = np.stack(g_samples)
Expand Down Expand Up @@ -944,7 +949,8 @@ def inference(self,batch_size:int=100,
rescaling:bool=True,
data:pd.DataFrame=None,
steps_in_future:int=0,
check_holes_and_duplicates:bool=True)->pd.DataFrame:
check_holes_and_duplicates:bool=True,
is_inference:bool=False)->pd.DataFrame: ##TODO PUSH THIS ON PTF!

"""similar to `inference_on_set`
only change is split_params that must contain this keys but using the default can be sufficient:
Expand All @@ -967,15 +973,16 @@ def inference(self,batch_size:int=100,
pd.DataFrame: predicted values
"""
beauty_string('Inference on a custom dataset','block',self.verbose)

self.check_custom = True ##this is a check for the dataset loading
## enlarge the dataset in order to have all the rows needed
if check_holes_and_duplicates:
if self.group is None:
freq = pd.to_timedelta(np.diff(data.time).min())
##freq = pd.to_timedelta(np.diff(data.time).min())
freq = self.freq #TODO port it into PTF
beauty_string(f'Detected minumum frequency: {freq}','section',self.verbose)
## TODO work on this for consistency
empty = pd.DataFrame({'time':pd.date_range(data.time.min(),data.time.max()+freq*(steps_in_future+self.split_params['past_steps']+self.split_params['future_steps']),freq=freq)})

else:
freq = pd.to_timedelta(np.diff(data[data[self.group==data[self.group].unique()[0]]].time).min())
beauty_string(f'Detected minumum frequency: {freq} supposing constant frequence inside the groups','section',self.verbose)
Expand All @@ -986,6 +993,9 @@ def inference(self,batch_size:int=100,
empty.append(pd.DataFrame({self.group:c,'time':pd.date_range(_min.time[_min[self.group]==c].values[0],_max.time[_max[self.group]==c].values[0]+freq*(steps_in_future+self.split_params['past_steps']+self.split_params['future_steps']),freq=freq)}))
empty = pd.concat(empty,ignore_index=True)
dataset = empty.merge(data,how='left')
#TODO port it into PTF
for c in self.cat_var:
self.enrich(dataset, c)
else:
dataset = data.copy()

Expand All @@ -996,9 +1006,9 @@ def inference(self,batch_size:int=100,
if c in ['past_steps','future_steps','shift','keep_entire_seq_while_shifting','starting_point']:
split_params[c] = self.split_params[c]
split_params['skip_step']=1
data = self.create_data_loader(dataset,**split_params)
data = self.create_data_loader(dataset,**split_params,is_inference=is_inference)
else:
data = self.create_data_loader(data,**split_params)
data = self.create_data_loader(data,**split_params,is_inference=is_inference)

res = self.inference_on_set(batch_size=batch_size,num_workers=num_workers,split_params=None,set='custom',rescaling=rescaling,data=data)
self.check_custom = False
Expand Down
Loading