Skip to content

Commit

Permalink
Merge pull request #19 from artefactory/fid-doc
Browse files Browse the repository at this point in the history
Documentation of FeaturesByID
  • Loading branch information
VincentAuriau authored Jan 29, 2024
2 parents 7338741 + 71ebe91 commit bf9653b
Show file tree
Hide file tree
Showing 4 changed files with 883 additions and 179 deletions.
4 changes: 2 additions & 2 deletions choice_learn/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Data handling classes and functions."""
from .choice_dataset import ChoiceDataset
from .store import FeaturesStore, OneHotStore
from .storage import FeaturesStorage, OneHotStorage

__all__ = ["ChoiceDataset", "FeaturesStore", "OneHotStore"]
__all__ = ["ChoiceDataset", "FeaturesStorage", "OneHotStorage"]
6 changes: 6 additions & 0 deletions choice_learn/data/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ def __getitem__(self, choices_indexes):
].batch[fixed_items_features[tuple_index][:, feature_index]]
)
feat_ind_min = feature_index + 1
unstacked_feat.append(fixed_items_features[tuple_index][feat_ind_min:])
mapped_features.append(np.concatenate(unstacked_feat, axis=1))

fixed_items_features = mapped_features
Expand All @@ -350,6 +351,7 @@ def __getitem__(self, choices_indexes):
].batch[contexts_features[tuple_index][:, feature_index]]
)
feat_ind_min = feature_index + 1
unstacked_feat.append(contexts_features[tuple_index][:, feat_ind_min:])
mapped_features.append(np.concatenate(unstacked_feat, axis=1))

contexts_features = mapped_features
Expand All @@ -373,6 +375,7 @@ def __getitem__(self, choices_indexes):
].batch[contexts_items_features[tuple_index][:, :, feature_index]]
)
feat_ind_min = feature_index + 1
unstacked_feat.append(contexts_features[tuple_index][:, :, feat_ind_min:])
mapped_features.append(np.concatenate(unstacked_feat, axis=2))

contexts_items_features = mapped_features
Expand Down Expand Up @@ -462,6 +465,7 @@ def __getitem__(self, choices_indexes):
].batch[fixed_items_features[tuple_index][:, feature_index]]
)
feat_ind_min = feature_index + 1
unstacked_feat.append(fixed_items_features[tuple_index][:, feat_ind_min:])
mapped_features.append(np.concatenate(unstacked_feat, axis=1))

fixed_items_features = mapped_features
Expand All @@ -483,6 +487,7 @@ def __getitem__(self, choices_indexes):
].batch[contexts_features[tuple_index][feature_index]]
)
feat_ind_min = feature_index + 1
unstacked_feat.append(contexts_features[tuple_index][feat_ind_min:])
mapped_features.append(np.concatenate(unstacked_feat, axis=0))

contexts_features = mapped_features
Expand All @@ -506,6 +511,7 @@ def __getitem__(self, choices_indexes):
].batch[contexts_items_features[tuple_index][:, feature_index]]
)
feat_ind_min = feature_index + 1
unstacked_feat.append(contexts_items_features[tuple_index][:, feat_ind_min:])
mapped_features.append(np.concatenate(unstacked_feat, axis=1))

contexts_items_features = mapped_features
Expand Down
Loading

0 comments on commit bf9653b

Please sign in to comment.