Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logo in documentation #121

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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