{"id":46631,"date":"2021-02-09T00:00:00","date_gmt":"2021-02-09T08:00:00","guid":{"rendered":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/blog\/create-a-machine-learning-model-using-griddb\/"},"modified":"2025-11-13T12:55:11","modified_gmt":"2025-11-13T20:55:11","slug":"create-a-machine-learning-model-using-griddb","status":"publish","type":"post","link":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/","title":{"rendered":"Create A Machine Learning Model using GridDB"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>In this tutorial, we will build a trivial linear regression model with the data stored in GridDB. We will begin with GridDB\u00e2\u20ac\u2122s python-connector to insert and access the data. Afterwards, we will see how to retrieve and convert the data using pandas and numpy. In the end, we will train and visualize our regression model using scikit-learn and matplotlib. <\/p>\n<p><a href=\"#source-code\"> FULL SOURCE CODE <\/a><\/p>\n<h2>Prerequisites and Environment Setup<\/h2>\n<p>The following tutorial is carried out on Ubuntu Operating system (v. 18.04) with gcc version 7.5.0. GridDB (v. 4.5.2) has been installed using their <a href=\"https:\/\/github.com\/griddb\/griddb\">documentation<\/a> available on Github.<\/p>\n<p>To enable the python connector for GridDB, prerequisites include <a href=\"https:\/\/github.com\/griddb\/c_client\">GridDB C-client<\/a>, <a href=\"https:\/\/github.com\/griddb\/python_client#preparations\">SWIG<\/a> and pcre. A detailed guide can be found <a href=\"https:\/\/griddb.net\/en\/blog\/python-client\/\">here<\/a>.<\/p>\n<p>Set the necessary paths<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">export CPATH=$CPATH:&lt;Python header file directory path&gt;\nexport LIBRARY_PATH=$LIBRARY_PATH:&lt;C client library file directory path&gt;\nexport PYTHONPATH=$PYTHONPATH:&lt;installed directory path&gt;<\/code><\/pre>\n<\/div>\n<p>Run the make command within the python-client directory. Install the necessary libraries.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">$ pip3 install numpy\n$ pip3 install pandas\n$ pip3 install matplotlib<\/code><\/pre>\n<\/div>\n<p>Run the following command within the python console to verify the installation<\/p>\n<p><code>import griddb_python<\/code><\/p>\n<p>Alternatively, you could execute one of the sample programs present in the \/python-client\/sample\/ directory. <\/p>\n<p><code>python3 sample1.py &lt;GridDB notification address&gt; &lt;GridDB notification port&gt; &lt;GridDB cluster name&gt; &lt;GridDB user&gt; &lt;GridDB password&gt;<\/code><\/p>\n<pre>\u00e2\u2020\u2019 Person: name=name02 status=False count=2 lob=[65, 66, 67, 68, 69, 70, 71, 72, 73, 74]<\/pre>\n<p>Note: You could run the aforementioned commands using just python and pip if your default Python version is already set to Python3. Ubuntu comes with a Python 2 default installation, therefore, we have explicitly mentioned python3 and pip3 while executing.<\/p>\n<h2>Accessing and retrieving data from GridDB<\/h2>\n<p>We would be using the publicly available <a href=\"https:\/\/www.kaggle.com\/sohier\/calcofi\">CalCOFI dataset<\/a> for this tutorial. It contains the time series data of oceanographic and larval fish in the world. The CalCOFI data has been inserted into the GridDB using the following command:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">import griddb_python as griddb\nimport pandas as pd\n\nfactory = griddb.StoreFactory.get_instance()\n\n# Initialize container\ntry:\n    gridstore = factory.get_store(host=your_host, port=ypur_port, \n            cluster_name=your_cluster_name, username=your_username, \n            password=your_password)\n\n    conInfo = griddb.ContainerInfo(\"Ocean_Data\",\n                    [[\"id\", griddb.Type.INTEGER],[\"T_degC\",griddb.Type.FLOAT],\n                    [\"Salnty\", griddb.Type.FLOAT]],\n                    griddb.ContainerType.COLLECTION, True)\n    cont = gridstore.put_container(conInfo)   \n    cont.create_index(\"id\", griddb.IndexType.DEFAULT)\n    data = pd.read_csv(\"bottle.csv\")\n    #Add data\n    for i in range(len(data)):\n        ret = cont.put(data.iloc[i, :])\n    print(\"Data added successfully\")\n\nexcept griddb.GSException as e:\n    for i in range(e.get_error_stack_size()):\n        print(\"[\", i, \"]\")\n        print(e.get_error_code(i))\n        print(e.get_location(i))\n        print(e.get_message(i))\n\nAfter the data insertion is successful, we can now access the data using SQL queries. \n\nsql_statement = ('SELECT * FROM Ocean_Data')\nsql_query = pd.read_sql_query(sql_statement, cont)<\/code><\/pre>\n<\/div>\n<p>The read_sql_query function offered by the pandas library converts the data fetched into a panda data frame to make it easy for the user to work.<\/p>\n<pre><code class=\"language-sh\">sql_query.info()\n&lt;class 'pandas.core.frame.DataFrame'&gt;<\/code><\/pre>\n<h2>Linear Regression Model using CalCOFI Dataset<\/h2>\n<p>Due to the size of the CalCOFI dataset and for the sake of simplicity, we will be using the first 500 instances of this data to build a simple linear regression model.<\/p>\n<p>The dataset contains 74 attributes or columns but for this tutorial, we would be using only 2 &#8211;  Salinity and Temperature.<br \/>\nLet\u00e2\u20ac\u2122s import all the necessary libraries<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">import numpy as np\nimport pandas as pd\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LinearRegression\nimport matplotlib.pyplot as plt<\/code><\/pre>\n<\/div>\n<p>We will now load our dataset. Make sure you keep the python file and the dataset within the same directory. Alternatively, supply the whole path of the csv file.<br \/>\ndataset = pd.read_csv(&#8220;bottle.csv&#8221;)<\/p>\n<p>It is always a good idea to take a look at your dataset and get a gist of what you would be dealing with.<\/p>\n<p><code>dataset.head()<\/code><\/p>\n<p>Here\u00e2\u20ac\u2122s the output:<\/p>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/02\/1.png\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/02\/1.png\" alt=\"\" width=\"1377\" height=\"173\" class=\"aligncenter size-full wp-image-27270\" srcset=\"\/wp-content\/uploads\/2021\/02\/1.png 1377w, \/wp-content\/uploads\/2021\/02\/1-300x38.png 300w, \/wp-content\/uploads\/2021\/02\/1-1024x129.png 1024w, \/wp-content\/uploads\/2021\/02\/1-768x96.png 768w, \/wp-content\/uploads\/2021\/02\/1-600x75.png 600w\" sizes=\"(max-width: 1377px) 100vw, 1377px\" \/><\/a><\/p>\n<p>To get the dimensions:<\/p>\n<pre><code class=\"language-python\">dataset.shape\nOut []: (499, 74)<\/code><\/pre>\n<p>To get a deeper insight, let us describe our dataset<\/p>\n<p><code>dataset.describe()<\/code><\/p>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/02\/2.png\"><img decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/02\/2.png\" alt=\"\" width=\"1381\" height=\"294\" class=\"aligncenter size-full wp-image-27271\" srcset=\"\/wp-content\/uploads\/2021\/02\/2.png 1381w, \/wp-content\/uploads\/2021\/02\/2-300x64.png 300w, \/wp-content\/uploads\/2021\/02\/2-1024x218.png 1024w, \/wp-content\/uploads\/2021\/02\/2-768x163.png 768w, \/wp-content\/uploads\/2021\/02\/2-600x128.png 600w\" sizes=\"(max-width: 1381px) 100vw, 1381px\" \/><\/a><\/p>\n<p>As mentioned above, we would only be using 2 attributes, so there is no need to keep the other attributes for this regression model.<\/p>\n<pre><code class=\"language-python\">dataset=dataset[[\"Salnty\",\"T_degC\"]]\ndataset.head()<\/code><\/pre>\n<p>Now our dataset displays only 2 attributes as expected.<\/p>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/02\/3.png\"><img decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/02\/3.png\" alt=\"\" width=\"153\" height=\"179\" class=\"aligncenter size-full wp-image-27272\" \/><\/a><\/p>\n<p>Before training our model, it is always better to check for any missing or null values since they could hinder with the further procedure. <\/p>\n<pre><code class=\"language-python\">dataset.Salnty.isnull().value_counts()\nOut[]: False    493\n       True       6\n       Name: Salnty, dtype: int64<\/code><\/pre>\n<pre><code class=\"language-python\">dataset.T_degC.isnull().value_counts()\nOut[]: False    498\n       True       1\n       Name: T_degC, dtype: int64<\/code><\/pre>\n<p>We will drop the null values and reset our index before moving to the training phase.<\/p>\n<pre><code class=\"language-python\">dataset=dataset.dropna(axis=0)\ndataset.reset_index(drop=True,inplace=True)\ndataset.shape\nOut[]: (492,2)<\/code><\/pre>\n<p>Let us plot our dataset to see whether one varies with another.<\/p>\n<pre><code class=\"language-python\">plt.figure(figsize=(12,10))\nplt.scatter(dataset.Salnty,dataset.T_degC, color='aqua')\nplt.xlabel(\"Temperature\",fontsize=22)\nplt.ylabel(\"Salinity\",fontsize=22)<\/code><\/pre>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/02\/4.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/02\/4.png\" alt=\"\" width=\"730\" height=\"607\" class=\"aligncenter size-full wp-image-27273\" srcset=\"\/wp-content\/uploads\/2021\/02\/4.png 730w, \/wp-content\/uploads\/2021\/02\/4-300x249.png 300w, \/wp-content\/uploads\/2021\/02\/4-600x499.png 600w\" sizes=\"(max-width: 730px) 100vw, 730px\" \/><\/a><\/p>\n<p>We will now reshape our data to a one-dimensional array.<\/p>\n<pre><code class=\"language-python\">x_label=np.array(dataset['Salnty']).reshape(492,1)\ny_label=np.array(dataset['T_degC']).reshape(492,1)<\/code><\/pre>\n<p>It is now time to split our dataset to train and test. We will be using a 80%-20% scheme. Feel free to vary the proportions as per your convenience.<\/p>\n<pre><code class=\"language-python\">x_train, x_test, y_train, y_test = train_test_split(x_label, y_label, test_size = 0.2, random_state = 100)<\/code><\/pre>\n<p>Now that we have separated our dataset, it is time to build a linear regression model on our training dataset.<\/p>\n<pre><code class=\"language-python\">regression_model=LinearRegression()\nregression_model.fit(x_train,y_train)\nprint('Coefficients: ', regression_model.coef_)\nprint('Intercept: ',regression_model.intercept_)\n\nOut[]: Coefficients:  [[-4.80500593]]\n       Intercept:  [169.4247854]<\/code><\/pre>\n<p>We will now supply our test dataset to check the accuracy of the built model.<\/p>\n<pre><code class=\"language-python\">accuracy = regression_model.score(x_test, y_test)\nprint(accuracy)\n0.876504976866808<\/code><\/pre>\n<p>Let us visualize how well the line fits our data<\/p>\n<pre><code class=\"language-python\">plt.figure(figsize=(12,10))\nplt.scatter(x_label, y_label,  color='aqua')\nplt.plot(x_train, regression_model.predict(x_train),linewidth=\"4\")\nplt.xlabel(\"Temperature\",fontsize=22)\nplt.ylabel(\"Salinity\",fontsize=22)\nplt.title(\"Linear Regression\",fontsize=22)<\/code><\/pre>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/02\/5.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/02\/5.png\" alt=\"\" width=\"731\" height=\"628\" class=\"aligncenter size-full wp-image-27274\" srcset=\"\/wp-content\/uploads\/2021\/02\/5.png 731w, \/wp-content\/uploads\/2021\/02\/5-300x258.png 300w, \/wp-content\/uploads\/2021\/02\/5-600x515.png 600w\" sizes=\"(max-width: 731px) 100vw, 731px\" \/><\/a><\/p>\n<p>To check the mean error of our model<\/p>\n<pre><code class=\"language-python\">y_predicted_value = regression_model.predict(x_test)\nprint(\"Mean absolute error:\",np.mean(np.absolute(y_predicted_value - y_test)))\nOut []: Mean absolute error: 0.8090316355920698<\/code><\/pre>\n<p>In this tutorial, we saw how we can insert our data into GridDB and how it can be accessed using the pandas library and SQL. Later, we built a linear regression model out of this data. To connect GridDB with Jupyter notebooks, follow <a href=\"https:\/\/griddb.net\/en\/blog\/using-python-to-interface-with-griddb-via-jdbc-with-jaydebeapi\/\">this<\/a> tutorial.<\/p>\n<p>Feel free to experiment with the other parameters of the dataset as well. For more such tutorials, check out our <a href=\"https:\/\/griddb.net\/en\/blog\/\">blog<\/a>.<\/p>\n<h3 id=\"source-code\"> Source Code <\/h3>\n<h4> Jupyter File <\/h4>\n<p><a href=\"https:\/\/github.com\/griddbnet\/Blogs\/tree\/main\/Create%20A%20Machine%20Learning%20Model%20using%20GridDB\"> GitHub <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In this tutorial, we will build a trivial linear regression model with the data stored in GridDB. We will begin with GridDB\u00e2\u20ac\u2122s python-connector to insert and access the data. Afterwards, we will see how to retrieve and convert the data using pandas and numpy. In the end, we will train and visualize our regression [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":26620,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[121],"tags":[],"class_list":["post-46631","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>Create A Machine Learning Model using GridDB | GridDB: Open Source Time Series Database for IoT<\/title>\n<meta name=\"description\" content=\"Introduction In this tutorial, we will build a trivial linear regression model with the data stored in GridDB. We will begin with GridDB\u00e2\u20ac\u2122s\" \/>\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.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create A Machine Learning Model using GridDB | GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"og:description\" content=\"Introduction In this tutorial, we will build a trivial linear regression model with the data stored in GridDB. We will begin with GridDB\u00e2\u20ac\u2122s\" \/>\n<meta property=\"og:url\" content=\"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-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=\"2021-02-09T08:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-13T20:55:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/wp-content\/uploads\/2020\/06\/artificial-intelligence-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1280\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/\"},\"author\":{\"name\":\"griddb-admin\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\"},\"headline\":\"Create A Machine Learning Model using GridDB\",\"datePublished\":\"2021-02-09T08:00:00+00:00\",\"dateModified\":\"2025-11-13T20:55:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/\"},\"wordCount\":662,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2020\/06\/artificial-intelligence-1.jpg\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/\",\"url\":\"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/\",\"name\":\"Create A Machine Learning Model using GridDB | GridDB: Open Source Time Series Database for IoT\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2020\/06\/artificial-intelligence-1.jpg\",\"datePublished\":\"2021-02-09T08:00:00+00:00\",\"dateModified\":\"2025-11-13T20:55:11+00:00\",\"description\":\"Introduction In this tutorial, we will build a trivial linear regression model with the data stored in GridDB. We will begin with GridDB\u00e2\u20ac\u2122s\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/#primaryimage\",\"url\":\"\/wp-content\/uploads\/2020\/06\/artificial-intelligence-1.jpg\",\"contentUrl\":\"\/wp-content\/uploads\/2020\/06\/artificial-intelligence-1.jpg\",\"width\":1920,\"height\":1280},{\"@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:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/author\/griddb-admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create A Machine Learning Model using GridDB | GridDB: Open Source Time Series Database for IoT","description":"Introduction In this tutorial, we will build a trivial linear regression model with the data stored in GridDB. We will begin with GridDB\u00e2\u20ac\u2122s","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.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/","og_locale":"en_US","og_type":"article","og_title":"Create A Machine Learning Model using GridDB | GridDB: Open Source Time Series Database for IoT","og_description":"Introduction In this tutorial, we will build a trivial linear regression model with the data stored in GridDB. We will begin with GridDB\u00e2\u20ac\u2122s","og_url":"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/","og_site_name":"GridDB: Open Source Time Series Database for IoT","article_publisher":"https:\/\/www.facebook.com\/griddbcommunity\/","article_published_time":"2021-02-09T08:00:00+00:00","article_modified_time":"2025-11-13T20:55:11+00:00","og_image":[{"width":1920,"height":1280,"url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/wp-content\/uploads\/2020\/06\/artificial-intelligence-1.jpg","type":"image\/jpeg"}],"author":"griddb-admin","twitter_card":"summary_large_image","twitter_creator":"@GridDBCommunity","twitter_site":"@GridDBCommunity","twitter_misc":{"Written by":"griddb-admin","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/#article","isPartOf":{"@id":"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/"},"author":{"name":"griddb-admin","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233"},"headline":"Create A Machine Learning Model using GridDB","datePublished":"2021-02-09T08:00:00+00:00","dateModified":"2025-11-13T20:55:11+00:00","mainEntityOfPage":{"@id":"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/"},"wordCount":662,"commentCount":0,"publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"image":{"@id":"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2020\/06\/artificial-intelligence-1.jpg","articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/","url":"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/","name":"Create A Machine Learning Model using GridDB | GridDB: Open Source Time Series Database for IoT","isPartOf":{"@id":"https:\/\/griddb.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/#primaryimage"},"image":{"@id":"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2020\/06\/artificial-intelligence-1.jpg","datePublished":"2021-02-09T08:00:00+00:00","dateModified":"2025-11-13T20:55:11+00:00","description":"Introduction In this tutorial, we will build a trivial linear regression model with the data stored in GridDB. We will begin with GridDB\u00e2\u20ac\u2122s","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/blog\/create-a-machine-learning-model-using-griddb\/#primaryimage","url":"\/wp-content\/uploads\/2020\/06\/artificial-intelligence-1.jpg","contentUrl":"\/wp-content\/uploads\/2020\/06\/artificial-intelligence-1.jpg","width":1920,"height":1280},{"@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:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/author\/griddb-admin\/"}]}},"_links":{"self":[{"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/posts\/46631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/comments?post=46631"}],"version-history":[{"count":1,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/posts\/46631\/revisions"}],"predecessor-version":[{"id":51307,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/posts\/46631\/revisions\/51307"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/media\/26620"}],"wp:attachment":[{"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/media?parent=46631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/categories?post=46631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/tags?post=46631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}