keras-rs-nightly


Namekeras-rs-nightly JSON
Version 0.2.2.dev202509030321 PyPI version JSON
download
home_pageNone
SummaryMulti-backend recommender systems with Keras 3.
upload_time2025-09-03 03:21:25
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseApache License 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Keras Recommenders

<p align="center" width="100%">
<img src="https://i.imgur.com/m1BX7Zd.png" width="434" height="157" alt="KerasRS">
</p>

Keras Recommenders is a library for building recommender systems on top of
Keras 3. Keras Recommenders works natively with TensorFlow, JAX, or PyTorch. It
provides a collection of building blocks which help with the full workflow of
creating a recommender system. As it's built on Keras 3, models can be trained
and serialized in any framework and re-used in another without costly
migrations.

This library is an extension of the core Keras API; all high-level modules
receive that same level of polish as core Keras. If you are familiar with Keras,
congratulations! You already understand most of Keras Recommenders.

## Quick Links

- [Home page](https://keras.io/keras_rs)
- [Examples](https://keras.io/keras_rs/examples)
- [API documentation](https://keras.io/keras_rs/api)

## Quickstart

### Train your own cross network

Choose a backend:

```python
import os
os.environ["KERAS_BACKEND"] = "jax"  # Or "tensorflow" or "torch"!
```

Import KerasRS and other libraries:

```python
import keras
import keras_rs
import numpy as np
```

Define a simple model using the `FeatureCross` layer:

```python
vocabulary_size = 32
embedding_dim = 6

inputs = keras.Input(shape=(), name='indices', dtype="int32")
x0 = keras.layers.Embedding(
    input_dim=vocabulary_size,
    output_dim=embedding_dim
)(inputs)
x1 = keras_rs.layers.FeatureCross()(x0, x0)
x2 = keras_rs.layers.FeatureCross()(x0, x1)
output = keras.layers.Dense(units=10)(x2)
model = keras.Model(inputs, output)
```

Compile the model:

```python
model.compile(
    loss=keras.losses.MeanSquaredError(),
    optimizer=keras.optimizers.Adam(learning_rate=3e-4)
)
```

Call `model.fit()` on dummy data:

```python
batch_size = 2
x = np.random.randint(0, vocabulary_size, size=(batch_size,))
y = np.random.random(size=(batch_size,))
model.fit(x, y=y)
```

### Use ranking losses and metrics

If your task is to rank items in a list, you can make use of the ranking losses
and metrics which KerasRS provides. Below, we use the pairwise hinge loss and
track the nDCG metric:

```python
model.compile(
    loss=keras_rs.losses.PairwiseHingeLoss(),
    metrics=[keras_rs.metrics.NDCG()],
    optimizer=keras.optimizers.Adam(learning_rate=3e-4),
)
```

## Installation

Keras Recommenders is available on PyPI as `keras-rs`:

```bash
pip install keras-rs
```

To try out the latest version of Keras Recommenders, you can use our nightly
package:

```bash
pip install keras-rs-nightly
```

Read [Getting started with Keras](https://keras.io/getting_started/) for more
information on installing Keras 3 and compatibility with different frameworks.

> [!IMPORTANT]
> We recommend using Keras Recommenders with TensorFlow 2.16 or later, as
> TF 2.16 packages Keras 3 by default.

## Configuring your backend

If you have Keras 3 installed in your environment (see installation above), you
can use Keras Recommenders with any of JAX, TensorFlow and PyTorch. To do so,
set the `KERAS_BACKEND` environment variable. For example:

```shell
export KERAS_BACKEND=jax
```

Or in Colab, with:

```python
import os
os.environ["KERAS_BACKEND"] = "jax"

import keras_rs
```

> [!IMPORTANT]
> Make sure to set the `KERAS_BACKEND` **before** importing any Keras libraries;
> it will be used to set up Keras when it is first imported.

## Compatibility

We follow [Semantic Versioning](https://semver.org/), and plan to provide
backwards compatibility guarantees both for code and saved models built with our
components. While we continue with pre-release `0.y.z` development, we may break
compatibility at any time and APIs should not be considered stable.

## Citing Keras Recommenders

If Keras Recommenders helps your research, we appreciate your citations.
Here is the BibTeX entry:

```bibtex
@misc{kerasrecommenders2024,
  title={KerasRecommenders},
  author={Hertschuh, Fabien and  Chollet, Fran\c{c}ois and Sharma, Abheesht and others},
  year={2024},
  howpublished={\url{https://github.com/keras-team/keras-rs}},
}
```

## Acknowledgements

Thank you to all of our wonderful contributors!

<a href="https://github.com/keras-team/keras-rs/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=keras-team/keras-rs" />
</a>

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "keras-rs-nightly",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Keras team <keras-users@googlegroups.com>",
    "download_url": "https://files.pythonhosted.org/packages/b6/22/51f33a795a355113da04a91e958f5056a27e789aa3be3389a6ae34211745/keras_rs_nightly-0.2.2.dev202509030321.tar.gz",
    "platform": null,
    "description": "# Keras Recommenders\n\n<p align=\"center\" width=\"100%\">\n<img src=\"https://i.imgur.com/m1BX7Zd.png\" width=\"434\" height=\"157\" alt=\"KerasRS\">\n</p>\n\nKeras Recommenders is a library for building recommender systems on top of\nKeras 3. Keras Recommenders works natively with TensorFlow, JAX, or PyTorch. It\nprovides a collection of building blocks which help with the full workflow of\ncreating a recommender system. As it's built on Keras 3, models can be trained\nand serialized in any framework and re-used in another without costly\nmigrations.\n\nThis library is an extension of the core Keras API; all high-level modules\nreceive that same level of polish as core Keras. If you are familiar with Keras,\ncongratulations! You already understand most of Keras Recommenders.\n\n## Quick Links\n\n- [Home page](https://keras.io/keras_rs)\n- [Examples](https://keras.io/keras_rs/examples)\n- [API documentation](https://keras.io/keras_rs/api)\n\n## Quickstart\n\n### Train your own cross network\n\nChoose a backend:\n\n```python\nimport os\nos.environ[\"KERAS_BACKEND\"] = \"jax\"  # Or \"tensorflow\" or \"torch\"!\n```\n\nImport KerasRS and other libraries:\n\n```python\nimport keras\nimport keras_rs\nimport numpy as np\n```\n\nDefine a simple model using the `FeatureCross` layer:\n\n```python\nvocabulary_size = 32\nembedding_dim = 6\n\ninputs = keras.Input(shape=(), name='indices', dtype=\"int32\")\nx0 = keras.layers.Embedding(\n    input_dim=vocabulary_size,\n    output_dim=embedding_dim\n)(inputs)\nx1 = keras_rs.layers.FeatureCross()(x0, x0)\nx2 = keras_rs.layers.FeatureCross()(x0, x1)\noutput = keras.layers.Dense(units=10)(x2)\nmodel = keras.Model(inputs, output)\n```\n\nCompile the model:\n\n```python\nmodel.compile(\n    loss=keras.losses.MeanSquaredError(),\n    optimizer=keras.optimizers.Adam(learning_rate=3e-4)\n)\n```\n\nCall `model.fit()` on dummy data:\n\n```python\nbatch_size = 2\nx = np.random.randint(0, vocabulary_size, size=(batch_size,))\ny = np.random.random(size=(batch_size,))\nmodel.fit(x, y=y)\n```\n\n### Use ranking losses and metrics\n\nIf your task is to rank items in a list, you can make use of the ranking losses\nand metrics which KerasRS provides. Below, we use the pairwise hinge loss and\ntrack the nDCG metric:\n\n```python\nmodel.compile(\n    loss=keras_rs.losses.PairwiseHingeLoss(),\n    metrics=[keras_rs.metrics.NDCG()],\n    optimizer=keras.optimizers.Adam(learning_rate=3e-4),\n)\n```\n\n## Installation\n\nKeras Recommenders is available on PyPI as `keras-rs`:\n\n```bash\npip install keras-rs\n```\n\nTo try out the latest version of Keras Recommenders, you can use our nightly\npackage:\n\n```bash\npip install keras-rs-nightly\n```\n\nRead [Getting started with Keras](https://keras.io/getting_started/) for more\ninformation on installing Keras 3 and compatibility with different frameworks.\n\n> [!IMPORTANT]\n> We recommend using Keras Recommenders with TensorFlow 2.16 or later, as\n> TF 2.16 packages Keras 3 by default.\n\n## Configuring your backend\n\nIf you have Keras 3 installed in your environment (see installation above), you\ncan use Keras Recommenders with any of JAX, TensorFlow and PyTorch. To do so,\nset the `KERAS_BACKEND` environment variable. For example:\n\n```shell\nexport KERAS_BACKEND=jax\n```\n\nOr in Colab, with:\n\n```python\nimport os\nos.environ[\"KERAS_BACKEND\"] = \"jax\"\n\nimport keras_rs\n```\n\n> [!IMPORTANT]\n> Make sure to set the `KERAS_BACKEND` **before** importing any Keras libraries;\n> it will be used to set up Keras when it is first imported.\n\n## Compatibility\n\nWe follow [Semantic Versioning](https://semver.org/), and plan to provide\nbackwards compatibility guarantees both for code and saved models built with our\ncomponents. While we continue with pre-release `0.y.z` development, we may break\ncompatibility at any time and APIs should not be considered stable.\n\n## Citing Keras Recommenders\n\nIf Keras Recommenders helps your research, we appreciate your citations.\nHere is the BibTeX entry:\n\n```bibtex\n@misc{kerasrecommenders2024,\n  title={KerasRecommenders},\n  author={Hertschuh, Fabien and  Chollet, Fran\\c{c}ois and Sharma, Abheesht and others},\n  year={2024},\n  howpublished={\\url{https://github.com/keras-team/keras-rs}},\n}\n```\n\n## Acknowledgements\n\nThank you to all of our wonderful contributors!\n\n<a href=\"https://github.com/keras-team/keras-rs/graphs/contributors\">\n  <img src=\"https://contrib.rocks/image?repo=keras-team/keras-rs\" />\n</a>\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Multi-backend recommender systems with Keras 3.",
    "version": "0.2.2.dev202509030321",
    "project_urls": {
        "Home": "https://keras.io/keras_rs",
        "Repository": "https://github.com/keras-team/keras-rs"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "81d0ebdd9b5d42b47b9afe70a071d7ea188146d5c1ec64edf50fc75a058c0d43",
                "md5": "8e28d6aa33c408b8f2c933f02edeb46c",
                "sha256": "4c695d72858a1ac967901e2e6bbd787fdd40b4971b8bf652d90115ee4b51c3a2"
            },
            "downloads": -1,
            "filename": "keras_rs_nightly-0.2.2.dev202509030321-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8e28d6aa33c408b8f2c933f02edeb46c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 93015,
            "upload_time": "2025-09-03T03:21:23",
            "upload_time_iso_8601": "2025-09-03T03:21:23.819914Z",
            "url": "https://files.pythonhosted.org/packages/81/d0/ebdd9b5d42b47b9afe70a071d7ea188146d5c1ec64edf50fc75a058c0d43/keras_rs_nightly-0.2.2.dev202509030321-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b62251f33a795a355113da04a91e958f5056a27e789aa3be3389a6ae34211745",
                "md5": "4b4e9317d9d33ae6a6667874255414cf",
                "sha256": "b32fbf4546ee340457add3570c5dc89c13f3bba29fac3eed5137dd440276d013"
            },
            "downloads": -1,
            "filename": "keras_rs_nightly-0.2.2.dev202509030321.tar.gz",
            "has_sig": false,
            "md5_digest": "4b4e9317d9d33ae6a6667874255414cf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 70221,
            "upload_time": "2025-09-03T03:21:25",
            "upload_time_iso_8601": "2025-09-03T03:21:25.307782Z",
            "url": "https://files.pythonhosted.org/packages/b6/22/51f33a795a355113da04a91e958f5056a27e789aa3be3389a6ae34211745/keras_rs_nightly-0.2.2.dev202509030321.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-03 03:21:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "keras-team",
    "github_project": "keras-rs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "keras-rs-nightly"
}
        
Elapsed time: 1.15002s