{"id":12630,"date":"2021-12-23T08:01:18","date_gmt":"2021-12-23T16:01:18","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=12630"},"modified":"2024-08-30T03:03:43","modified_gmt":"2024-08-30T10:03:43","slug":"how-couchbase-simplifies-data-science-part-2","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/","title":{"rendered":"How Couchbase Simplifies Data Science (Part 2)"},"content":{"rendered":"<p><em>This blog is co-authored by Karen Yuan, a High School Intern<\/em><\/p>\n<p>In our <a href=\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-1\/\">previous article,<\/a> we learned to do exploratory data analysis using the Couchbase Query service. We also learned to efficiently read training data with the Query APIs in the Couchbase Python SDK and seamlessly save it to a pandas dataframe suitable for machine learning (ML). And finally, we stored ML models and their metadata in Couchbase. In this article, we will learn how to make predictions, store them in Couchbase and use the Query charts to analyze them.<\/p>\n<h4>Real-Time Prediction<\/h4>\n<p>The data scientist uses the trained model to generate predictions.<\/p>\n<p>We will use the prediction flow in Figure 1 to predict the churn score in real-time and store the prediction in Couchbase. We will use the churn prediction model we trained in the previous article.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12631 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-22-at-12.38.55-PM.png\" alt=\"Real Time Prediction Flow\" width=\"701\" height=\"238\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/Screen-Shot-2021-12-22-at-12.38.55-PM.png 701w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/Screen-Shot-2021-12-22-at-12.38.55-PM-300x102.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/Screen-Shot-2021-12-22-at-12.38.55-PM-20x7.png 20w\" sizes=\"auto, (max-width: 701px) 100vw, 701px\" \/><\/p>\n<p><strong>Function to read model and its metadata stored on Couchbase:<\/strong><\/p>\n<pre>def read_model_from_couchbase(model_id):\r\n\u00a0 \u00a0 \u00a0bucket = cluster.bucket('model_repository')\r\n\u00a0 \u00a0 \u00a0model_bytes = bucket.get(model_id).value\r\n\u00a0 \u00a0 \u00a0model = pickle.loads(model_bytes)\r\n\u00a0 \u00a0 \u00a0key = model_id + \"_metadata\"\r\n\u00a0 \u00a0 \u00a0feature_names = bucket.get(key).value['feature_names']\r\n\u00a0 \u00a0 \u00a0return {'model': model, 'feature_names': set(feature_names)}<\/pre>\n<p><strong>Function to read customer data stored on Couchbase:<\/strong><\/p>\n<pre class=\"\"># We will use the Query interface in the Couchbase Python SDK to get multiple customer\r\n# records that satisfy a condition. Alternatively, the GET interface in the Couchbase Python SDK can \r\n# be used to get individual customer records e.g. bucket.get(customer_key).value\r\ndef read_data_from_couchbase(select_clause = \"\", where_clause = \"\"):\r\n     if select_clause:\r\n        query_statement = \"SELECT customer.*, \" + select_clause \r\n     else:\r\n        query_statement = \"SELECT customer.*\"\r\n\r\n     query_statement = query_statement + \" FROM `online_streaming` as customer\"\r\n\r\n     if where_clause:\r\n        query_statement = query_statement + \" WHERE \" + where_clause\r\n     # Use the Query API to get customer records\r\n     query_result = cb.query(query_statement)\r\n     return pd.DataFrame.from_dict(list(query_result))<\/pre>\n<p>The following <em>predict<\/em> function reads the model, its metadata and customer records using the above functions. It converts the customer data into features using the same process as the one used during training (i.e., one-hot encoding). It then predicts the churn score by running the model on the features.<\/p>\n<pre class=\"\">def predict(model_id, select_clause = \"\", where_clause = \"\"):\r\n     # Step 1: Read the model and its metadata from Couchbase\r\n     rv = read_model_from_couchbase(model_id)\r\n     model = rv['model']\r\n     feature_names = rv['feature_names']\r\n\r\n     # Step 2: Read customer records from Couchbase\r\n     df = read_data_from_couchbase(select_clause, where_clause)\r\n     customer_prediction = df\r\n\r\n     # Step 3: Convert the raw data into features expected by the model\r\n     df = pd.get_dummies(df)\r\n     drop_cols = set(list(df.columns)) - feature_names\r\n     df.drop(drop_cols, axis = 1, inplace = True)\r\n     df = df.reindex(columns=feature_names, fill_value=0)\r\n     # Step 4: Predict\r\n     prediction = model.predict(df)\r\n     customer_prediction['Churn Prediction'] = prediction\r\n     return customer_prediction\r\n<\/pre>\n<pre class=\"\"># Example: Predict churn for a customer with given ID \r\nprediction = predict('churn_predictor_model_v1', where_clause = \"customer.CustomerID = 100002\")[['CustomerID', 'Churn Prediction']] \r\nprediction<\/pre>\n<p>Churn prediction for <em>customerID 100002<\/em> is 1. This indicates that they are likely to leave the streaming service.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12632 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/12\/churn-prediction.png\" alt=\"churn prediction\" width=\"232\" height=\"45\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/churn-prediction.png 232w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/churn-prediction-20x4.png 20w\" sizes=\"auto, (max-width: 232px) 100vw, 232px\" \/><\/p>\n<p>The prediction is saved in a Couchbase bucket called predictions using the code shown below. Create the predictions bucket on your Couchbase cluster before proceeding.<\/p>\n<pre class=\"\">bucket = cluster.bucket('predictions')\r\nto_save = prediction.to_dict(orient=\"records\")[0]\r\nkey = str(prediction.iloc[0]['CustomerID'])\r\nbucket.upsert(key, to_save)<\/pre>\n<p>Verify that the prediction was successfully saved in Couchbase.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12633 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/12\/successful-prediction.png\" alt=\"\" width=\"453\" height=\"94\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/successful-prediction.png 453w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/successful-prediction-300x62.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/successful-prediction-450x94.png 450w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/successful-prediction-20x4.png 20w\" sizes=\"auto, (max-width: 453px) 100vw, 453px\" \/><\/p>\n<p>You can also run the trained model and generate predictions in Couchbase Analytics using the Python UDF feature (currently in developer preview). Refer to the article on <a href=\"https:\/\/www.couchbase.com\/blog\/ml-meets-nosql-integrating-python-user-defined-functions-with-n1ql-for-analytics\/\">running ML models using Couchbase Analytics Python UDF<\/a> for more information.<\/p>\n<h4>What-if Analysis<\/h4>\n<p>The data scientist will analyze the predictions to answer questions that help make decisions.<\/p>\n<p>The problem we defined in the previous article was a sales team at the online streaming service company wanting to know whether increasing the monthly cost will maximize the revenue while keeping the customer churn in check.<\/p>\n<p>To answer this, we will use the code below to predict the churn scores when the monthly costs are increased by $1, $2, etc. Results of this analysis will be stored in the predictions bucket.<br \/>\nUsing the Couchbase cluster UI, create a scope called <em>what_if_analysis<\/em> and collection called <em>increase_monthly_cost<\/em> in the predictions bucket. (Scopes and collections are available in Couchbase Server 7.0 and later)<\/p>\n<pre class=\"\"># Connect to predictions bucket on Couchbase and relevant scope and collection\r\nbucket = cluster.bucket('predictions')\r\nwa_scope = bucket.scope(\"what_if_analysis\")\r\nwa_collection = wa_scope.collection(\"increase_monthly_cost\")\r\n# Predict the churn rate if the monthly cost of existing customers is increased by \r\n# $1, $2 .. $5\r\nfor increase_by in range (1, 6):\r\n      # where_cluase is set to customer.Churn = 0 because we are interested \r\n      # only in existing customers\r\n      # The following select_clause will update the MonthlyCost as shown while returning the\r\n      # query result. In each iteration of this loop the MonthlyCost will increase by $1, $2 ...\r\n      select_clause = \"customer.`MonthlyCost` + \" + str(increase_by) + \" as `MonthlyCost`\"\r\n      # The updated MonthlyCost is passed as input along with other attributes to the prediction\r\n      # function. The output tells which of the existing customers are likely to\r\n      # to churn if the MonthlyCost is increased by the specified amount. \r\n      rv = predict('churn_predictor_model_v1', select_clause = select_clause, where_clause = \"customer.Churn = 0\")\r\n      # Monthly revenues are predicted by adding the monthly cost of the customers not likely to churn.\r\n      rv['Predicted Monthly Revenue'] = (1 - rv['Churn Prediction']) * rv['MonthlyCost']\r\n      predicted_churn_rate = rv['Churn Prediction'].value_counts(normalize=True).mul(100)[1]\r\n      # Save predictions to Couchbase.\r\n      to_save = {'Monthly Cost Increase ($)': increase_by, \r\n      'Predicted Monthly Revenue': rv['Predicted Monthly Revenue'].sum(),\r\n      'Predicted Churn Rate': predicted_churn_rate}\r\n       key = \"increase_by_$\" + str(increase_by)\r\n       wa_collection.upsert(key, to_save)\r\n\r\n# Use the Query API to calculate current revenue. Store it also on the predictions bucket. This is \r\n# used for comparison\r\ncurrent = cb.query('SELECT sum(customer.`MonthlyCost`) as CurrentRevenue FROM `online_streaming` customer where customer.Churn = 0')\r\nto_save = {'Monthly Cost Increase ($)': 0, 'Predicted Monthly Revenue': list(current)[0]['CurrentRevenue'], 'Predicted Churn Rate': 0}\r\nwa_collection.upsert(\"current\", to_save)<\/pre>\n<p>To analyze the prediction results using Couchbase Query, create a primary index on the <em>what_if_analysis<\/em> scope as shown in the Query UI below. Note that the query context should be set as shown.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12634 size-large\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/12\/query-editor-1024x215.png\" alt=\"query editor\" width=\"900\" height=\"189\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/query-editor-1024x215.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/query-editor-300x63.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/query-editor-768x161.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/query-editor-20x4.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/query-editor.png 1087w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><br \/>\nQuery charts can be used to analyze the prediction results. The chart below shows that ~7% of existing customers are predicted to churn if their monthly cost is increased by $1, ~10% will likely churn if the monthly cost is increased by $2, etc.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12635 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/12\/querychart.png\" alt=\"query chart\" width=\"998\" height=\"520\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/querychart.png 998w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/querychart-300x156.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/querychart-768x400.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/querychart-20x10.png 20w\" sizes=\"auto, (max-width: 998px) 100vw, 998px\" \/><\/p>\n<p>The chart below shows that the current monthly revenue is $3.15 million. This revenue is predicted to increase by ~$50K if the monthly subscription cost of existing customers is increased by $1 and by ~$230k if the monthly cost is increased by $2. But the revenue is predicted to dip if the monthly cost is increased by $3 or more because of the higher predicted churn rate.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12636 size-full\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/12\/querychart2.png\" alt=\"querychart2\" width=\"916\" height=\"420\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/querychart2.png 916w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/querychart2-300x138.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/querychart2-768x352.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/querychart2-20x9.png 20w\" sizes=\"auto, (max-width: 916px) 100vw, 916px\" \/><br \/>\nUsing this analysis, we can conclude that the sales team at the online streaming service company can increase the monthly subscription cost by $2 to maximize the revenue while keeping the churn rate in check.<\/p>\n<p>The &#8220;Download chart&#8221; option in the Query UI can be used to save the charts.<\/p>\n<h4>Couchbase Analytics Service<\/h4>\n<p>We used the Couchbase Query API in the Python SDK to read data from Couchbase. If you want to use the Couchbase Analytics API instead, then here is an example to read the data from Couchbase and store it in a pandas dataframe.<\/p>\n<pre class=\"\">analytics_result = cb.analytics_query(\"SELECT customer.* FROM online_streaming customer\")\r\nanalytics_raw_data = pd.DataFrame(analytics_result)<\/pre>\n<p><span style=\"font-weight: 400;\">The Couchbase Analytics service can also be used for EDA, data visualization and to run trained ML models (developer preview). Refer to the <\/span><a href=\"https:\/\/docs.couchbase.com\/server\/current\/analytics\/introduction.html\"><span style=\"font-weight: 400;\">N1QL for Analytics Language Reference<\/span><\/a><span style=\"font-weight: 400;\"> and the article on <\/span><a href=\"https:\/\/www.couchbase.com\/blog\/ml-meets-nosql-integrating-python-user-defined-functions-with-n1ql-for-analytics\/\"><span style=\"font-weight: 400;\">running ML models using Couchbase Analytics Python UDF<\/span><\/a><span style=\"font-weight: 400;\"> for more information.<\/span><\/p>\n<h4>Conclusion<\/h4>\n<p>In this and the previous article, we learned how Couchbase makes data science easy. Using customer churn prediction as an example, we saw how to perform exploratory analysis using the Query service, how to efficiently read big training datasets using the Python SDK and easily store it in a data structure suitable for ML.<\/p>\n<p>We also saw how to store ML models, their metadata and predictions in Couchbase and how to use the Query charts for analyzing predictions.<\/p>\n<p>The Couchbase Data Platform can be used to store raw data, features, ML models, their metadata and predictions on the same cluster as the one running Query and Analytics services. This makes the process fast and easy by reducing the number of tools needed for data science.<\/p>\n<h4><span style=\"font-weight: 400;\">Next Steps<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">If you\u2019re interested in learning more about machine learning and Couchbase, here are some great next steps and resources to get you started:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/www.couchbase.com\/products\/capella\/\"><span style=\"font-weight: 400;\">Start your free trial of Couchbase Cloud<\/span><\/a><span style=\"font-weight: 400;\"> \u2013 no installation required.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/resources.couchbase.com\/c\/server-arc-overview?x=V3nd_e&amp;ref=blog\"><span style=\"font-weight: 400;\">Couchbase Under the Hood: An Architectural Overview<\/span><\/a><span style=\"font-weight: 400;\"> \u2013 dive deeper into the technical details with this white paper.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Explore the Couchbase <\/span><a href=\"https:\/\/www.couchbase.com\/products\/n1ql\/?ref=blog\"><span style=\"font-weight: 400;\">Query<\/span><\/a><span style=\"font-weight: 400;\">, <\/span><a href=\"https:\/\/www.couchbase.com\/products\/full-text-search\/?ref=blog\"><span style=\"font-weight: 400;\">Full-Text Search<\/span><\/a><span style=\"font-weight: 400;\">, <\/span><a href=\"https:\/\/www.couchbase.com\/products\/eventing\/?ref=blog\"><span style=\"font-weight: 400;\">Eventing<\/span><\/a><span style=\"font-weight: 400;\">, and <\/span><a href=\"https:\/\/www.couchbase.com\/products\/analytics\/?ref=blog\"><span style=\"font-weight: 400;\">Analytics<\/span><\/a><span style=\"font-weight: 400;\"> services.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Check out these ML blogs:\u00a0<\/span>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><a href=\"https:\/\/www.couchbase.com\/blog\/5-use-cases-for-prediction-serving-systems-with-couchbase\/?ref=blog\"><span style=\"font-weight: 400;\">Five use cases for using Couchbase with your real-time prediction serving system<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><a href=\"https:\/\/www.couchbase.com\/blog\/couchbase-machine-learning-model-store\/\"><span style=\"font-weight: 400;\">How to use Couchbase as a machine learning model store<\/span><\/a><span style=\"font-weight: 400;\">\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><a href=\"https:\/\/www.couchbase.com\/blog\/ml-meets-nosql-integrating-python-user-defined-functions-with-n1ql-for-analytics\/\"><span style=\"font-weight: 400;\">Running ML models using Couchbase Analytics Python UDF<\/span><\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This blog is co-authored by Karen Yuan, a High School Intern In our previous article, we learned to do exploratory data analysis using the Couchbase Query service. We also learned to efficiently read training data with the Query APIs in [&hellip;]<\/p>\n","protected":false},"author":77870,"featured_media":12637,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1816],"tags":[],"ppma_author":[9310],"class_list":["post-12630","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-couchbase-server"],"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>How Couchbase Simplifies Data Science (Part 2) - The Couchbase Blog<\/title>\n<meta name=\"description\" content=\"Run data science predictions on data stored in Couchbase using query, analytics, and charting features using churn analysis as an example.\" \/>\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\/how-couchbase-simplifies-data-science-part-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How Couchbase Simplifies Data Science (Part 2)\" \/>\n<meta property=\"og:description\" content=\"Run data science predictions on data stored in Couchbase using query, analytics, and charting features using churn analysis as an example.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-23T16:01:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-30T10:03:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/mimi-thian-5ZnS3wK6sUg-unsplash-scaled.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1920\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Poonam Dhavale, Principal Software Engineer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Poonam Dhavale, Principal Software Engineer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/\"},\"author\":{\"name\":\"Poonam Dhavale, Principal Software Engineer\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/f9b85919fd77b1ea51f7fd68a8be03fc\"},\"headline\":\"How Couchbase Simplifies Data Science (Part 2)\",\"datePublished\":\"2021-12-23T16:01:18+00:00\",\"dateModified\":\"2024-08-30T10:03:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/\"},\"wordCount\":917,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/mimi-thian-5ZnS3wK6sUg-unsplash-scaled.jpg\",\"articleSection\":[\"Couchbase Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/\",\"name\":\"How Couchbase Simplifies Data Science (Part 2) - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/mimi-thian-5ZnS3wK6sUg-unsplash-scaled.jpg\",\"datePublished\":\"2021-12-23T16:01:18+00:00\",\"dateModified\":\"2024-08-30T10:03:43+00:00\",\"description\":\"Run data science predictions on data stored in Couchbase using query, analytics, and charting features using churn analysis as an example.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/mimi-thian-5ZnS3wK6sUg-unsplash-scaled.jpg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/mimi-thian-5ZnS3wK6sUg-unsplash-scaled.jpg\",\"width\":2560,\"height\":1920},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How Couchbase Simplifies Data Science (Part 2)\"}]},{\"@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\/f9b85919fd77b1ea51f7fd68a8be03fc\",\"name\":\"Poonam Dhavale, Principal Software Engineer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/2055ba12b300559d639fe9ab89303c2b\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/07\/poonam-dhavale-couchbase.jpeg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/07\/poonam-dhavale-couchbase.jpeg\",\"caption\":\"Poonam Dhavale, Principal Software Engineer\"},\"description\":\"Poonam Dhavale is a Principal Software Engineer at Couchbase. She has over 20 years of experience in design and development of distributed systems, NoSQL, high availability, and storage technologies. She holds multiple patents in distributed storage systems and holds certifications in machine learning and data science.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/poonam-dhavale\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How Couchbase Simplifies Data Science (Part 2) - The Couchbase Blog","description":"Run data science predictions on data stored in Couchbase using query, analytics, and charting features using churn analysis as an example.","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\/how-couchbase-simplifies-data-science-part-2\/","og_locale":"en_US","og_type":"article","og_title":"How Couchbase Simplifies Data Science (Part 2)","og_description":"Run data science predictions on data stored in Couchbase using query, analytics, and charting features using churn analysis as an example.","og_url":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-12-23T16:01:18+00:00","article_modified_time":"2024-08-30T10:03:43+00:00","og_image":[{"width":2560,"height":1920,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/mimi-thian-5ZnS3wK6sUg-unsplash-scaled.jpg","type":"image\/jpeg"}],"author":"Poonam Dhavale, Principal Software Engineer","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Poonam Dhavale, Principal Software Engineer","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/"},"author":{"name":"Poonam Dhavale, Principal Software Engineer","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/f9b85919fd77b1ea51f7fd68a8be03fc"},"headline":"How Couchbase Simplifies Data Science (Part 2)","datePublished":"2021-12-23T16:01:18+00:00","dateModified":"2024-08-30T10:03:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/"},"wordCount":917,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/mimi-thian-5ZnS3wK6sUg-unsplash-scaled.jpg","articleSection":["Couchbase Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/","url":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/","name":"How Couchbase Simplifies Data Science (Part 2) - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/mimi-thian-5ZnS3wK6sUg-unsplash-scaled.jpg","datePublished":"2021-12-23T16:01:18+00:00","dateModified":"2024-08-30T10:03:43+00:00","description":"Run data science predictions on data stored in Couchbase using query, analytics, and charting features using churn analysis as an example.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/mimi-thian-5ZnS3wK6sUg-unsplash-scaled.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/12\/mimi-thian-5ZnS3wK6sUg-unsplash-scaled.jpg","width":2560,"height":1920},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/how-couchbase-simplifies-data-science-part-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How Couchbase Simplifies Data Science (Part 2)"}]},{"@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\/f9b85919fd77b1ea51f7fd68a8be03fc","name":"Poonam Dhavale, Principal Software Engineer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/2055ba12b300559d639fe9ab89303c2b","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/07\/poonam-dhavale-couchbase.jpeg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/07\/poonam-dhavale-couchbase.jpeg","caption":"Poonam Dhavale, Principal Software Engineer"},"description":"Poonam Dhavale is a Principal Software Engineer at Couchbase. She has over 20 years of experience in design and development of distributed systems, NoSQL, high availability, and storage technologies. She holds multiple patents in distributed storage systems and holds certifications in machine learning and data science.","url":"https:\/\/www.couchbase.com\/blog\/author\/poonam-dhavale\/"}]}},"authors":[{"term_id":9310,"user_id":77870,"is_guest":0,"slug":"poonam-dhavale","display_name":"Poonam Dhavale, Principal Software Engineer","avatar_url":{"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/07\/poonam-dhavale-couchbase.jpeg","url2x":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/07\/poonam-dhavale-couchbase.jpeg"},"author_category":"","last_name":"Dhavale","first_name":"Poonam","job_title":"","user_url":"","description":"Poonam Dhavale is a Principal Software Engineer at Couchbase. She has over 20 years of experience in design and development of distributed systems, NoSQL, high availability, and storage technologies. She holds multiple patents in distributed storage systems and holds certifications in machine learning and data science."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/12630","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\/77870"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=12630"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/12630\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/12637"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=12630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=12630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=12630"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=12630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}