{"id":8051,"date":"2021-01-07T01:05:54","date_gmt":"2021-01-07T09:05:54","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=8051"},"modified":"2025-06-13T20:08:50","modified_gmt":"2025-06-14T03:08:50","slug":"machine-learning-predictions-couchbase-lite-predictive-query","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/","title":{"rendered":"Make Machine Learning Predictions With Couchbase Lite"},"content":{"rendered":"<p>Couchbase Lite\u2019s <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/swift\/learn\/swift-query-predictive.html\">Predictive Query API<\/a> allows applications to leverage pre-trained, Machine Learning(ML) models to run predictive queries against data in embedded Couchbase Lite database in a convenient, fast and always-available way. These predictions can be combined with predictions made against real-time data captured by your app to enable a range of compelling applications. The Predictive Query API in Couchbase Lite is the first of its kind in an embedded database. We had <a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-2-5-released\/\">announced<\/a> the Developer Preview version of Predictive Query API with Couchbase Mobile 2.5 last year. With <a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-mobile-embedded-java-write-throughput\/\">Couchbase Mobile 2.7<\/a>, we are happy to announce the General Availability of this feature.<\/p>\n<p>In this post, we provide an overview of the feature including context around why we built it and the kinds of applications that it <ins id=\"firstdiff\"><\/ins>can enable. We also demonstrate the use of the Predictive API with an example. You can refer to the <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/swift\/learn\/swift-query-predictive.html\">documentation<\/a> pages for specifics on the API and sample code snippets.<\/p>\n<h2 id=\"machinelearningonmobile-motivation\">Machine Learning on Mobile &#8211; Motivation<\/h2>\n<p>Machine Learning has been traditionally been done in the cloud. With access to \u201cunbounded\u201d compute and storage resources, it seemed like the only viable place to do it. While that may be true for certain applications, there are a number of reasons to perform machine learning locally on mobile device.<\/p>\n<h3 id=\"fastresponsive\">Fast &amp; Responsive<\/h3>\n<p>By avoiding the round trip time to the cloud, the response times to predictions can be guaranteed to be in order of a few milliseconds regardless of state of network connection. This is important as the responsiveness of an app is directly correlated to the end user experience which is important for app retention.<\/p>\n<h3 id=\"alwaysavailable\">Always Available<\/h3>\n<p>By running machine learning locally on device, you can make predictions even in disconnected state. Your application and your data is always available. This is particularly relevant in case of field applications deployed in disconnected environments.<\/p>\n<h3 id=\"dataprivacy\">Data Privacy<\/h3>\n<p>Running predictions locally on the device implies that sensitive data does not have to ever leave your device. You can use this to build apps with highly personalized experiences without compromising on data privacy restrictions.<\/p>\n<h3 id=\"bandwidthsavings\">Bandwidth Savings<\/h3>\n<p>By avoiding the need for data to be transferred to the cloud, you can save on bandwidth costs. This is particularly important in case of network bandwidth constrained environments where data plans come at a premium.<\/p>\n<p>All of the abovementioned benefits align well with the paradigm of <a href=\"https:\/\/www.odbms.org\/2019\/07\/on-iot-edge-computing-and-couchbase-mobile-qa-with-priya-rajagopal\/\">edge computing<\/a> where there is a growing need to bring storage and compute closer to the edge.<\/p>\n<h2 id=\"mobileml-ecosystem\">Mobile ML &#8211; Ecosystem<\/h2>\n<p>Mobile ML is a reality and there are several ecosystem enablers that make that possible.<\/p>\n<h3 id=\"powerfulmobiledevices\">Powerful Mobile Devices<\/h3>\n<p>Mobile devices are getting to be incredibly powerful. For instance, the recently launched <a href=\"https:\/\/en.wikipedia.org\/wiki\/Apple_A13\">iPhone11<\/a> and <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pixel_Visual_Core\">Pixel 4<\/a> include dedicated neural core engines. Innovation at the silicon layer make it feasible to run ML models locally on mobile devices. By taking advantage of platform hardware acceleration capabilities, the models can run in a performant manner.<\/p>\n<h3 id=\"mobileoptimizedmodels\">Mobile Optimized Models<\/h3>\n<p>Machine Learning models have traditionally been strorage and compute intensive. There are several efforts\/projects underway to optimize the models for resource utilization while maintaining required level of accuracy. There is a growing network of open-source pre-trained ML models such as <a href=\"https:\/\/ai.googleblog.com\/2017\/06\/mobilenets-open-source-models-for.html\">MobileNet<\/a> and <a href=\"https:\/\/github.com\/onnx\/models\/tree\/master\/vision\/classification\/squeezenet\">SqueezeNet<\/a> that are optimized to run on mobile devices.<\/p>\n<h3 id=\"machinelearningframeworks\">Machine Learning Frameworks<\/h3>\n<p>All the major mobile platforms include support for Machine Learning frameworks and libraries that make it extremely easy for developers to integrate ML support into their apps. These frameworks leverage hardware acceleration and low level APIs that make it very performant. Examples include <a href=\"https:\/\/developer.apple.com\/documentation\/coreml\">Core ML<\/a> for iOS, <a href=\"https:\/\/www.tensorflow.org\/lite\/guide\/android\">Tensorflow lite<\/a> for Android, <a href=\"https:\/\/dotnet.microsoft.com\/apps\/machinelearning-ai\/ml-dotnet\">ML.NET<\/a> for Windows and <a href=\"https:\/\/developers.google.com\/ml-kit\">ML Kit<\/a> among others.<\/p>\n<h3 id=\"creatingmlmodels\">Creating ML Models<\/h3>\n<p>There is a growing number of open source tools and platforms such as <a href=\"https:\/\/www.tensorflow.org\/\">TensorFlow<\/a> and <a href=\"https:\/\/developer.apple.com\/documentation\/createml\">createML<\/a> that make it easier than ever to create machine learning models. You don\u2019t need to be a data scientist to create one.<\/p>\n<h2 id=\"predictivequeryapi\">Predictive Query API<\/h2>\n<p>Predictive Queries API enable mobile apps to leverage pre-trained machine learning(ML) models to make predictions on Couchbase Lite data. The API can be used to combine real-time predictions made on data input into the app in real-time with predictions on app data stored in Couchbase Lite.<\/p>\n<p>By building <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/2.6\/swift.html#create-an-index\">prediction index<\/a> during write time, users can get see significant improvements in performance of their queries. The prediction results can be materialized in Couchbase Lite and synced over to other clients via <a href=\"https:\/\/docs.couchbase.com\/sync-gateway\/current\/index.html\">Sync Gateway<\/a>.<\/p>\n<h3 id=\"applications\">Applications<\/h3>\n<p>There are several applications of Machine Learning on mobile including image classifications, voice recognition, object recognition and content-based recommender systems. Combining those predications with data that is stored in Couchbase Lite has the potential to revolutionalize day-to-day activities across several industries. All these applications benefit from running the machine learning locally viz., guaranteed high availability, faster response, efficient network bandwidth usage and data privacy. Here are a few examples-<\/p>\n<h4 id=\"retaile-commerce\">Retail &amp; e-commerce<\/h4>\n<p>Consider this workflow<br \/>\n&#8211; You walk into a store with a photo of an item of interest. For instance, a photo of a handbag that you saw on someone.<br \/>\n&#8211; You walk up to the sales clerk to enquire if the item is available.<br \/>\n&#8211; The sales clerk takes a photo of the item with his tablet that is running a catalog \/ inventory app<br \/>\n&#8211; The captured image is used to search the store catalog database to determine it\u2019s availability.<br \/>\n&#8211; If it\u2019s available in the store you are directed to the right aisle. You can also be presented with alternatives and recommendations on other related items.<\/p>\n<figure><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/12\/GettyImages-508831370.jpg\" alt=\"Machine Learning Predictions Retail Application with Couchbase Lite\" \/><\/figure>\n<p>Image based search augment the more traditional text-based search and even voice-based search experience which rely on the user\u2019s ability to describe the item of interest. Applications with image based search can significantly improve both the online and in-store shopping experience. While the advantages of image based search are quite obvious in case of ecommerce applications, workflows such as the one described above provides an opportunity for traditional brick-and-motor stores to compete with online shopping experiences.<\/p>\n<p>Behind the scenes, the catalog\/inventory app uses an Image Classifier ML model to identify the item that is captured using the tablet camera. Once identified, the app looks up the local Couchbase Lite database to check if the item is available at the store and retrieves other relevant details such as if it is in stock and the aisle where it can be found. The images never leave the store app and can be locally deleted after use, alleviating any privacy concerns.<\/p>\n<h4 id=\"hospitality\">Hospitality<\/h4>\n<p>Consider a self-ordering kiosk at a fast food restaurant. Here is a typical workflow.<br \/>\n&#8211; You walk up to the kiosk equipped with a camera that captures your image (you have to opt in )<br \/>\n&#8211; The captured face image is used to lookup the database of registered patrons to identify your preferences<br \/>\n&#8211; The system can pull up order history, suggest meal orders, apply loyalty points and such. Your order can be placed using credit card info on file.<\/p>\n<figure><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/12\/shutterstock_509291950-e1575986071221.jpg\" alt=\"Machine Learning Predictions Meal Ordering Application with Couchbase Lite\" \/><\/figure>\n<p>Self-ordering kiosks are fairly ubiquitous and have revolutionized the meal ordering experience by reducing wait times resulting in faster service. Equipping these kiosks with facial recognition technology can make that experience even more seamless and faster.<\/p>\n<p>Behind the scenes, the kiosk is running an app that uses a Facial Recognition ML model such as <a href=\"https:\/\/cmusatyalab.github.io\/openface\/\">OpenFace<\/a> to generate a unique fingerprint of the captured face image. The app then performs a <em>similarity match<\/em> between the fingerprint of the captured face image and the fingerprints of images in Couchbase Lite database to identify the closest match.<\/p>\n<h3 id=\"featurewalkthrough\">Feature Walkthrough<\/h3>\n<p>The best way to understand how the API works is through an example. In this post, I am going to describe how you can implement Facial Recognition application discussed above using the Predictive Query API. This is probably the more complicated workflow. The image based search app using classifier model follows a similar pattern except that it is a lot simpler.<\/p>\n<ul>\n<li><strong>Prerequisites<\/strong>\n<ul>\n<li>Face Recognition ML model is available in the app. The ML model could have been bundled with the app or pulled down from an external repository, with techniques similar to <a href=\"https:\/\/developer.apple.com\/documentation\/coreml\/core_ml_api\/downloading_and_compiling_a_model_on_the_user_s_device\">this<\/a>. The model takes in an image and outputs a \u201cfingerprint\u201d or \u201cface embedding\u201d, which is essentially a vector representation image features.<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/12\/facemodel.png\" alt=\"Predictive Query API on Couchbase Lite\" \/><\/li>\n<li>Couchbase Lite database is populated with relevant data. In our use case, it would correspond to a registered user database with <em>\u201cuser\u201d<\/em> type documents. Each user document includes a blob corresponding to a photo of registered user.<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/12\/cbl_userdatabase.png\" alt=\"Predictive Query API on Couchbase Lite\" \/><\/li>\n<\/ul>\n<\/li>\n<li><strong>Step 1 : Register the ML model with Cuchbase Lite<\/strong><br \/>\nYou can run predictions using <em>any<\/em> ML model. As an app developer, you will implement the <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/2.6\/swift.html#predictive-query\">PredictiveModel<\/a> interface and <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/swift\/learn\/swift-query-predictive.html#register-the-model\">register<\/a> with Couchbase Lite. This interface is very straightforward and defines a single <a href=\"https:\/\/docs.couchbase.com\/mobile\/2.6.0\/couchbase-lite-swift\/Protocols\/PredictiveModel.html#\/s:18CouchbaseLiteSwift15PredictiveModelP7predict5inputAA16DictionaryObjectCSgAG_tF\">predict()<\/a> method that\u2019s to be implemented by the app developer. Anytime, the <a href=\"https:\/\/docs.couchbase.com\/mobile\/2.6.0\/couchbase-lite-swift\/Classes\/Function.html#\/s:18CouchbaseLiteSwift8FunctionC10prediction5model5inputAA010PredictionD0_pSS_AA18ExpressionProtocol_ptFZ\">Prediction Function<\/a> is invoked on Couchbase Lite, the underlying predict() method in the PredictiveModel is invoked.<\/li>\n<\/ul>\n<figure><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/12\/model_register.png\" alt=\"Predictive Query API on Couchbase Lite\" \/><\/figure>\n<pre class=\"lang:swift decode:true\">\/\/ 1: Register Model \r\nDatabase.prediction.registerModel(mlModel, withName: modelName)<\/pre>\n<ul>\n<li><strong>Step 2 : Create Predictive Index<\/strong><br \/>\nCreate a <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/swift\/learn\/swift-query-predictive.html#predictive-index\">predictive index<\/a> on the images in Couchbase Lite database by running a prediction on all the images using the registered ML model. While this step is optional, it is highly recommended to create the index as it has a significant impact on query time performance<\/li>\n<\/ul>\n<figure><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/12\/predictive_index.png\" alt=\"Predictive Query API on Couchbase Lite\" \/><\/figure>\n<pre class=\"lang:default decode:true \">\/\/ 2: Build prediction index of predictions on images in database \r\nlet index = IndexBuilder.predictiveIndex(model: modelName, input: imagePropertyInDB) db.createIndex(index, withName: \"faceIndex\") \r\n\/\/ Generate fingerprint by running predictions on images in database \r\nlet fingerPrintOfImagesInDB = Function.prediction(model: modelName, input: imagePropertyInDB)<\/pre>\n<ul>\n<li><strong>Step 3 : Prediction on captured image<\/strong><br \/>\nRun prediction on image input into the app using <a href=\"https:\/\/docs.couchbase.com\/mobile\/2.6.0\/couchbase-lite-swift\/Classes\/Function.html#\/s:18CouchbaseLiteSwift8FunctionC10prediction5model5inputAA010PredictionD0_pSS_AA18ExpressionProtocol_ptFZ\">Prediction Function<\/a><\/li>\n<\/ul>\n<figure><img decoding=\"async\" class=\"\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/12\/prediction-machine-learn.png\" alt=\"Predictive Query API on Couchbase Lite\" \/><\/figure>\n<pre class=\"lang:swift decode:true\">\/\/ 3: Generate fingerprint by running prediction on input image \r\nlet fingerPrintOfInputImage = Function.prediction(model: modelName, input: inputPhoto)<\/pre>\n<ul>\n<li><strong>Step 4 : Similarity Match &amp; User document query<\/strong><br \/>\nRun a similarity match between the captured image and images in the database using one the many <a href=\"https:\/\/docs.couchbase.com\/mobile\/2.6.0\/couchbase-lite-swift\/Classes\/Function.html#\/s:18CouchbaseLiteSwift8FunctionC17euclideanDistance7between3andAA18ExpressionProtocol_pAaG_p_AaG_ptFZ\">distance vector<\/a> functions. Query the Couchbase Lite database for documents with closest match<\/li>\n<\/ul>\n<figure><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/12\/predictive-similarity-match-1.png\" alt=\"Predictive Query API on Couchbase Lite\" \/><\/figure>\n<pre class=\"lang:swift decode:true\">\/\/ 4: Find distance between fingerprints (similarity match of prediction results)\r\nlet distanceBetweenImages = Function.cosineDistance(between: fingerPrintOfInputImage, and: fingerPrintOfImagesInDB) \r\n\r\n\/\/ Query for documents in database with closest match (as measured by distance comparison) \r\nlet query = QueryBuilder.select(SelectResult.all())\r\n                        .from(DataSource.database(db))\r\n                        .orderBy(Ordering.expression(distance).ascending())\r\n                        .limit(Expression.int(1))<\/pre>\n<p>That\u2019s it! In just 4 simple steps, you can use the Predictive Query API to implement a facial recognition application based on data in Couchbase Lite.<\/p>\n<h2 id=\"whatnext\">What Next<\/h2>\n<p>With the new Predictive Functions API, Couhbase continues to showcase thought leadership in the area of mobile and embedded data storage. In this post, we discussed a few applications and walked through an example of how you would leverage the Predictive Query API. Hopefully that\u2019s inspired you to create your own and we can\u2019t wait to see the new features that you will enable in your apps with this capability.<\/p>\n<p>Here are direct links to some helpful resources &#8211;<br \/>\n&#8211; <a href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/2.6\/swift.html#predictive-query\">Predictive Query Documentation<\/a>.<br \/>\nIncludes a step-by-step guide to use the API<br \/>\n&#8211; <a href=\"https:\/\/www.couchbase.com\/downloads?family=mobile\">Couchbase Lite Downloads<\/a><br \/>\nPredictive Query API is available under Enterprise License. Our Enterprise Edition is also free to download and use for development purposes.<br \/>\n&#8211; <a href=\"https:\/\/github.com\/couchbaselabs\/couchbase-lite-predictive-query-examples\">Sample App<\/a><br \/>\nSample app demonstrating use of Predictive API with a Classifier ML model<br \/>\n&#8211; <a href=\"https:\/\/www.couchbase.com\/blog\/category\/couchbase-mobile\/\">Couchbase Mobile blogs<\/a><br \/>\n&#8211; <a href=\"https:\/\/www.couchbase.com\/forums\/\">Couchbase Forums<\/a><\/p>\n<p>If you have questions or feedback, please leave a comment below or feel free to reach out to me via <a href=\"https:\/\/twitter.com\/rajagp\">Twitter<\/a>\u00a0or <a href=\"mailto:priya.rajagopal@couchbase.com\">email me<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Couchbase Lite\u2019s Predictive Query API allows applications to leverage pre-trained, Machine Learning(ML) models to run predictive queries against data in embedded Couchbase Lite database in a convenient, fast and always-available way. These predictions can be combined with predictions made against [&hellip;]<\/p>\n","protected":false},"author":1423,"featured_media":10117,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1811,7667,1810,2389,9409],"tags":[1968,1536,2140,1909],"ppma_author":[8948],"class_list":["post-8051","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-couchbase-lite","category-couchbase-mobile","category-solutions","category-swift","tag-embedded-database","tag-ios","tag-machine-learning","tag-swift"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.8 (Yoast SEO v25.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Make Machine Learning Predictions With Couchbase Lite<\/title>\n<meta name=\"description\" content=\"Introducing the Predictive Query API for running predictive queries against data in in Couchbase Lite, the leading NoSQL mobile database.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Make Machine Learning Predictions With Couchbase Lite\" \/>\n<meta property=\"og:description\" content=\"Introducing the Predictive Query API for running predictive queries against data in in Couchbase Lite, the leading NoSQL mobile database.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-07T09:05:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:08:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/01\/Predictive-Query-Blog-4.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1592\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Priya Rajagopal, Senior Director, Product Management\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rajagp\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Priya Rajagopal, Senior Director, Product Management\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/\"},\"author\":{\"name\":\"Priya Rajagopal, Senior Director, Product Management\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c2da90e57717ee4970c48a87a131ac2c\"},\"headline\":\"Make Machine Learning Predictions With Couchbase Lite\",\"datePublished\":\"2021-01-07T09:05:54+00:00\",\"dateModified\":\"2025-06-14T03:08:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/\"},\"wordCount\":1772,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/01\/Predictive-Query-Blog-4.jpg\",\"keywords\":[\"embedded database\",\"ios\",\"Machine Learning (ML)\",\"swift\"],\"articleSection\":[\".NET\",\"Couchbase Lite\",\"Couchbase Mobile\",\"Solutions\",\"Swift\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/\",\"name\":\"Make Machine Learning Predictions With Couchbase Lite\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/01\/Predictive-Query-Blog-4.jpg\",\"datePublished\":\"2021-01-07T09:05:54+00:00\",\"dateModified\":\"2025-06-14T03:08:50+00:00\",\"description\":\"Introducing the Predictive Query API for running predictive queries against data in in Couchbase Lite, the leading NoSQL mobile database.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/01\/Predictive-Query-Blog-4.jpg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/01\/Predictive-Query-Blog-4.jpg\",\"width\":1592,\"height\":628},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Make Machine Learning Predictions With Couchbase Lite\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c2da90e57717ee4970c48a87a131ac2c\",\"name\":\"Priya Rajagopal, Senior Director, Product Management\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/4b50a54778b979d8c345b036ab138734\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g\",\"caption\":\"Priya Rajagopal, Senior Director, Product Management\"},\"description\":\"Priya Rajagopal is a Senior Director of Product Management at Couchbase responsible for developer platforms for the cloud and the edge. She has been professionally developing software for over 20 years in several technical and product leadership positions, with 10+ years focused on mobile technologies. As a TISPAN IPTV standards delegate, she was a key contributor to the IPTV standards specifications. She has 22 patents in the areas of networking and platform security.\",\"sameAs\":[\"https:\/\/x.com\/rajagp\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/priya-rajagopalcouchbase-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Make Machine Learning Predictions With Couchbase Lite","description":"Introducing the Predictive Query API for running predictive queries against data in in Couchbase Lite, the leading NoSQL mobile database.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/","og_locale":"en_US","og_type":"article","og_title":"Make Machine Learning Predictions With Couchbase Lite","og_description":"Introducing the Predictive Query API for running predictive queries against data in in Couchbase Lite, the leading NoSQL mobile database.","og_url":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-01-07T09:05:54+00:00","article_modified_time":"2025-06-14T03:08:50+00:00","og_image":[{"width":1592,"height":628,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/01\/Predictive-Query-Blog-4.jpg","type":"image\/jpeg"}],"author":"Priya Rajagopal, Senior Director, Product Management","twitter_card":"summary_large_image","twitter_creator":"@rajagp","twitter_misc":{"Written by":"Priya Rajagopal, Senior Director, Product Management","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/"},"author":{"name":"Priya Rajagopal, Senior Director, Product Management","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c2da90e57717ee4970c48a87a131ac2c"},"headline":"Make Machine Learning Predictions With Couchbase Lite","datePublished":"2021-01-07T09:05:54+00:00","dateModified":"2025-06-14T03:08:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/"},"wordCount":1772,"commentCount":1,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/01\/Predictive-Query-Blog-4.jpg","keywords":["embedded database","ios","Machine Learning (ML)","swift"],"articleSection":[".NET","Couchbase Lite","Couchbase Mobile","Solutions","Swift"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/","url":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/","name":"Make Machine Learning Predictions With Couchbase Lite","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/01\/Predictive-Query-Blog-4.jpg","datePublished":"2021-01-07T09:05:54+00:00","dateModified":"2025-06-14T03:08:50+00:00","description":"Introducing the Predictive Query API for running predictive queries against data in in Couchbase Lite, the leading NoSQL mobile database.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/01\/Predictive-Query-Blog-4.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/01\/Predictive-Query-Blog-4.jpg","width":1592,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/machine-learning-predictions-couchbase-lite-predictive-query\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Make Machine Learning Predictions With Couchbase Lite"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c2da90e57717ee4970c48a87a131ac2c","name":"Priya Rajagopal, Senior Director, Product Management","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/4b50a54778b979d8c345b036ab138734","url":"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g","caption":"Priya Rajagopal, Senior Director, Product Management"},"description":"Priya Rajagopal is a Senior Director of Product Management at Couchbase responsible for developer platforms for the cloud and the edge. She has been professionally developing software for over 20 years in several technical and product leadership positions, with 10+ years focused on mobile technologies. As a TISPAN IPTV standards delegate, she was a key contributor to the IPTV standards specifications. She has 22 patents in the areas of networking and platform security.","sameAs":["https:\/\/x.com\/rajagp"],"url":"https:\/\/www.couchbase.com\/blog\/author\/priya-rajagopalcouchbase-com\/"}]}},"authors":[{"term_id":8948,"user_id":1423,"is_guest":0,"slug":"priya-rajagopalcouchbase-com","display_name":"Priya Rajagopal, Senior Director, Product Management","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/acfb2349788955262cd069497a9e7bdb0e97c26326f2e55811e7c1174e9ef1be?s=96&d=mm&r=g","author_category":"","last_name":"Rajagopal, Senior Director, Product Management","first_name":"Priya","job_title":"","user_url":"","description":"Priya Rajagopal is a Senior Director of Product Management at Couchbase responsible for developer platforms for the cloud and the edge. She has been professionally developing software for over 20 years in several technical and product leadership positions, with 10+ years focused on mobile technologies. As a TISPAN IPTV standards delegate, she was a key contributor to the IPTV standards specifications. She has 22 patents in the areas of networking and platform security."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/8051","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/1423"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=8051"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/8051\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/10117"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=8051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=8051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=8051"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=8051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}