{"id":46691,"date":"2022-04-07T00:00:00","date_gmt":"2022-04-07T07:00:00","guid":{"rendered":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/blog\/a-naive-bayes-classifier-using-java-griddb\/"},"modified":"2025-11-13T12:55:52","modified_gmt":"2025-11-13T20:55:52","slug":"a-naive-bayes-classifier-using-java-griddb","status":"publish","type":"post","link":"https:\/\/www.griddb.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/","title":{"rendered":"A Naive Bayes Classifier Using Java &#038; GridDB"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>The Naive Bayes algorithm is a classification technique that is based on the Bayes&#8217; Theorem. It assumes that the predictors are independent of each other. A Naive Bayes classifier assumes that the presence of a certain feature in a class is not related to the presence of any other feature.<\/p>\n<p>For example, the apple fruit is characterized by red color, round shape, and about 3 inches of diameter. Although these features depend on each other, they independently contribute to the probability of the fruit being an apple. That&#8217;s why it&#8217;s called &#8220;Naive&#8221;.<\/p>\n<p>It is an easy model to build and well-applicable to very large datasets. Despite its simplicity, Naive Bayes has outperformed even the most sophisticated classification algorithms.<\/p>\n<p>In this article, we will be discussing how to implement a Naive Bayes classifier using Java and GridDB. The goal will be to predict whether a customer will purchase a product based on day, discount, and free delivery.<\/p>\n<h2>Store the Data in GridDB<\/h2>\n<p>The data has been stored in a CSV file named &#8220;shopping.csv&#8221;. We want to move the data into GridDB and enjoy some of its benefits including improved query performance.<\/p>\n<p>Let&#8217;s import the libraries to be used for this:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">import java.io.File;\nimport java.io.IOException;\nimport java.util.Properties;\nimport java.util.Collection;\nimport java.util.Scanner;\n\n\nimport com.toshiba.mwcloud.gs.Collection;\nimport com.toshiba.mwcloud.gs.GSException;\nimport com.toshiba.mwcloud.gs.GridStore;\nimport com.toshiba.mwcloud.gs.GridStoreFactory;\nimport com.toshiba.mwcloud.gs.Query;\nimport com.toshiba.mwcloud.gs.RowKey;\nimport com.toshiba.mwcloud.gs.RowSet;<\/code><\/pre>\n<\/div>\n<p>Next, we will create a static Java class to represent the GridDB container where the data is to be stored:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">public static class ShoppingData {\n     @RowKey String  day;\n     String discount;\n     String free_delivery;\n     String purchase;\n    } <\/code><\/pre>\n<\/div>\n<p>See above Java class as a SQL table with 4 columns. The 4 variables represents the columns of the GridDB container.<\/p>\n<p>Let&#8217;s now connect to the GridDB container from Java. We will use the credentials of our GridDB installation:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">        Properties props = new Properties();\n        props.setProperty(\"notificationAddress\", \"239.0.0.1\");\n        props.setProperty(\"notificationPort\", \"31999\");\n        props.setProperty(\"clusterName\", \"defaultCluster\");\n        props.setProperty(\"user\", \"admin\");\n        props.setProperty(\"password\", \"admin\");\n        GridStore store = GridStoreFactory.getInstance().getGridStore(props);<\/code><\/pre>\n<\/div>\n<p>The container has the name &#8220;ShoppingData&#8221;. Let&#8217;s select it:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">Collection&lt;String, ShoppingData> coll = store.putCollection(\"col01\", ShoppingData.class);<\/code><\/pre>\n<\/div>\n<p>We will be using the name <code>coll<\/code> to refer to the <code>ShoppingData<\/code> container.<\/p>\n<p>Let&#8217;s now write the <code>shopping.csv<\/code> data into GridDB:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">File file1 = new File(\"shopping.csv\");\n                Scanner sc = new Scanner(file1);\n                String data = sc.next();\n \n                while (sc.hasNext()){\n                        String scData = sc.next();\n                        String dataList[] = scData.split(\",\");\n                        String day = dataList[0];\n                        String discount = dataList[1];\n                        String free_delivery = dataList[2];\n                        String purchase = dataList[3];\n                        \n                                                \n                        \n                        ShoppingData sd = new ShoppingData();\n                        sd.day = day;\n                        sd.discount= discount;\n                        sd.free_delivery = free_delivery;\n                        sd.purchase = purchase;\n                            \n                        \n                        \n                        coll.append(sd);\n                 }<\/code><\/pre>\n<\/div>\n<p>The above code will add the data into the GridDB container.<\/p>\n<h2>Retrieve the Data<\/h2>\n<p>We can now retrieve the data from GridDB and use it to implement a Naive Bayes Classifier. The following code can help us to retrieve the data:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">Query&lt;shoppingdata> query = coll.query(\"select *\");\n                RowSet&lt;\/shoppingdata>&lt;shoppingdata> rs = query.fetch(false);\n            RowSet res = query.fetch();&lt;\/shoppingdata><\/code><\/pre>\n<\/div>\n<p>The <code>select *<\/code> statement helped us to retrieve all the data stored in the container.<\/p>\n<h2>Implement the Naive Bayes Classifier<\/h2>\n<p>Now that we have the data, we can use it to train a machine learning model using the Naive Bayes algorithm. We will use the Weka library. Let&#8217;s first import all the libraries to be used to train the model:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">import weka.core.Instances;\nimport weka.filters.Filter;\nimport java.io.FileReader;\nimport java.io.BufferedReader;\nimport weka.classifiers.Evaluation;\nimport weka.classifiers.Classifier;\nimport weka.core.converters.ArffLoader;\nimport weka.classifiers.bayes.NaiveBayesMultinomial;\nimport weka.filters.unsupervised.attribute.StringToWordVector;<\/code><\/pre>\n<\/div>\n<p>Let&#8217;s create a buffered reader and instances for the dataset:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">BufferedReader bufferedReader\n                = new BufferedReader(\n                    new FileReader(res));\n \n            \/\/ Create dataset instances\n            Instances datasetInstances\n                = new Instances(bufferedReader);<\/code><\/pre>\n<\/div>\n<p>Let&#8217;s now use the multinomial Weka classifier for Naive Bayes to build and evaluate the model:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">datasetInstances.setClassIndex(datasetInstances.numAttributes()-1);\n\nClassifier classifier = new NaiveBayesMultinomial();\n        \n    classifier.buildClassifier(datasetInstances);\n    \n     Evaluation eval = new Evaluation(datasetInstances);\n        eval.evaluateModel(classifier, datasetInstances);\n\n                System.out.println(\"Naive Bayes Classifier Evaluation Summary\");\n        System.out.println(eval.toSummaryString());\n        System.out.print(\" the input data expression as per the alogorithm is \");\n        System.out.println(classifier);<\/code><\/pre>\n<\/div>\n<h2>Make a Prediction<\/h2>\n<p>We did not use the last instance of the dataset to train the model. We want to use it to make a prediction. We will use the <code>classifyInstance()<\/code> function of the Weka library as shown below:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">Instance pred = datasetInstances.lastInstance();\n        double answer = classifier.classifyInstance(pred);\n        System.out.println(answer);<\/code><\/pre>\n<\/div>\n<h2>Compile and Run the Model<\/h2>\n<p>To compile and run the above Naive Bayes classifier, you will need the Weka API. Download it from the following URL:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">http:\/\/www.java2s.com\/Code\/Jar\/w\/weka.htm<\/code><\/pre>\n<\/div>\n<p>Next, login as the <code>gsadm<\/code> user. Move your <code>.java<\/code> file to the <code>bin<\/code> folder of your GridDB located in the following path:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">\/griddb_4.6.0-1_amd64\/usr\/griddb-4.6.0\/bin<\/code><\/pre>\n<\/div>\n<p>Run the following command on your Linux terminal to set the path for the gridstore.jar file:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">export CLASSPATH=$CLASSPATH:\/home\/osboxes\/Downloads\/griddb_4.6.0-1_amd64\/usr\/griddb-4.6.0\/bin\/gridstore.jar<\/code><\/pre>\n<\/div>\n<p>Next, use the following command to compile your <code>.java<\/code> file:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">javac -cp weka-3-7-0\/weka.jar NaiveBayesClassifierExample.java<\/code><\/pre>\n<\/div>\n<p>Run the .class file that is generated by running the following command:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">java -cp .:weka-3-7-0\/weka.jar NaiveBayesClassifierExample<\/code><\/pre>\n<\/div>\n<p>The prediction result shows that the customer will make a purchase.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction The Naive Bayes algorithm is a classification technique that is based on the Bayes&#8217; Theorem. It assumes that the predictors are independent of each other. A Naive Bayes classifier assumes that the presence of a certain feature in a class is not related to the presence of any other feature. For example, the apple [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":28171,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[121],"tags":[],"class_list":["post-46691","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>A Naive Bayes Classifier Using Java &amp; GridDB | GridDB: Open Source Time Series Database for IoT<\/title>\n<meta name=\"description\" content=\"Introduction The Naive Bayes algorithm is a classification technique that is based on the Bayes&#039; Theorem. It assumes that the predictors are independent\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A Naive Bayes Classifier Using Java &amp; GridDB | GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"og:description\" content=\"Introduction The Naive Bayes algorithm is a classification technique that is based on the Bayes&#039; Theorem. It assumes that the predictors are independent\" \/>\n<meta property=\"og:url\" content=\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/\" \/>\n<meta property=\"og:site_name\" content=\"GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/griddbcommunity\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-07T07:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-13T20:55:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.griddb.net\/wp-content\/uploads\/2022\/03\/naive.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1160\" \/>\n\t<meta property=\"og:image:height\" content=\"653\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"griddb-admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:site\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"griddb-admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/\"},\"author\":{\"name\":\"griddb-admin\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\"},\"headline\":\"A Naive Bayes Classifier Using Java &#038; GridDB\",\"datePublished\":\"2022-04-07T07:00:00+00:00\",\"dateModified\":\"2025-11-13T20:55:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/\"},\"wordCount\":557,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2022\/03\/naive.png\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/\",\"url\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/\",\"name\":\"A Naive Bayes Classifier Using Java & GridDB | GridDB: Open Source Time Series Database for IoT\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2022\/03\/naive.png\",\"datePublished\":\"2022-04-07T07:00:00+00:00\",\"dateModified\":\"2025-11-13T20:55:52+00:00\",\"description\":\"Introduction The Naive Bayes algorithm is a classification technique that is based on the Bayes' Theorem. It assumes that the predictors are independent\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/#primaryimage\",\"url\":\"\/wp-content\/uploads\/2022\/03\/naive.png\",\"contentUrl\":\"\/wp-content\/uploads\/2022\/03\/naive.png\",\"width\":1160,\"height\":653},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/griddb.net\/en\/#website\",\"url\":\"https:\/\/griddb.net\/en\/\",\"name\":\"GridDB: Open Source Time Series Database for IoT\",\"description\":\"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL\",\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/griddb.net\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/griddb.net\/en\/#organization\",\"name\":\"Fixstars\",\"url\":\"https:\/\/griddb.net\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"contentUrl\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"width\":200,\"height\":83,\"caption\":\"Fixstars\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/griddbcommunity\/\",\"https:\/\/x.com\/GridDBCommunity\",\"https:\/\/www.linkedin.com\/company\/griddb-by-toshiba\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\",\"name\":\"griddb-admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g\",\"caption\":\"griddb-admin\"},\"url\":\"https:\/\/www.griddb.net\/en\/author\/griddb-admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"A Naive Bayes Classifier Using Java & GridDB | GridDB: Open Source Time Series Database for IoT","description":"Introduction The Naive Bayes algorithm is a classification technique that is based on the Bayes' Theorem. It assumes that the predictors are independent","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:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/","og_locale":"en_US","og_type":"article","og_title":"A Naive Bayes Classifier Using Java & GridDB | GridDB: Open Source Time Series Database for IoT","og_description":"Introduction The Naive Bayes algorithm is a classification technique that is based on the Bayes' Theorem. It assumes that the predictors are independent","og_url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/","og_site_name":"GridDB: Open Source Time Series Database for IoT","article_publisher":"https:\/\/www.facebook.com\/griddbcommunity\/","article_published_time":"2022-04-07T07:00:00+00:00","article_modified_time":"2025-11-13T20:55:52+00:00","og_image":[{"width":1160,"height":653,"url":"https:\/\/www.griddb.net\/wp-content\/uploads\/2022\/03\/naive.png","type":"image\/png"}],"author":"griddb-admin","twitter_card":"summary_large_image","twitter_creator":"@GridDBCommunity","twitter_site":"@GridDBCommunity","twitter_misc":{"Written by":"griddb-admin","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/#article","isPartOf":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/"},"author":{"name":"griddb-admin","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233"},"headline":"A Naive Bayes Classifier Using Java &#038; GridDB","datePublished":"2022-04-07T07:00:00+00:00","dateModified":"2025-11-13T20:55:52+00:00","mainEntityOfPage":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/"},"wordCount":557,"commentCount":0,"publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"image":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2022\/03\/naive.png","articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/","url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/","name":"A Naive Bayes Classifier Using Java & GridDB | GridDB: Open Source Time Series Database for IoT","isPartOf":{"@id":"https:\/\/griddb.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/#primaryimage"},"image":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2022\/03\/naive.png","datePublished":"2022-04-07T07:00:00+00:00","dateModified":"2025-11-13T20:55:52+00:00","description":"Introduction The Naive Bayes algorithm is a classification technique that is based on the Bayes' Theorem. It assumes that the predictors are independent","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/a-naive-bayes-classifier-using-java-griddb\/#primaryimage","url":"\/wp-content\/uploads\/2022\/03\/naive.png","contentUrl":"\/wp-content\/uploads\/2022\/03\/naive.png","width":1160,"height":653},{"@type":"WebSite","@id":"https:\/\/griddb.net\/en\/#website","url":"https:\/\/griddb.net\/en\/","name":"GridDB: Open Source Time Series Database for IoT","description":"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL","publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/griddb.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/griddb.net\/en\/#organization","name":"Fixstars","url":"https:\/\/griddb.net\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/","url":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","contentUrl":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","width":200,"height":83,"caption":"Fixstars"},"image":{"@id":"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/griddbcommunity\/","https:\/\/x.com\/GridDBCommunity","https:\/\/www.linkedin.com\/company\/griddb-by-toshiba"]},{"@type":"Person","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233","name":"griddb-admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g","caption":"griddb-admin"},"url":"https:\/\/www.griddb.net\/en\/author\/griddb-admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46691","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/comments?post=46691"}],"version-history":[{"count":1,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46691\/revisions"}],"predecessor-version":[{"id":51365,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46691\/revisions\/51365"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/media\/28171"}],"wp:attachment":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/media?parent=46691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/categories?post=46691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/tags?post=46691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}