Skip to content

Commit

Permalink
Merge pull request #121 from HiIAmTzeKean/120-demo-preparation-for-pr…
Browse files Browse the repository at this point in the history
…esentation

Fix logo in documentation
  • Loading branch information
HiIAmTzeKean authored Nov 27, 2024
2 parents 67de572 + 780bebe commit d239a89
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
File renamed without changes
15 changes: 14 additions & 1 deletion streamsight/matrix/interaction_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def __sub__(self, im: "InteractionMatrix") -> "InteractionMatrix":
True
)

def __repr__(self):
def __repr__(self) -> str:
return repr(self._df)

def __eq__(self, value: object) -> bool:
Expand All @@ -466,6 +466,19 @@ def __eq__(self, value: object) -> bool:
return False
return self._df.equals(value._df)

def __len__(self) -> int:
"""Return the number of interactions in the matrix.
This is distinct from the shape of the matrix, which is the number of
users and items that has been released to the model. The length of the
matrix is the number of interactions present in the matrix resulting
from filter operations.
:return: Number of interactions in the matrix.
:rtype: int
"""
return len(self._df)

@overload
def items_in(self, I: Set[int], inplace=False) -> "InteractionMatrix": ...
@overload
Expand Down
1 change: 1 addition & 0 deletions streamsight/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def split(self, data: InteractionMatrix) -> None:
self._check_split()

self._split_complete = True
logger.info(f"{self.name} data split complete.")

def _check_split_complete(self):
"""Check if the setting is ready to be used for evaluation.
Expand Down
7 changes: 7 additions & 0 deletions streamsight/settings/sliding_window_setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ def _split(self, data: InteractionMatrix):
past_interaction, future_interaction = self._window_splitter.split(
data
)

# if past_interaction, future_interaction is empty, log an info message
if len(past_interaction) == 0:
logger.info(f"Split at time {sub_time} resulted in empty unlabelled testing samples.")
if len(future_interaction) == 0:
logger.info(f"Split at time {sub_time} resulted in empty incremental data.")

unlabeled_set, ground_truth = self.prediction_data_processor.process(past_interaction,
future_interaction,
self.top_K)
Expand Down

0 comments on commit d239a89

Please sign in to comment.