keras-rs 0.1.0.dev0__tar.gz → 0.2.0.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/PKG-INFO +83 -5
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/README.md +78 -0
- keras_rs-0.2.0.dev0/keras_rs/api/__init__.py +11 -0
- keras_rs-0.2.0.dev0/keras_rs/api/layers/__init__.py +37 -0
- keras_rs-0.2.0.dev0/keras_rs/api/losses/__init__.py +18 -0
- keras_rs-0.2.0.dev0/keras_rs/api/metrics/__init__.py +16 -0
- keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/__init__.py +21 -0
- keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/base_distributed_embedding.py +731 -0
- keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/distributed_embedding_config.py +129 -0
- keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/embed_reduce.py +285 -0
- keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/jax/config_conversion.py +393 -0
- keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/jax/distributed_embedding.py +824 -0
- keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/jax/embedding_lookup.py +256 -0
- keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/jax/embedding_utils.py +608 -0
- keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/jax/test_utils.py +535 -0
- keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/tensorflow/config_conversion.py +323 -0
- keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/tensorflow/distributed_embedding.py +424 -0
- keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/test_utils.py +374 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/layers/feature_interaction/dot_interaction.py +49 -2
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/layers/feature_interaction/feature_cross.py +26 -7
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/layers/retrieval/hard_negative_mining.py +25 -7
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/layers/retrieval/remove_accidental_hits.py +18 -5
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/layers/retrieval/sampling_probability_correction.py +18 -3
- keras_rs-0.2.0.dev0/keras_rs/src/losses/__init__.py +0 -0
- keras_rs-0.2.0.dev0/keras_rs/src/losses/pairwise_hinge_loss.py +90 -0
- keras_rs-0.2.0.dev0/keras_rs/src/losses/pairwise_logistic_loss.py +99 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/losses/pairwise_loss.py +50 -19
- keras_rs-0.2.0.dev0/keras_rs/src/losses/pairwise_loss_utils.py +39 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/losses/pairwise_mean_squared_error.py +68 -4
- keras_rs-0.2.0.dev0/keras_rs/src/losses/pairwise_soft_zero_one_loss.py +98 -0
- keras_rs-0.2.0.dev0/keras_rs/src/metrics/__init__.py +0 -0
- keras_rs-0.2.0.dev0/keras_rs/src/metrics/dcg.py +161 -0
- keras_rs-0.2.0.dev0/keras_rs/src/metrics/mean_average_precision.py +130 -0
- keras_rs-0.2.0.dev0/keras_rs/src/metrics/mean_reciprocal_rank.py +121 -0
- keras_rs-0.2.0.dev0/keras_rs/src/metrics/ndcg.py +197 -0
- keras_rs-0.2.0.dev0/keras_rs/src/metrics/precision_at_k.py +117 -0
- keras_rs-0.2.0.dev0/keras_rs/src/metrics/ranking_metric.py +260 -0
- keras_rs-0.2.0.dev0/keras_rs/src/metrics/ranking_metrics_utils.py +238 -0
- keras_rs-0.2.0.dev0/keras_rs/src/metrics/recall_at_k.py +108 -0
- keras_rs-0.2.0.dev0/keras_rs/src/metrics/utils.py +72 -0
- keras_rs-0.2.0.dev0/keras_rs/src/types.py +69 -0
- keras_rs-0.2.0.dev0/keras_rs/src/utils/__init__.py +0 -0
- keras_rs-0.2.0.dev0/keras_rs/src/utils/doc_string_utils.py +53 -0
- keras_rs-0.2.0.dev0/keras_rs/src/utils/keras_utils.py +76 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/version.py +1 -1
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs.egg-info/PKG-INFO +83 -5
- keras_rs-0.2.0.dev0/keras_rs.egg-info/SOURCES.txt +59 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/pyproject.toml +14 -8
- keras_rs-0.1.0.dev0/keras_rs/__init__.py +0 -30
- keras_rs-0.1.0.dev0/keras_rs/api/__init__.py +0 -10
- keras_rs-0.1.0.dev0/keras_rs/api/layers/__init__.py +0 -23
- keras_rs-0.1.0.dev0/keras_rs/api/losses/__init__.py +0 -14
- keras_rs-0.1.0.dev0/keras_rs/src/losses/pairwise_hinge_loss.py +0 -26
- keras_rs-0.1.0.dev0/keras_rs/src/losses/pairwise_logistic_loss.py +0 -35
- keras_rs-0.1.0.dev0/keras_rs/src/losses/pairwise_soft_zero_one_loss.py +0 -31
- keras_rs-0.1.0.dev0/keras_rs/src/types.py +0 -26
- keras_rs-0.1.0.dev0/keras_rs/src/utils/keras_utils.py +0 -44
- keras_rs-0.1.0.dev0/keras_rs/src/utils/pairwise_loss_utils.py +0 -102
- keras_rs-0.1.0.dev0/keras_rs.egg-info/SOURCES.txt +0 -34
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/__init__.py +0 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/api_export.py +0 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/layers/__init__.py +0 -0
- {keras_rs-0.1.0.dev0/keras_rs/src/layers/feature_interaction → keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/jax}/__init__.py +0 -0
- {keras_rs-0.1.0.dev0/keras_rs/src/layers/retrieval → keras_rs-0.2.0.dev0/keras_rs/src/layers/embedding/tensorflow}/__init__.py +0 -0
- {keras_rs-0.1.0.dev0/keras_rs/src/losses → keras_rs-0.2.0.dev0/keras_rs/src/layers/feature_interaction}/__init__.py +0 -0
- {keras_rs-0.1.0.dev0/keras_rs/src/utils → keras_rs-0.2.0.dev0/keras_rs/src/layers/retrieval}/__init__.py +0 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/layers/retrieval/brute_force_retrieval.py +0 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs/src/layers/retrieval/retrieval.py +0 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs.egg-info/dependency_links.txt +0 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs.egg-info/requires.txt +0 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/keras_rs.egg-info/top_level.txt +0 -0
- {keras_rs-0.1.0.dev0 → keras_rs-0.2.0.dev0}/setup.cfg +0 -0
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: keras-rs
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0.dev0
|
|
4
4
|
Summary: Multi-backend recommender systems with Keras 3.
|
|
5
|
-
Author-email: Keras
|
|
5
|
+
Author-email: Keras team <keras-users@googlegroups.com>
|
|
6
6
|
License: Apache License 2.0
|
|
7
|
-
Project-URL: Home, https://keras.io/
|
|
7
|
+
Project-URL: Home, https://keras.io/keras_rs
|
|
8
8
|
Project-URL: Repository, https://github.com/keras-team/keras-rs
|
|
9
9
|
Classifier: Development Status :: 3 - Alpha
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
13
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
14
|
Classifier: Operating System :: Unix
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
16
16
|
Classifier: Operating System :: MacOS
|
|
17
17
|
Classifier: Intended Audience :: Science/Research
|
|
18
18
|
Classifier: Topic :: Scientific/Engineering
|
|
19
19
|
Classifier: Topic :: Software Development
|
|
20
|
-
Requires-Python: >=3.
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
Requires-Dist: keras
|
|
23
23
|
Requires-Dist: ml-dtypes
|
|
24
24
|
|
|
25
25
|
# Keras Recommenders
|
|
26
26
|
|
|
27
|
+
<p align="center" width="100%">
|
|
28
|
+
<img src="https://i.imgur.com/m1BX7Zd.png" width="434" height="157" alt="KerasRS">
|
|
29
|
+
</p>
|
|
30
|
+
|
|
27
31
|
Keras Recommenders is a library for building recommender systems on top of
|
|
28
32
|
Keras 3. Keras Recommenders works natively with TensorFlow, JAX, or PyTorch. It
|
|
29
33
|
provides a collection of building blocks which help with the full workflow of
|
|
@@ -35,6 +39,80 @@ This library is an extension of the core Keras API; all high-level modules
|
|
|
35
39
|
receive that same level of polish as core Keras. If you are familiar with Keras,
|
|
36
40
|
congratulations! You already understand most of Keras Recommenders.
|
|
37
41
|
|
|
42
|
+
## Quick Links
|
|
43
|
+
|
|
44
|
+
- [Home page](https://keras.io/keras_rs)
|
|
45
|
+
- [Examples](https://keras.io/keras_rs/examples)
|
|
46
|
+
- [API documentation](https://keras.io/keras_rs/api)
|
|
47
|
+
|
|
48
|
+
## Quickstart
|
|
49
|
+
|
|
50
|
+
### Train your own cross network
|
|
51
|
+
|
|
52
|
+
Choose a backend:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import os
|
|
56
|
+
os.environ["KERAS_BACKEND"] = "jax" # Or "tensorflow" or "torch"!
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Import KerasRS and other libraries:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import keras
|
|
63
|
+
import keras_rs
|
|
64
|
+
import numpy as np
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Define a simple model using the `FeatureCross` layer:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
vocabulary_size = 32
|
|
71
|
+
embedding_dim = 6
|
|
72
|
+
|
|
73
|
+
inputs = keras.Input(shape=(), name='indices', dtype="int32")
|
|
74
|
+
x0 = keras.layers.Embedding(
|
|
75
|
+
input_dim=vocabulary_size,
|
|
76
|
+
output_dim=embedding_dim
|
|
77
|
+
)(inputs)
|
|
78
|
+
x1 = keras_rs.layers.FeatureCross()(x0, x0)
|
|
79
|
+
x2 = keras_rs.layers.FeatureCross()(x0, x1)
|
|
80
|
+
output = keras.layers.Dense(units=10)(x2)
|
|
81
|
+
model = keras.Model(inputs, output)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Compile the model:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
model.compile(
|
|
88
|
+
loss=keras.losses.MeanSquaredError(),
|
|
89
|
+
optimizer=keras.optimizers.Adam(learning_rate=3e-4)
|
|
90
|
+
)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Call `model.fit()` on dummy data:
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
batch_size = 2
|
|
97
|
+
x = np.random.randint(0, vocabulary_size, size=(batch_size,))
|
|
98
|
+
y = np.random.random(size=(batch_size,))
|
|
99
|
+
model.fit(x, y=y)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Use ranking losses and metrics
|
|
103
|
+
|
|
104
|
+
If your task is to rank items in a list, you can make use of the ranking losses
|
|
105
|
+
and metrics which KerasRS provides. Below, we use the pairwise hinge loss and
|
|
106
|
+
track the nDCG metric:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
model.compile(
|
|
110
|
+
loss=keras_rs.losses.PairwiseHingeLoss(),
|
|
111
|
+
metrics=[keras_rs.metrics.NDCG()],
|
|
112
|
+
optimizer=keras.optimizers.Adam(learning_rate=3e-4),
|
|
113
|
+
)
|
|
114
|
+
```
|
|
115
|
+
|
|
38
116
|
## Installation
|
|
39
117
|
|
|
40
118
|
Keras Recommenders is available on PyPI as `keras-rs`:
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Keras Recommenders
|
|
2
2
|
|
|
3
|
+
<p align="center" width="100%">
|
|
4
|
+
<img src="https://i.imgur.com/m1BX7Zd.png" width="434" height="157" alt="KerasRS">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
3
7
|
Keras Recommenders is a library for building recommender systems on top of
|
|
4
8
|
Keras 3. Keras Recommenders works natively with TensorFlow, JAX, or PyTorch. It
|
|
5
9
|
provides a collection of building blocks which help with the full workflow of
|
|
@@ -11,6 +15,80 @@ This library is an extension of the core Keras API; all high-level modules
|
|
|
11
15
|
receive that same level of polish as core Keras. If you are familiar with Keras,
|
|
12
16
|
congratulations! You already understand most of Keras Recommenders.
|
|
13
17
|
|
|
18
|
+
## Quick Links
|
|
19
|
+
|
|
20
|
+
- [Home page](https://keras.io/keras_rs)
|
|
21
|
+
- [Examples](https://keras.io/keras_rs/examples)
|
|
22
|
+
- [API documentation](https://keras.io/keras_rs/api)
|
|
23
|
+
|
|
24
|
+
## Quickstart
|
|
25
|
+
|
|
26
|
+
### Train your own cross network
|
|
27
|
+
|
|
28
|
+
Choose a backend:
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import os
|
|
32
|
+
os.environ["KERAS_BACKEND"] = "jax" # Or "tensorflow" or "torch"!
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Import KerasRS and other libraries:
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
import keras
|
|
39
|
+
import keras_rs
|
|
40
|
+
import numpy as np
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Define a simple model using the `FeatureCross` layer:
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
vocabulary_size = 32
|
|
47
|
+
embedding_dim = 6
|
|
48
|
+
|
|
49
|
+
inputs = keras.Input(shape=(), name='indices', dtype="int32")
|
|
50
|
+
x0 = keras.layers.Embedding(
|
|
51
|
+
input_dim=vocabulary_size,
|
|
52
|
+
output_dim=embedding_dim
|
|
53
|
+
)(inputs)
|
|
54
|
+
x1 = keras_rs.layers.FeatureCross()(x0, x0)
|
|
55
|
+
x2 = keras_rs.layers.FeatureCross()(x0, x1)
|
|
56
|
+
output = keras.layers.Dense(units=10)(x2)
|
|
57
|
+
model = keras.Model(inputs, output)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Compile the model:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
model.compile(
|
|
64
|
+
loss=keras.losses.MeanSquaredError(),
|
|
65
|
+
optimizer=keras.optimizers.Adam(learning_rate=3e-4)
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Call `model.fit()` on dummy data:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
batch_size = 2
|
|
73
|
+
x = np.random.randint(0, vocabulary_size, size=(batch_size,))
|
|
74
|
+
y = np.random.random(size=(batch_size,))
|
|
75
|
+
model.fit(x, y=y)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Use ranking losses and metrics
|
|
79
|
+
|
|
80
|
+
If your task is to rank items in a list, you can make use of the ranking losses
|
|
81
|
+
and metrics which KerasRS provides. Below, we use the pairwise hinge loss and
|
|
82
|
+
track the nDCG metric:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
model.compile(
|
|
86
|
+
loss=keras_rs.losses.PairwiseHingeLoss(),
|
|
87
|
+
metrics=[keras_rs.metrics.NDCG()],
|
|
88
|
+
optimizer=keras.optimizers.Adam(learning_rate=3e-4),
|
|
89
|
+
)
|
|
90
|
+
```
|
|
91
|
+
|
|
14
92
|
## Installation
|
|
15
93
|
|
|
16
94
|
Keras Recommenders is available on PyPI as `keras-rs`:
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
This file was autogenerated. Do not edit it by hand,
|
|
4
|
+
since your modifications would be overwritten.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from keras_rs import layers as layers
|
|
8
|
+
from keras_rs import losses as losses
|
|
9
|
+
from keras_rs import metrics as metrics
|
|
10
|
+
from keras_rs.src.version import __version__ as __version__
|
|
11
|
+
from keras_rs.src.version import version as version
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
This file was autogenerated. Do not edit it by hand,
|
|
4
|
+
since your modifications would be overwritten.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from keras_rs.src.layers.embedding import (
|
|
8
|
+
DistributedEmbedding as DistributedEmbedding,
|
|
9
|
+
)
|
|
10
|
+
from keras_rs.src.layers.embedding.distributed_embedding_config import (
|
|
11
|
+
FeatureConfig as FeatureConfig,
|
|
12
|
+
)
|
|
13
|
+
from keras_rs.src.layers.embedding.distributed_embedding_config import (
|
|
14
|
+
TableConfig as TableConfig,
|
|
15
|
+
)
|
|
16
|
+
from keras_rs.src.layers.embedding.embed_reduce import (
|
|
17
|
+
EmbedReduce as EmbedReduce,
|
|
18
|
+
)
|
|
19
|
+
from keras_rs.src.layers.feature_interaction.dot_interaction import (
|
|
20
|
+
DotInteraction as DotInteraction,
|
|
21
|
+
)
|
|
22
|
+
from keras_rs.src.layers.feature_interaction.feature_cross import (
|
|
23
|
+
FeatureCross as FeatureCross,
|
|
24
|
+
)
|
|
25
|
+
from keras_rs.src.layers.retrieval.brute_force_retrieval import (
|
|
26
|
+
BruteForceRetrieval as BruteForceRetrieval,
|
|
27
|
+
)
|
|
28
|
+
from keras_rs.src.layers.retrieval.hard_negative_mining import (
|
|
29
|
+
HardNegativeMining as HardNegativeMining,
|
|
30
|
+
)
|
|
31
|
+
from keras_rs.src.layers.retrieval.remove_accidental_hits import (
|
|
32
|
+
RemoveAccidentalHits as RemoveAccidentalHits,
|
|
33
|
+
)
|
|
34
|
+
from keras_rs.src.layers.retrieval.retrieval import Retrieval as Retrieval
|
|
35
|
+
from keras_rs.src.layers.retrieval.sampling_probability_correction import (
|
|
36
|
+
SamplingProbabilityCorrection as SamplingProbabilityCorrection,
|
|
37
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
This file was autogenerated. Do not edit it by hand,
|
|
4
|
+
since your modifications would be overwritten.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from keras_rs.src.losses.pairwise_hinge_loss import (
|
|
8
|
+
PairwiseHingeLoss as PairwiseHingeLoss,
|
|
9
|
+
)
|
|
10
|
+
from keras_rs.src.losses.pairwise_logistic_loss import (
|
|
11
|
+
PairwiseLogisticLoss as PairwiseLogisticLoss,
|
|
12
|
+
)
|
|
13
|
+
from keras_rs.src.losses.pairwise_mean_squared_error import (
|
|
14
|
+
PairwiseMeanSquaredError as PairwiseMeanSquaredError,
|
|
15
|
+
)
|
|
16
|
+
from keras_rs.src.losses.pairwise_soft_zero_one_loss import (
|
|
17
|
+
PairwiseSoftZeroOneLoss as PairwiseSoftZeroOneLoss,
|
|
18
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
This file was autogenerated. Do not edit it by hand,
|
|
4
|
+
since your modifications would be overwritten.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from keras_rs.src.metrics.dcg import DCG as DCG
|
|
8
|
+
from keras_rs.src.metrics.mean_average_precision import (
|
|
9
|
+
MeanAveragePrecision as MeanAveragePrecision,
|
|
10
|
+
)
|
|
11
|
+
from keras_rs.src.metrics.mean_reciprocal_rank import (
|
|
12
|
+
MeanReciprocalRank as MeanReciprocalRank,
|
|
13
|
+
)
|
|
14
|
+
from keras_rs.src.metrics.ndcg import NDCG as NDCG
|
|
15
|
+
from keras_rs.src.metrics.precision_at_k import PrecisionAtK as PrecisionAtK
|
|
16
|
+
from keras_rs.src.metrics.recall_at_k import RecallAtK as RecallAtK
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import keras
|
|
2
|
+
|
|
3
|
+
from keras_rs.src.api_export import keras_rs_export
|
|
4
|
+
|
|
5
|
+
if keras.backend.backend() == "jax":
|
|
6
|
+
from keras_rs.src.layers.embedding.jax.distributed_embedding import (
|
|
7
|
+
DistributedEmbedding as BackendDistributedEmbedding,
|
|
8
|
+
)
|
|
9
|
+
elif keras.backend.backend() == "tensorflow":
|
|
10
|
+
from keras_rs.src.layers.embedding.tensorflow.distributed_embedding import (
|
|
11
|
+
DistributedEmbedding as BackendDistributedEmbedding,
|
|
12
|
+
)
|
|
13
|
+
else:
|
|
14
|
+
from keras_rs.src.layers.embedding.base_distributed_embedding import (
|
|
15
|
+
DistributedEmbedding as BackendDistributedEmbedding,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@keras_rs_export("keras_rs.layers.DistributedEmbedding")
|
|
20
|
+
class DistributedEmbedding(BackendDistributedEmbedding):
|
|
21
|
+
pass
|