{"id":2619,"date":"2025-05-19T15:57:00","date_gmt":"2025-05-19T15:57:00","guid":{"rendered":"https:\/\/techtrendfeed.com\/?p=2619"},"modified":"2025-05-19T15:57:00","modified_gmt":"2025-05-19T15:57:00","slug":"construct-and-practice-a-recommender-system-in-10-minutes-utilizing-keras-and-jax","status":"publish","type":"post","link":"https:\/\/techtrendfeed.com\/?p=2619","title":{"rendered":"Construct and practice a recommender system in 10 minutes utilizing Keras and JAX"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p data-block-key=\"clhnt\">At the moment, we&#8217;re excited to announce the launch of <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/keras.io\/keras_rs\/\">Keras Recommenders<\/a>, a brand new library that places state-of-the-art advice methods at your fingertips.<\/p>\n<h2 data-block-key=\"6m4xa\" id=\"power-digital-experiences-with-recommendation-systems\">Energy digital experiences with advice programs<\/h2>\n<p data-block-key=\"65d6c\">Suggestion programs energy lots of the interactions you&#8217;ve got with expertise right now. Open up any app in your cellphone and also you\u2019ll doubtless end up interacting with a advice mannequin immediately, from the homefeed in your go-to social media platform to video ideas on YouTube to even the advertisements that pop up in your favourite recreation. Because the world of AI continues to evolve, delivering customized experiences is extra vital than ever. Giant language fashions cannot do all the things, and recommender programs are liable for creating many top-tier digital experiences right now.<\/p>\n<p data-block-key=\"3l09p\">To assist builders create performant and correct recommender programs, <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/keras.io\/keras_rs\/\">Keras Recommenders (KerasRS)<\/a> incorporates a set of <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/keras.io\/keras_rs\/api\/\">APIs<\/a> with constructing blocks designed for duties equivalent to rating and retrieval. For instance, at Google, we use KerasRS to assist energy the feed in Google Play.<\/p>\n<h2 data-block-key=\"xltdv\" id=\"install-kerasrs-with-jax-tensorflow-or-pytorch\">Set up KerasRS with JAX, TensorFlow, or PyTorch<\/h2>\n<p data-block-key=\"35m36\">To get began, pip set up the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/pypi.org\/project\/keras-rs\/\">keras-rs bundle<\/a>. Then set the backend to JAX (or TensorFlow or PyTorch). Now you&#8217;re in your approach to crafting your personal state-of-the-art recommender system.<\/p>\n<\/div>\n<div>\n<pre><code class=\"language-python\">import os&#13;\nos.environ[\"KERAS_BACKEND\"] = \"jax\"&#13;\n&#13;\nimport keras&#13;\nimport keras_rs&#13;\n&#13;\nclass SequentialRetrievalModel(keras.Mannequin):&#13;\n    def __init__(self):&#13;\n        self.query_model = keras.Sequential([&#13;\n            keras.layers.Embedding(query_count, embed_dim),&#13;\n            keras.layers.GRU(embed_dim),&#13;\n        ])&#13;\n        self.candidate_model = keras.layers.Embedding(candidate_count, embed_dim)&#13;\n        self.retrieval = keras_rs.layers.BruteForceRetrieval(ok=10)&#13;\n        self.loss_fn = keras.losses.CategoricalCrossentropy(from_logits=True)&#13;\n&#13;\n    def name(self, inputs):&#13;\n        query_embeddings = self.query_model(inputs)&#13;\n        predictions = self.retrieval(query_embeddings)&#13;\n        return {\"query_embeddings\": query_embeddings, \"predictions\": predictions}<\/code><\/pre>\n<p>\n        Python\n    <\/p>\n<\/div>\n<div>\n<p data-block-key=\"clhnt\">On this instance, we present a preferred retrieval structure through which we determine a set of candidate suggestions. KerasRS supplies all the things you want to implement this structure, with specialised layers, losses, and metrics designed particularly for recommender duties. You may as well comply with alongside in<a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/colab.sandbox.google.com\/github\/keras-team\/keras-io\/blob\/master\/examples\/keras_rs\/ipynb\/sequential_retrieval.ipynb\"> this colab pocket book.<\/a><\/p>\n<p data-block-key=\"d8dm7\">And naturally, all these constructing blocks work with the usual Keras APIs of <code>mannequin.compile<\/code> to construct your mannequin and <code>mannequin.match<\/code> to simply configure your coaching loop.<\/p>\n<\/div>\n<div>\n<pre><code class=\"language-python\">mannequin.compile(&#13;\n    loss=keras_rs.losses.PairwiseHingeLoss(),&#13;\n    metrics=[keras_rs.metrics.NDCG(k=8, name=\"ndcg\")],&#13;\n    optimizer=keras.optimizers.Adagrad(learning_rate=3e-4),&#13;\n)&#13;\nmannequin.match(train_ds, validation_data=val_ds, epochs=5)<\/code><\/pre>\n<p>\n        Python\n    <\/p>\n<\/div>\n<div>\n<p data-block-key=\"clhnt\">Within the coming months, we plan to launch the <code>keras_rs.layers.DistributedEmbedding<\/code> class for leveraging SparseCore chips on TPU for doing giant embedding lookups distributed throughout machines. Moreover, we are going to add standard mannequin implementations to our library constantly, making it even simpler to construct state-of-the-art recommender programs.<\/p>\n<h2 data-block-key=\"ons2l\" id=\"explore-the-kerasrs-documentation-and-examples\">Discover the KerasRS documentation and examples<\/h2>\n<p data-block-key=\"b20g9\">We additionally wish to spotlight all of the documentation we&#8217;ve for Keras Recommenders on our just lately redesigned <a rel=\"nofollow\" target=\"_blank\" href=\"http:\/\/keras.io\/\">keras.io<\/a> web site. On <a rel=\"nofollow\" target=\"_blank\" href=\"http:\/\/keras.io\/keras_rs\">keras.io\/keras_rs<\/a>, you will discover starter examples involving the basic <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/keras.io\/keras_rs\/examples\/dcn\/\">Deep and Cross Community (DCN)<\/a> and <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/keras.io\/keras_rs\/examples\/basic_retrieval\/\">two-tower embedding mannequin<\/a> that present the step-by-step processes for writing and coaching your first recommender. There are additionally extra superior tutorials, equivalent to <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/keras.io\/keras_rs\/examples\/sas_rec\/\">SASRec<\/a>, displaying an end-to-end instance of coaching a transformer mannequin.<\/p>\n<\/div>\n<div>\n<h2 data-block-key=\"x7zbz\" id=\"get-started\">Get began<\/h2>\n<p data-block-key=\"ah0tr\">Go to <a rel=\"nofollow\" target=\"_blank\" href=\"http:\/\/keras.io\/keras-rs\">our web site<\/a> right now for extra examples, documentation, and guides to construct your very personal advice system. You may as well browse the code and contribute at <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/github.com\/keras-team\/keras-rs\">https:\/\/github.com\/keras-team\/keras-rs<\/a> (be at liberty to offer it a star \u2b50 too when you\u2019re there!).<\/p>\n<p data-block-key=\"6ib17\">We stay up for seeing all the wonderful advice programs that get constructed with <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/pypi.org\/project\/keras-rs\/\">Keras Recommenders<\/a>.<\/p>\n<hr\/>\n<h3 data-block-key=\"tsbuy\" id=\"\"><b>Acknowledgements<\/b><\/h3>\n<p data-block-key=\"345a9\"><sup>Shout-out to Fabien Hertschuh and Abheesht Sharma for constructing Keras Recommenders. We additionally wish to thank the Keras and ML Frameworks groups in addition to all our collaborators and management for serving to us pull this off.<\/sup><\/p>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>At the moment, we&#8217;re excited to announce the launch of Keras Recommenders, a brand new library that places state-of-the-art advice methods at your fingertips. Energy digital experiences with advice programs Suggestion programs energy lots of the interactions you&#8217;ve got with expertise right now. Open up any app in your cellphone and also you\u2019ll doubtless end [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":2621,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[73,2551,2550,2549,2548,849,2547],"class_list":["post-2619","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-build","tag-jax","tag-keras","tag-minutes","tag-recommender","tag-system","tag-train"],"_links":{"self":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/2619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2619"}],"version-history":[{"count":1,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/2619\/revisions"}],"predecessor-version":[{"id":2620,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/2619\/revisions\/2620"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/media\/2621"}],"wp:attachment":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- This website is optimized by Airlift. Learn more: https://airlift.net. Template:. Learn more: https://airlift.net. Template: 69d9690a190636c2e0989534. Config Timestamp: 2026-04-10 21:18:02 UTC, Cached Timestamp: 2026-06-15 09:17:52 UTC -->