{"id":586,"date":"2019-11-07T10:29:55","date_gmt":"2019-11-07T03:29:55","guid":{"rendered":"https:\/\/www.indowhiz.com\/articles\/?p=586"},"modified":"2020-10-30T22:31:16","modified_gmt":"2020-10-30T15:31:16","slug":"implementation-of-gradient-descent-on-energy-efficiency-prediction","status":"publish","type":"post","link":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/","title":{"rendered":"Gradient Descent for Energy Efficiency Prediction using Python"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Linear Regression with Gradient Descent is a good and simple method for time series prediction. One of the time series predictions that can be solved by this method is  Energy Efficiency Prediction. And the purpose of this research article is to implement Linear Regression with Gradient Descent to predict the Heating Load (Y1). The programming language used for this case is using Python code. The data can be downloaded from <a href=\"https:\/\/archive.ics.uci.edu\/ml\/datasets\/Energy+efficiency\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">https:\/\/archive.ics.uci.edu\/ml\/datasets\/Energy+efficiency<\/a>. <\/p>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\">The training data used 50% from the dataset and testing data also used 50% from the dataset. The dataset has eight input data there is Relative Compactness (X1), Surface Area (X2), Wall Area (X3),&nbsp; Roof Area (X4),&nbsp; Overall Height (X5), Orientation (X6), &nbsp;Glazing Area (X7), and Glazing Area (X8). This article will show a brief discussion of prediction results using Linear Regression with Gradient Descent. <\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>DEVELOPMENT<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Gradient Descent comes with some procedure that is:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Procedure<ul><li>Start with random values<ul><li> <img decoding=\"async\" src=\"https:\/\/www.indowhiz.com\/articles\/wp-content\/ql-cache\/quicklatex.com-8a9bb33f64eeb182499219716593b342_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#32;&#92;&#116;&#104;&#101;&#116;&#97;&#32;&#61;&#32;&#32;&#92;&#116;&#104;&#101;&#116;&#97;&#95;&#123;&#125;&#94;&#123;&#40;&#48;&#41;&#125;&#32;&#61;&#32;&#40;&#32;&#123;&#92;&#116;&#104;&#101;&#116;&#97;&#95;&#123;&#48;&#125;&#125;&#94;&#123;&#40;&#48;&#41;&#125;&#44;&#32;&#32;&#123;&#92;&#116;&#104;&#101;&#116;&#97;&#95;&#123;&#49;&#125;&#125;&#94;&#123;&#40;&#48;&#41;&#125;&#44;&#32;&#32;&#46;&#46;&#46;&#32;&#123;&#92;&#116;&#104;&#101;&#116;&#97;&#95;&#123;&#100;&#125;&#125;&#94;&#123;&#40;&#48;&#41;&#125;&#32;&#41;&#32;&#32;\" title=\"Rendered by QuickLaTeX.com\" height=\"22\" width=\"230\" style=\"vertical-align: -4px;\"\/> <\/li><\/ul><\/li><\/ul><ul><li>Slightly move <img decoding=\"async\" src=\"https:\/\/www.indowhiz.com\/articles\/wp-content\/ql-cache\/quicklatex.com-caec0b675bb5df8c73f4e3349de87fea_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#32;&#92;&#116;&#104;&#101;&#116;&#97;&#95;&#123;&#48;&#125;&#44;&#32;&#46;&#46;&#46;&#32;&#92;&#116;&#104;&#101;&#116;&#97;&#95;&#123;&#100;&#125;&#32;&#32;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"55\" style=\"vertical-align: -4px;\"\/>  to reduce <img decoding=\"async\" src=\"https:\/\/www.indowhiz.com\/articles\/wp-content\/ql-cache\/quicklatex.com-e5337b13fe16f6ec4d7015c14fce738e_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#32;&#74;&#40;&#92;&#116;&#104;&#101;&#116;&#97;&#41;&#32;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"32\" style=\"vertical-align: -4px;\"\/>  <ul><li><img decoding=\"async\" src=\"https:\/\/www.indowhiz.com\/articles\/wp-content\/ql-cache\/quicklatex.com-918001f8253e2089eded756efc19cf07_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#32;&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101;&#32;&#92;&#76;&#97;&#114;&#103;&#101;&#32;&#92;&#116;&#104;&#101;&#116;&#97;&#32;&#95;&#123;&#105;&#125;&#94;&#123;&#107;&#43;&#49;&#125;&#32;&#61;&#32;&#92;&#116;&#104;&#101;&#116;&#97;&#32;&#95;&#123;&#105;&#125;&#94;&#123;&#107;&#125;&#32;&#45;&#32;&#32;&#92;&#97;&#108;&#112;&#104;&#97;&#32;&#32;&#32;&#92;&#108;&#101;&#102;&#116;&#46;&#32;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#112;&#97;&#114;&#116;&#105;&#97;&#108;&#32;&#74;&#40;&#32;&#92;&#116;&#104;&#101;&#116;&#97;&#32;&#41;&#125;&#123;&#92;&#112;&#97;&#114;&#116;&#105;&#97;&#108;&#32;&#92;&#116;&#104;&#101;&#116;&#97;&#32;&#95;&#123;&#105;&#125;&#32;&#125;&#32;&#32;&#92;&#44;&#32;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#124;&#95;&#123;&#32;&#92;&#116;&#104;&#101;&#116;&#97;&#32;&#61;&#32;&#32;&#32;&#92;&#116;&#104;&#101;&#116;&#97;&#95;&#123;&#125;&#94;&#123;&#107;&#125;&#32;&#125;&#32;&#32;&#32;\" title=\"Rendered by QuickLaTeX.com\" height=\"45\" width=\"201\" style=\"vertical-align: -18px;\"\/> <\/li><li><img decoding=\"async\" src=\"https:\/\/www.indowhiz.com\/articles\/wp-content\/ql-cache\/quicklatex.com-2f7f229d79ce5e24fe32a1fe13107d7b_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#32;&#107;&#32;&#61;&#32;&#107;&#32;&#43;&#32;&#49;&#32;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"73\" style=\"vertical-align: -2px;\"\/> <\/li><\/ul><\/li><\/ul><ul><li>Keep doing step 2 until converges<\/li><\/ul><\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Technologies Used<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To solve this problem, it was used the\nPython 3 language with the following libraries:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Pandas: Python library for data structures and statistical tools (McKinney, 2010).<\/li><li>Numpy: The Python libraries for the base data structure used for data and model parameters were presented as Numpy arrays (Al-Shalabi et al., 2006).<\/li><li>Sklearn (Hunter, 2007). <\/li><\/ol>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">IMPLEMENTATION USING PYTHON CODE<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The python code in all of this article could be merged into a single python file (e.g. <code>gdescent.py<\/code>). However, you may need to convert the data from <code>ENB2012_data.xlsx<\/code> into <code>ENB2012_data.csv<\/code>, by using spreadsheet software such as Excel or similar.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"> Import libraries:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">import sys\n\nimport numpy\nimport pandas\nimport sklearn.metrics\nimport sklearn.model_selection\nimport sklearn.linear_model\nimport sklearn.preprocessing<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"> Loading Dataset: <\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def load_train_test_data(train_ratio=.5):\n    data = pandas.read_csv('.\/ENB2012_data.csv')\n   \n    feature_col = ['X1', 'X2', 'X3', 'X4', 'X5', 'X6', 'X7', 'X8']\n    label_col = ['Y1'] \n    X = data[feature_col]\n    y = data[label_col]\n\n    return sklearn.model_selection.train_test_split(X, y, test_size = 1 - train_ratio, random_state=0)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Scale the Training and Testing Features<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def scale_features(X_train, X_test, low=0, upp=1):\n    minmax_scaler = sklearn.preprocessing.MinMaxScaler(feature_range=(low, upp)).fit(numpy.vstack((X_train, X_test)))\n    X_train_scale = minmax_scaler.transform(X_train)\n    X_test_scale = minmax_scaler.transform(X_test)\n    return X_train_scale, X_test_scale<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Gradient Descent Calculation<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def gradient_descent(X, y, alpha=0.1, iters=100000, eps=1e-4):\n    n, d = X.shape\n    theta = numpy.zeros((d, 1))\n    xT = numpy.transpose(X)\n    \n    for k in range(1,iters+1): \n        theta_k = theta.copy() \n        prediction = numpy.dot(X,theta)\n        error = numpy.subtract(prediction,y)\n        #gradient\n        gradient = numpy.dot(xT,error) * (1\/n)\n        #update theta\n        theta = theta_k - (alpha * gradient)\n        print(k)\n        \n    for delta in abs(theta-theta_k): \n        if delta > eps: \n            break\n        \n    return theta<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Prediction Function<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def predict(X, theta):\n    return numpy.dot(X, theta)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Main Function<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def main(argv):\n    X_train, X_test, y_train, y_test = load_train_test_data(train_ratio=.5)\n    X_train_scale, X_test_scale = scale_features(X_train, X_test, 0, 1)\n\n    theta = gradient_descent(X_train_scale, y_train)\n    print('Theta:\\n', theta)\n    \n    y_hat = predict(X_train_scale, theta)\n    print(\"Linear train R^2: %f\" % (sklearn.metrics.r2_score(y_train, y_hat)))\n    y_hat = predict(X_test_scale, theta)\n    #R2 value closer to 1 indicating that a greater proportion of variance is accounted for by the model.\n    print(\"Linear test R^2: %f\" % (sklearn.metrics.r2_score(y_test, y_hat)))\n    \n    #MSE value closer to 0 indicates a fit that is more useful for prediction.\n    print(\"Mean Squared Error Test : %f\" % (sklearn.metrics.mean_squared_error(y_test, y_hat)))\n    print(\"Mean Absolute Error Test : %f\" % (sklearn.metrics.mean_absolute_error(y_test, y_hat)))\n    \nif __name__ == \"__main__\":\n    main(sys.argv)<\/code><\/pre>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>RESULT AND DISCUSSION<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"> This article shows the result of the experiment using some parameter value there is the value of alpha and maximum iteration. this experiment is aiming to find the optimum parameter value to predict the Heating Load (Y1). <\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Testing Value of Alpha<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The process of testing the value of alpha was done one time, the value of alpha was 0.1 to 0.000001. The values of maximum iteration used constantly that is 1000. The optimum value of alpha can be seen from the R2 result. The test results on the R2 value shown in Table 1. The chart of R2 value changes according to the value of alpha can be seen in Figure 1.<\/p>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\">Table 1. R<sup>2<\/sup> value from Testing Value of Alpha<\/p>\n\n\n\n<table id=\"tablepress-1\" class=\"tablepress tablepress-id-1 tbody-has-connected-cells\">\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-1\">\n\t<td rowspan=\"2\" class=\"column-1\">Value of Alpha   <\/td><td colspan=\"2\" class=\"column-2\">R Square<\/td>\n<\/tr>\n<tr class=\"row-2\">\n\t<td class=\"column-2\">Train<\/td><td class=\"column-3\">Test   <\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">0.1<\/td><td class=\"column-2\">0.920143<\/td><td class=\"column-3\">0.896159<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">0.01<\/td><td class=\"column-2\">0.903376<\/td><td class=\"column-3\">0.880996<\/td>\n<\/tr>\n<tr class=\"row-5\">\n\t<td class=\"column-1\">0.001<\/td><td class=\"column-2\">0.496769<\/td><td class=\"column-3\">0.460076<\/td>\n<\/tr>\n<tr class=\"row-6\">\n\t<td class=\"column-1\">0.0001<\/td><td class=\"column-2\">-2.993605<\/td><td class=\"column-3\">-3.154529<\/td>\n<\/tr>\n<tr class=\"row-7\">\n\t<td class=\"column-1\">0.00001<\/td><td class=\"column-2\">-4.593513<\/td><td class=\"column-3\">-4.765798<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-1 from cache -->\n\n\n\n<p class=\"wp-block-paragraph\"> The testing results value of alpha in Table 1 indicates that the best R<sup>2<\/sup> value was obtained with value of alpha is 0.1. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.indowhiz.com\/articles\/wp-content\/uploads\/2019\/11\/1.jpg\" alt=\"Chart of R2 Value from Every Alpha \" class=\"wp-image-587\"\/><figcaption>  Figure 1.  Chart of R<sup>2<\/sup> Value from Every Alpha <\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.indowhiz.com\/articles\/wp-content\/uploads\/2019\/11\/2.jpg\" alt=\" (Detail)  Chart of  R2 Value from Training on Every Alpha \" class=\"wp-image-588\"\/><figcaption>  Figure 2.  (Detail) Chart of  R<sup>2<\/sup> Value from Training on Every Alpha <\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.indowhiz.com\/articles\/wp-content\/uploads\/2019\/11\/3.jpg\" alt=\" (Detail) Chart of  R2 Value from Testing on Every Alpha  \" class=\"wp-image-589\"\/><figcaption> Figure 3. (Detail) Chart of  R<sup>2<\/sup> Value from Testing on Every Alpha  <\/figcaption><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Testing Value of Maximum Iteration<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The process of testing the value of Maximum Iteration was done one time, the value of Maximum Iteration was 10 to 10000. The values of alpha used from the previous testing that is 0.1. The optimum value of Maximum Iteration can be seen from the R2 result. The test results on the R2 value shown in Table 2. The chart of R2 value changes according to the value of Maximum Iteration can be seen in Figure 2.<\/p>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\">Table 2. R<sup>2<\/sup> value from Testing Value of Maximum Iteration<\/p>\n\n\n\n<table id=\"tablepress-2\" class=\"tablepress tablepress-id-2 tablepress-id-1 tbody-has-connected-cells\">\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-1\">\n\t<td rowspan=\"2\" class=\"column-1\">Value of Max<br \/>\nIteration<\/td><td colspan=\"2\" class=\"column-2\">R Square<\/td>\n<\/tr>\n<tr class=\"row-2\">\n\t<td class=\"column-2\">Train<\/td><td class=\"column-3\">Test   <\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">10<\/td><td class=\"column-2\">0.529225<\/td><td class=\"column-3\">0.497496<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">100<\/td><td class=\"column-2\">0.903513<\/td><td class=\"column-3\">0.881109<\/td>\n<\/tr>\n<tr class=\"row-5\">\n\t<td class=\"column-1\">1000<\/td><td class=\"column-2\">0.920143<\/td><td class=\"column-3\">0.896159<\/td>\n<\/tr>\n<tr class=\"row-6\">\n\t<td class=\"column-1\">10000<\/td><td class=\"column-2\">0.921027<\/td><td class=\"column-3\">0.900045<\/td>\n<\/tr>\n<tr class=\"row-7\">\n\t<td class=\"column-1\">100000<\/td><td class=\"column-2\">0.92156<\/td><td class=\"column-3\">0.900637<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-2 from cache -->\n\n\n\n<p class=\"wp-block-paragraph\">The testing results value of Maximum Iteration in Table 2 indicate that the best R<sup>2<\/sup> value was obtained with a value of Maximum Iteration is 10000. Because of that, I choose maximum iteration at 10,000 because after that nothing significant improvement of R<sup>2<\/sup> value. So, the optimum maximum generation is 10,000 because it also considers the value running time.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.indowhiz.com\/articles\/wp-content\/uploads\/2019\/11\/4-2.jpg\" alt=\"Chart of R2 Value from Testing Value of Maximum Iteration \" class=\"wp-image-592\"\/><figcaption> Figure 4. Chart of R<sup>2 <\/sup>Value from Testing Value of Maximum Iteration <\/figcaption><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Result Analysis<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We can see from Figure 2, the R2 value accuracy from training data at the blue line and the R2 value from testing data at the orange line. From the testing and training data, the optimal value of alpha is 0.1 and the optimum maximum iteration is 10000. Form the testing parameter value, Linear regression using Gradient Descent can predict the Heating Load (Y1) with R2 value 0.92156 for training and 0.900637 for testing. The detail result form this experiment  can see in the figure below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"rest\" class=\"language-rest\">Theta:\n [[ 2.32952123]\n [ 2.97557991]\n [ 8.4017958 ]\n [19.42200572]\n [-0.32337598]\n [ 7.52095841]\n [ 0.86006606]]\nLinear train R^2: 0.921027\nLinear test R^2: 0.900045\nMean Squared Error Test : 10.275206\nMean Absolute Error Test : 2.369451<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">So we can write the formulation to find Heating Load (Y1) as follow:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"https:\/\/www.indowhiz.com\/articles\/wp-content\/ql-cache\/quicklatex.com-3b4ad63688e45b426640b631f9103258_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#32;&#32;&#89;&#61;&#88;&#95;&#49;&#32;&theta;&#95;&#49;&#43;&#88;&#95;&#50;&#32;&theta;&#95;&#50;&#43;&#32;&#88;&#95;&#51;&#32;&theta;&#95;&#51;&#43;&#32;&#88;&#95;&#52;&#32;&theta;&#95;&#52;&#43;&#32;&#88;&#95;&#53;&#32;&theta;&#95;&#53;&#43;&#32;&#88;&#95;&#54;&#32;&theta;&#95;&#54;&#43;&#32;&#88;&#95;&#55;&#32;&theta;&#95;&#55;&#43;&#32;&#88;&#95;&#56;&#32;&theta;&#95;&#56;&#32;&#32;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"429\" style=\"vertical-align: -4px;\"\/>   <\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"https:\/\/www.indowhiz.com\/articles\/wp-content\/ql-cache\/quicklatex.com-cf8997f2fd77107fbbc978e7c056ac12_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#32;&#89;&#32;&#61;&#32;&#88;&#95;&#49;&#32;&#40;&#50;&#46;&#51;&#50;&#57;&#53;&#50;&#49;&#50;&#51;&#41;&#43;&#88;&#95;&#50;&#32;&#40;&#50;&#46;&#57;&#55;&#53;&#53;&#55;&#57;&#57;&#49;&#41;&#43;&#32;&#88;&#95;&#51;&#32;&#40;&#56;&#46;&#52;&#48;&#49;&#55;&#57;&#53;&#56;&#41;&#43;&#32;&#88;&#95;&#52;&#32;&#40;&#50;&#46;&#57;&#50;&#48;&#48;&#54;&#51;&#51;&#53;&#41;&#43;&#32;&#88;&#95;&#53;&#32;&#40;&#49;&#57;&#46;&#52;&#50;&#50;&#48;&#48;&#53;&#55;&#50;&#41;&#43;&#32;&#88;&#95;&#54;&#32;&#40;&#45;&#48;&#46;&#51;&#50;&#51;&#51;&#55;&#53;&#57;&#56;&#41;&#43;&#32;&#88;&#95;&#55;&#32;&#40;&#55;&#46;&#53;&#50;&#48;&#57;&#53;&#56;&#52;&#49;&#41;&#43;&#32;&#88;&#95;&#56;&#32;&#40;&#48;&#46;&#56;&#54;&#48;&#48;&#54;&#54;&#48;&#54;&#41;&#32;&#32;\" title=\"Rendered by QuickLaTeX.com\" height=\"40\" width=\"582\" style=\"vertical-align: -4px;\"\/>   <\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-very-light-gray-background-color has-background wp-block-paragraph\">Read Also:  <a rel=\"noreferrer noopener\" href=\"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-k-nearest-neighbors-knn-for-iris-classification-using-python-3\/\" target=\"_blank\"><strong>Implementation of K-Nearest Neighbors (KNN) For Iris Classification Using Python 3<\/strong><\/a><\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>REFERENCES<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Al-Shalabi, R., Kanaan, G., &amp; Gharaibeh, M. H. (2006).\nArabic Text Categorization Using kNN Algorithm. <em>Proceedings of The 4th\nInternational Multiconference on Computer Science and Information Technology<\/em>,\n5\u20137.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hunter, J. D. (2007). Matplotlib: A 2D Graphics Environment. <em>Computing\nin Science &amp; Engineering<\/em>, <em>9<\/em>(3), 90\u201395.\nhttps:\/\/doi.org\/10.1109\/MCSE.2007.55<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Lotte, F., Congedo, M., L\u00e9cuyer, A., Lamarche, F., &amp;\nArnaldi, B. (2007). A review of classification algorithms for EEG-based\nbrain-computer interfaces. <em>Journal of Neural Engineering<\/em>, <em>4<\/em>(2).\nhttps:\/\/doi.org\/10.1088\/1741-2560\/4\/2\/R01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">McKinney, W. (2010). Data Structures for Statistical Computing in Python. <em>Proceedings of the 9th Python in Science Conference<\/em>, <em>1697900<\/em>(Scipy), 51\u201356. Retrieved from http:\/\/conference.scipy.org\/proceedings\/scipy2010\/mckinney.html<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Featured Image Source: <a aria-label=\"Freepik (opens in a new tab)\" rel=\"noreferrer noopener\" href=\"https:\/\/www.freepik.com\/free-photo\/light-bulb-with-glass-jar-coins-stacks_3064033.htm\" target=\"_blank\">Freepik<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Appendix<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The full code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python line-numbers\">import sys\n\nimport numpy\nimport pandas\nimport sklearn.metrics\nimport sklearn.model_selection\nimport sklearn.linear_model\nimport sklearn.preprocessing\n\ndef load_train_test_data(train_ratio=.5):\n    data = pandas.read_csv('.\/ENB2012_data.csv')\n   \n    feature_col = ['X1', 'X2', 'X3', 'X4', 'X5', 'X6', 'X7', 'X8']\n    label_col = ['Y1'] \n    X = data[feature_col]\n    y = data[label_col]\n\n    return sklearn.model_selection.train_test_split(X, y, test_size = 1 - train_ratio, random_state=0)\n\ndef scale_features(X_train, X_test, low=0, upp=1):\n    minmax_scaler = sklearn.preprocessing.MinMaxScaler(feature_range=(low, upp)).fit(numpy.vstack((X_train, X_test)))\n    X_train_scale = minmax_scaler.transform(X_train)\n    X_test_scale = minmax_scaler.transform(X_test)\n    return X_train_scale, X_test_scale\n\ndef gradient_descent(X, y, alpha=0.1, iters=100000, eps=1e-4):\n    n, d = X.shape\n    theta = numpy.zeros((d, 1))\n    xT = numpy.transpose(X)\n    \n    for k in range(1,iters+1): \n        theta_k = theta.copy() \n        prediction = numpy.dot(X,theta)\n        error = numpy.subtract(prediction,y)\n        #gradient\n        gradient = numpy.dot(xT,error) * (1\/n)\n        #update theta\n        theta = theta_k - (alpha * gradient)\n        print(k)\n        \n    for delta in abs(theta-theta_k): \n        if delta > eps: \n            break\n        \n    return theta\n\ndef predict(X, theta):\n    return numpy.dot(X, theta)\n\ndef main(argv):\n    X_train, X_test, y_train, y_test = load_train_test_data(train_ratio=.5)\n    X_train_scale, X_test_scale = scale_features(X_train, X_test, 0, 1)\n\n    theta = gradient_descent(X_train_scale, y_train)\n    print('Theta:\\n', theta)\n    \n    y_hat = predict(X_train_scale, theta)\n    print(\"Linear train R^2: %f\" % (sklearn.metrics.r2_score(y_train, y_hat)))\n    y_hat = predict(X_test_scale, theta)\n    #R2 value closer to 1 indicating that a greater proportion of variance is accounted for by the model.\n    print(\"Linear test R^2: %f\" % (sklearn.metrics.r2_score(y_test, y_hat)))\n    \n    #MSE value closer to 0 indicates a fit that is more useful for prediction.\n    print(\"Mean Squared Error Test : %f\" % (sklearn.metrics.mean_squared_error(y_test, y_hat)))\n    print(\"Mean Absolute Error Test : %f\" % (sklearn.metrics.mean_absolute_error(y_test, y_hat)))\n    \nif __name__ == \"__main__\":\n    main(sys.argv)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Linear Regression with Gradient Descent is a good and simple method for time series prediction. One of the time series predictions that can be solved by this method is Energy Efficiency Prediction. And the purpose of this research article is to implement Linear Regression with Gradient Descent to predict the Heating Load (Y1). The programming [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":103,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"no","_lmt_disable":"no","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[491],"tags":[63,65,67,69,71],"class_list":["post-586","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-concept","tag-energy-efficiency","tag-energy-efficiency-prediction","tag-gradient-descent-en","tag-prediction","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Gradient Descent for Energy Efficiency Prediction using Python &#8211; Indowhiz<\/title>\n<meta name=\"description\" content=\"Linear Regression with Gradient Descent is a good and simple method for time series prediction, for example, Energy Efficiency Prediction\" \/>\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.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Gradient Descent for Energy Efficiency Prediction using Python &#8211; Indowhiz\" \/>\n<meta property=\"og:description\" content=\"Linear Regression with Gradient Descent is a good and simple method for time series prediction, for example, Energy Efficiency Prediction\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/\" \/>\n<meta property=\"og:site_name\" content=\"Indowhiz\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/indowhiz\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/idawahyuni13\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-07T03:29:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-10-30T15:31:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.indowhiz.com\/articles\/wp-content\/uploads\/2019\/11\/DG-EFP-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"800\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ida Wahyuni\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@idawahyuni1\" \/>\n<meta name=\"twitter:site\" content=\"@4Faster\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ida Wahyuni\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/\"},\"author\":{\"name\":\"Ida Wahyuni\",\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/#\\\/schema\\\/person\\\/243467a2aa4c68f5ecbf321002e84e5e\"},\"headline\":\"Gradient Descent for Energy Efficiency Prediction using Python\",\"datePublished\":\"2019-11-07T03:29:55+00:00\",\"dateModified\":\"2020-10-30T15:31:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/\"},\"wordCount\":896,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/DG-EFP-1.jpg\",\"keywords\":[\"Energy Efficiency\",\"Energy Efficiency Prediction\",\"Gradient Descent\",\"Prediction\",\"Python\"],\"articleSection\":[\"Concept\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/\",\"url\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/\",\"name\":\"Gradient Descent for Energy Efficiency Prediction using Python &#8211; Indowhiz\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/DG-EFP-1.jpg\",\"datePublished\":\"2019-11-07T03:29:55+00:00\",\"dateModified\":\"2020-10-30T15:31:16+00:00\",\"description\":\"Linear Regression with Gradient Descent is a good and simple method for time series prediction, for example, Energy Efficiency Prediction\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/DG-EFP-1.jpg\",\"contentUrl\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/DG-EFP-1.jpg\",\"width\":800,\"height\":800},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/implementation-of-gradient-descent-on-energy-efficiency-prediction\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Articles\",\"item\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Science and Technology\",\"item\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/category\\\/science-technology\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Concept\",\"item\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/en\\\/category\\\/science-technology\\\/concept\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Gradient Descent for Energy Efficiency Prediction using Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/#website\",\"url\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/\",\"name\":\"Indowhiz\",\"description\":\"The reliable information provider\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/#organization\",\"name\":\"Indowhiz\",\"url\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/logo-indowhiz-v3.png\",\"contentUrl\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/logo-indowhiz-v3.png\",\"width\":280,\"height\":56,\"caption\":\"Indowhiz\"},\"image\":{\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/indowhiz\\\/\",\"https:\\\/\\\/x.com\\\/4Faster\",\"https:\\\/\\\/www.instagram.com\\\/indowhiz\\\/\",\"https:\\\/\\\/www.pinterest.com\\\/indowhiz\\\/\",\"https:\\\/\\\/www.youtube.com\\\/indowhiz\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/#\\\/schema\\\/person\\\/243467a2aa4c68f5ecbf321002e84e5e\",\"name\":\"Ida Wahyuni\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f81a09de89204cb12639ed3ae6b71999ebbfc9d6d0bcc7e66bee0302958ab623?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f81a09de89204cb12639ed3ae6b71999ebbfc9d6d0bcc7e66bee0302958ab623?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f81a09de89204cb12639ed3ae6b71999ebbfc9d6d0bcc7e66bee0302958ab623?s=96&d=mm&r=g\",\"caption\":\"Ida Wahyuni\"},\"description\":\"Ida Wahyuni is a doctoral student at the Department of Computer Science and Information Engineering (CSIE), National Central University (NCU) Taiwan. In Indonesia, Ida works as a lecturer at the Faculty of Technology and Design, Institute of Asia Malang. In addition, Ida is also active in writing on Indowhiz.com and making videos on Youtube Indowhiz.\",\"sameAs\":[\"https:\\\/\\\/www.indowhiz.com\",\"https:\\\/\\\/www.facebook.com\\\/idawahyuni13\",\"https:\\\/\\\/www.instagram.com\\\/idawahyuni92\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/ida-wahyuni-29104b179\\\/\",\"https:\\\/\\\/x.com\\\/idawahyuni1\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UC511iqGjhpaxgJAr5YGERKA\"],\"url\":\"https:\\\/\\\/www.indowhiz.com\\\/articles\\\/author\\\/idawahyuni\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Gradient Descent for Energy Efficiency Prediction using Python &#8211; Indowhiz","description":"Linear Regression with Gradient Descent is a good and simple method for time series prediction, for example, Energy Efficiency Prediction","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.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/","og_locale":"en_US","og_type":"article","og_title":"Gradient Descent for Energy Efficiency Prediction using Python &#8211; Indowhiz","og_description":"Linear Regression with Gradient Descent is a good and simple method for time series prediction, for example, Energy Efficiency Prediction","og_url":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/","og_site_name":"Indowhiz","article_publisher":"https:\/\/www.facebook.com\/indowhiz\/","article_author":"https:\/\/www.facebook.com\/idawahyuni13","article_published_time":"2019-11-07T03:29:55+00:00","article_modified_time":"2020-10-30T15:31:16+00:00","og_image":[{"width":800,"height":800,"url":"https:\/\/www.indowhiz.com\/articles\/wp-content\/uploads\/2019\/11\/DG-EFP-1.jpg","type":"image\/jpeg"}],"author":"Ida Wahyuni","twitter_card":"summary_large_image","twitter_creator":"@idawahyuni1","twitter_site":"@4Faster","twitter_misc":{"Written by":"Ida Wahyuni","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/#article","isPartOf":{"@id":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/"},"author":{"name":"Ida Wahyuni","@id":"https:\/\/www.indowhiz.com\/articles\/#\/schema\/person\/243467a2aa4c68f5ecbf321002e84e5e"},"headline":"Gradient Descent for Energy Efficiency Prediction using Python","datePublished":"2019-11-07T03:29:55+00:00","dateModified":"2020-10-30T15:31:16+00:00","mainEntityOfPage":{"@id":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/"},"wordCount":896,"commentCount":2,"publisher":{"@id":"https:\/\/www.indowhiz.com\/articles\/#organization"},"image":{"@id":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/#primaryimage"},"thumbnailUrl":"https:\/\/www.indowhiz.com\/articles\/wp-content\/uploads\/2019\/11\/DG-EFP-1.jpg","keywords":["Energy Efficiency","Energy Efficiency Prediction","Gradient Descent","Prediction","Python"],"articleSection":["Concept"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/","url":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/","name":"Gradient Descent for Energy Efficiency Prediction using Python &#8211; Indowhiz","isPartOf":{"@id":"https:\/\/www.indowhiz.com\/articles\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/#primaryimage"},"image":{"@id":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/#primaryimage"},"thumbnailUrl":"https:\/\/www.indowhiz.com\/articles\/wp-content\/uploads\/2019\/11\/DG-EFP-1.jpg","datePublished":"2019-11-07T03:29:55+00:00","dateModified":"2020-10-30T15:31:16+00:00","description":"Linear Regression with Gradient Descent is a good and simple method for time series prediction, for example, Energy Efficiency Prediction","breadcrumb":{"@id":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/#primaryimage","url":"https:\/\/www.indowhiz.com\/articles\/wp-content\/uploads\/2019\/11\/DG-EFP-1.jpg","contentUrl":"https:\/\/www.indowhiz.com\/articles\/wp-content\/uploads\/2019\/11\/DG-EFP-1.jpg","width":800,"height":800},{"@type":"BreadcrumbList","@id":"https:\/\/www.indowhiz.com\/articles\/en\/implementation-of-gradient-descent-on-energy-efficiency-prediction\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Articles","item":"https:\/\/www.indowhiz.com\/articles\/en\/home\/"},{"@type":"ListItem","position":2,"name":"Science and Technology","item":"https:\/\/www.indowhiz.com\/articles\/en\/category\/science-technology\/"},{"@type":"ListItem","position":3,"name":"Concept","item":"https:\/\/www.indowhiz.com\/articles\/en\/category\/science-technology\/concept\/"},{"@type":"ListItem","position":4,"name":"Gradient Descent for Energy Efficiency Prediction using Python"}]},{"@type":"WebSite","@id":"https:\/\/www.indowhiz.com\/articles\/#website","url":"https:\/\/www.indowhiz.com\/articles\/","name":"Indowhiz","description":"The reliable information provider","publisher":{"@id":"https:\/\/www.indowhiz.com\/articles\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.indowhiz.com\/articles\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.indowhiz.com\/articles\/#organization","name":"Indowhiz","url":"https:\/\/www.indowhiz.com\/articles\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.indowhiz.com\/articles\/#\/schema\/logo\/image\/","url":"https:\/\/www.indowhiz.com\/articles\/wp-content\/uploads\/2020\/07\/logo-indowhiz-v3.png","contentUrl":"https:\/\/www.indowhiz.com\/articles\/wp-content\/uploads\/2020\/07\/logo-indowhiz-v3.png","width":280,"height":56,"caption":"Indowhiz"},"image":{"@id":"https:\/\/www.indowhiz.com\/articles\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/indowhiz\/","https:\/\/x.com\/4Faster","https:\/\/www.instagram.com\/indowhiz\/","https:\/\/www.pinterest.com\/indowhiz\/","https:\/\/www.youtube.com\/indowhiz"]},{"@type":"Person","@id":"https:\/\/www.indowhiz.com\/articles\/#\/schema\/person\/243467a2aa4c68f5ecbf321002e84e5e","name":"Ida Wahyuni","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f81a09de89204cb12639ed3ae6b71999ebbfc9d6d0bcc7e66bee0302958ab623?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f81a09de89204cb12639ed3ae6b71999ebbfc9d6d0bcc7e66bee0302958ab623?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f81a09de89204cb12639ed3ae6b71999ebbfc9d6d0bcc7e66bee0302958ab623?s=96&d=mm&r=g","caption":"Ida Wahyuni"},"description":"Ida Wahyuni is a doctoral student at the Department of Computer Science and Information Engineering (CSIE), National Central University (NCU) Taiwan. In Indonesia, Ida works as a lecturer at the Faculty of Technology and Design, Institute of Asia Malang. In addition, Ida is also active in writing on Indowhiz.com and making videos on Youtube Indowhiz.","sameAs":["https:\/\/www.indowhiz.com","https:\/\/www.facebook.com\/idawahyuni13","https:\/\/www.instagram.com\/idawahyuni92","https:\/\/www.linkedin.com\/in\/ida-wahyuni-29104b179\/","https:\/\/x.com\/idawahyuni1","https:\/\/www.youtube.com\/channel\/UC511iqGjhpaxgJAr5YGERKA"],"url":"https:\/\/www.indowhiz.com\/articles\/author\/idawahyuni\/"}]}},"modified_by":"Philip F. E. Adipraja","_links":{"self":[{"href":"https:\/\/www.indowhiz.com\/articles\/wp-json\/wp\/v2\/posts\/586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.indowhiz.com\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.indowhiz.com\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.indowhiz.com\/articles\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.indowhiz.com\/articles\/wp-json\/wp\/v2\/comments?post=586"}],"version-history":[{"count":2,"href":"https:\/\/www.indowhiz.com\/articles\/wp-json\/wp\/v2\/posts\/586\/revisions"}],"predecessor-version":[{"id":3071,"href":"https:\/\/www.indowhiz.com\/articles\/wp-json\/wp\/v2\/posts\/586\/revisions\/3071"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.indowhiz.com\/articles\/wp-json\/wp\/v2\/media\/103"}],"wp:attachment":[{"href":"https:\/\/www.indowhiz.com\/articles\/wp-json\/wp\/v2\/media?parent=586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.indowhiz.com\/articles\/wp-json\/wp\/v2\/categories?post=586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.indowhiz.com\/articles\/wp-json\/wp\/v2\/tags?post=586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}