<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">JCC</journal-id><journal-title-group><journal-title>Journal of Computer and Communications</journal-title></journal-title-group><issn pub-type="epub">2327-5219</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/jcc.2019.712004</article-id><article-id pub-id-type="publisher-id">JCC-97119</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Computer Science&amp;Communications</subject></subj-group></article-categories><title-group><article-title>
 
 
  Linear Regression and Gradient Descent Method for Electricity Output Power Prediction
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Yuanliang</surname><given-names>Liao</given-names></name><xref ref-type="aff" rid="aff1"><sub>1</sub></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib></contrib-group><aff id="aff1"><label>1</label><addr-line>Tsinghua International School, Campus of Tsinghua High School, Beijing, China</addr-line></aff><pub-date pub-type="epub"><day>28</day><month>11</month><year>2019</year></pub-date><volume>07</volume><issue>12</issue><fpage>31</fpage><lpage>36</lpage><history><date date-type="received"><day>19,</day>	<month>November</month>	<year>2019</year></date><date date-type="rev-recd"><day>13,</day>	<month>December</month>	<year>2019</year>	</date><date date-type="accepted"><day>16,</day>	<month>December</month>	<year>2019</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  Regulating the power output for a power plant as demand for electricity fluctuates throughout the day is important for both economic purpose and the safety of the generator. In this work, gradient descent method together with regularization is investigated to study the electricity output related to vacuum level and temperature in the turbine. Ninety percent of the data was used to train the regression parameters while the remaining ten percent was used for validation. Final results showed that 99% accuracy could be obtained with this method. This opens a new window for electricity output prediction for power plants.
 
</p></abstract><kwd-group><kwd>Machine Learning</kwd><kwd> Linear Algebra</kwd><kwd> Linear Regression</kwd><kwd> Gradient Descent</kwd><kwd> Error Analysis</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>The power output of a power plant typically has a complicated relation with respect to the physical parameters, such as temperature, vacuum level, relative humidity, and exhaust steam pressure, etc. [<xref ref-type="bibr" rid="scirp.97119-ref1">1</xref>] [<xref ref-type="bibr" rid="scirp.97119-ref2">2</xref>] [<xref ref-type="bibr" rid="scirp.97119-ref3">3</xref>] [<xref ref-type="bibr" rid="scirp.97119-ref4">4</xref>] [<xref ref-type="bibr" rid="scirp.97119-ref5">5</xref>]. Attempts have been made to resolve the relations using methods such as Bagging algorithm [<xref ref-type="bibr" rid="scirp.97119-ref2">2</xref>], neural network [<xref ref-type="bibr" rid="scirp.97119-ref3">3</xref>], etc. However, either the algorithm itself is complicated or it involves other non-intuitive algorithms such as particle swarm optimization. A simple prediction method without consuming much computing resources is highly desired.</p><p>With the advent of computer science, specifically machine learning, methods have been established to build mathematical models based on training data to make predictions or decisions. These methods do not involve explicit programs to perform the task. Using different mathematical algorithms, computers are able to make accurate predictions. Wide applications have been implemented in our daily life, for example, pattern recognition [<xref ref-type="bibr" rid="scirp.97119-ref6">6</xref>] [<xref ref-type="bibr" rid="scirp.97119-ref7">7</xref>], speech recognition [<xref ref-type="bibr" rid="scirp.97119-ref8">8</xref>] [<xref ref-type="bibr" rid="scirp.97119-ref9">9</xref>], text categorization [<xref ref-type="bibr" rid="scirp.97119-ref10">10</xref>] [<xref ref-type="bibr" rid="scirp.97119-ref11">11</xref>], autonomous driving [<xref ref-type="bibr" rid="scirp.97119-ref12">12</xref>] [<xref ref-type="bibr" rid="scirp.97119-ref13">13</xref>], medical diagnosis [<xref ref-type="bibr" rid="scirp.97119-ref14">14</xref>] [<xref ref-type="bibr" rid="scirp.97119-ref15">15</xref>], computational biology [<xref ref-type="bibr" rid="scirp.97119-ref16">16</xref>] [<xref ref-type="bibr" rid="scirp.97119-ref17">17</xref>], etc.</p><p>In machine learning, gradient descent is a very popular method for regression. It is an optimization algorithm used to find the values of coefficients of a function that minimizes a cost function. Gradient descent and cost function are methods and functions that help to analyze sets of data [<xref ref-type="bibr" rid="scirp.97119-ref18">18</xref>] [<xref ref-type="bibr" rid="scirp.97119-ref19">19</xref>]. By combining these two, it enables us to estimate values base on previous records. In this work, we developed a predictive model, that can predict output power of a power plant given the temperature and vacuum level. This is an attempt in using cost function and linear descent after courses of machine learning.</p></sec><sec id="s2"><title>2. Methods</title><p>Obtaining the predicted value requires the theta of the linear equation. In order to validate the result, we use ninety percent of the data to predict the result and the remaining ten percent will be used to verify the validity of the predicted data. Graphing will reflect the range of the predicting value. As last, there will be calculation of rate of deviation, which is the percent of error comparing the predicted value and actual value.</p><p>Linear regression is a linear approach to modeling the relationship between a scalar response or dependent variable and one or more explanatory variables or independent variables. Simply, we have a set of data. Each dependent value corresponds to another independent variable. We may call these two represent dependent variable and independent variable; our purpose is to find the relationship between the dependent variable and the independent variables. Nevertheless, unlike any “pretty” functions we familiar the most, the variable does not have a direct relationship such as linear or exponential. This can be easily explained: the numbers are authentic data from real life, which means most numbers will not perfectly match to each other. Because there are many other uncertainties in real life, causing the change of dependent variable unstable and without pattern, people cannot use equation to explain the relationship of two variables. People can, however, plot the data to a graph and draw line of best fit. It looks easy when we usually directly get that by plugging data into excel, but the method of actually drawing the line is not so simple. The word “draw” is not very appropriate because it requires rigid calculations. Assume the linear function is expressed as the following.</p><p>h θ ( x ) = θ 0 + θ 1 x</p><p>We want it to fit the data we gathered. That means when we plug in x value (the size) the output of the function is closest to the real value in the dataset. There are several points, so we need a line that the average deviation from real value is the smallest. Therefore, we write the equation.</p><p>∑ i = 1 m [ h θ ( x ( i ) ) − y ( i ) ] 2</p><p>This simply means the sum of the difference of the estimate value to real value. In order to make it smaller, we take the derivative of the equation and then search for the critical point (1/2 m and square is added for simplifying the calculation process):</p><p>∂ ∂ θ i J ( θ 0 , θ 1 ) = ∂ ∂ θ i { 1 2 m ∑ i = 1 m [ h θ ( x i ) − y ( i ) ] 2 } = ∂ ∂ θ i { 1 2 m ∑ i = 1 m [ θ 0 + θ 1 x ( i ) − y ( i ) ] 2 }</p><p>In addition, we need Gradient Descent to calculate the minimum of the function. Gradient Descent is a formula to find the minimum of a function,</p><p>θ j : = θ j − ∂ ∂ θ i J ( θ 0 , θ 1 ) , j = 0 , 1</p><p>For the linear function, we can finally get the slope and the intersection point of the function.</p><p>temp 0 = θ 0 − ∂ ∂ θ i J ( θ 0 , θ 1 )</p><p>temp 1 = θ 1 − ∂ ∂ θ i J ( θ 0 , θ 1 )</p><p>θ 0 = temp 0</p><p>θ 1 = temp 0</p></sec><sec id="s3"><title>3. Results</title><p>The code starts with loading given data file by csvread, which is used for reading excel data. The distribution of the power output with respect to vacuum level and temperature is shown in <xref ref-type="fig" rid="fig1">Figure 1</xref>. The absolute value of power output is reflected in its corresponding size and color during plotting. Then we declare the amount of the data we will be used to predict, which is 90% percent, and set the scale features to zero mean. The first step is used to set up the matrix that required in gradient descent formula. Part two is plugging in the matrix we just set up in step one. Gradient descent will provide the two largest constant (theta) of the linear function, which is an essential for prediction. The cost function is plotted in <xref ref-type="fig" rid="fig2">Figure 2</xref> versus number of iterations. It clearly shows that the cost function decreased by four order of magnitude with gradient descent algorithm. Then we use cross validation to find the predicted value. Basically, theta is the ratio of the current data to the next data. So we use the current data times theta to gain the prediction. Finally, we use the remaining ten percent data to find the error of the prediction in <xref ref-type="fig" rid="fig3">Figure 3</xref>. Ten percent stands for the actual data and we compare it with our prediction to find the error. Results show that we can get less than 1% average error with this method.</p><p>The difficulty of the program is declaring the data and set the matrix. Because gradient descent and cross validation are only formula. The input of the formula comes from the matrix, which required some manipulation to make the input fit the requirement of the formulas.</p></sec><sec id="s4"><title>4. Conclusion</title><p>In this paper, we employed gradient descent method combined with cost function to predict the power output based on the input of vacuum level and temperature in a power plant. Less than 1% prediction error has been achieved. Although this is a preliminary study, with more complicated gradient method by incorporating more physical parameters, more accurate results could be anticipated. Moreover, we believe this method could be extended to other areas.</p></sec><sec id="s5"><title>Conflicts of Interest</title><p>The author declares no conflicts of interest regarding the publication of this paper.</p></sec><sec id="s6"><title>Cite this paper</title><p>Liao, Y.L. (2019) Linear Regression and Gradient Descent Method for Electricity Output Power Prediction. Journal of Computer and Communications, 7, 31-36. https://doi.org/10.4236/jcc.2019.712004</p></sec></body><back><ref-list><title>References</title><ref id="scirp.97119-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">El-Sharkh, M.Y., et al. (2004) A Dynamic Model for a Stand-Alone PEM Fuel Cell Power Plant for Residential Applications. Journal of Power Sources, 138, 199-204. https://doi.org/10.1016/j.jpowsour.2004.06.037</mixed-citation></ref><ref id="scirp.97119-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">Tüfekci, P. (2014) Prediction of Full Load Electrical Power Output of a Base Load Operated Combined Cycle Power Plant Using Machine Learning Methods. International Journal of Electrical Power &amp; Energy Systems, 60, 126-140. https://doi.org/10.1016/j.ijepes.2014.02.027</mixed-citation></ref><ref id="scirp.97119-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Quan, H., Srinivasan, D. and Khosravi, A. (2013) Short-Term Load and Wind Power Forecasting Using Neural Network-Based Prediction Intervals. IEEE Transactions on Neural Networks and Learning Systems, 25, 303-315. https://doi.org/10.1109/TNNLS.2013.2276053</mixed-citation></ref><ref id="scirp.97119-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Na, M.G., Jung, D.W., Shin, S.H., Jang, J.W., Lee, K.B. and Lee, Y.J. (2005) A Model Predictive Controller for Load-Following Operation of PWR Reactors. IEEE Transactions on Nuclear Science, 52, 1009-1020. https://doi.org/10.1109/TNS.2005.852651</mixed-citation></ref><ref id="scirp.97119-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Liu, J., Fang, W.L., Zhang, X.D. and Yang, C.X. (2015) An Improved Photovoltaic Power Forecasting Model with the Assistance of Aerosol Index Data. IEEE Transactions on Sustainable Energy, 6, 434-442. https://doi.org/10.1109/TSTE.2014.2381224</mixed-citation></ref><ref id="scirp.97119-ref6"><label>6</label><mixed-citation publication-type="book" xlink:type="simple">Weiss, S.M., Kapouleas, I. and Shavlik, J.W. (1990) An Empirical Comparison of Pattern Recognition, Neural Nets and Machine Learning Classification Methods. In: Shavlik, J.W. and Dietterich, T.G., Eds., Readings in Machine Learning, Morgan Kaufmann Publishers, San Mateo, 177-183.</mixed-citation></ref><ref id="scirp.97119-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">Riesen, K. and Bunke, H. (2008) IAM Graph Database Repository for Graph Based Pattern Recognition and Machine Learning. In: Joint IAPR International Workshops on Statistical Techniques in Pattern Recognition (SPR) and Structural and Syntactic Pattern Recognition (SSPR), Springer, Berlin, Heidelberg, 287-297. https://doi.org/10.1007/978-3-540-89689-0_33</mixed-citation></ref><ref id="scirp.97119-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">Deng, L. and Li, X. (2013) Machine Learning Paradigms for Speech Recognition: An Overview. IEEE Transactions on Audio, Speech, and Language Processing, 21, 1060-1089. https://doi.org/10.1109/TASL.2013.2244083</mixed-citation></ref><ref id="scirp.97119-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">Liu, Y., et al. (2006) A Study in Machine Learning from Imbalanced Data for Sentence Boundary Detection in Speech. Computer Speech &amp; Language, 20, 468-494. https://doi.org/10.1016/j.csl.2005.06.002</mixed-citation></ref><ref id="scirp.97119-ref10"><label>10</label><mixed-citation publication-type="other" xlink:type="simple">Sebastiani, F. (2002) Machine Learning in Automated Text Categorization. ACM Computing Surveys, 34, 1-47. https://doi.org/10.1145/505282.505283</mixed-citation></ref><ref id="scirp.97119-ref11"><label>11</label><mixed-citation publication-type="other" xlink:type="simple">Joachims, T. (1998) Text Categorization with Support Vector Machines: Learning with Many Relevant Features. In: European Conference on Machine Learning, Springer, Berlin, Heidelberg, 137-142. https://doi.org/10.1007/BFb0026683</mixed-citation></ref><ref id="scirp.97119-ref12"><label>12</label><mixed-citation publication-type="other" xlink:type="simple">Dogan, ü., Edelbrunner, J. and Iossifidis, I. (2011) Autonomous Driving: A Comparison of Machine Learning Techniques by Means of the Prediction of Lane Change Behavior. IEEE International Conference on Robotics and Biomimetics, Phuket Island, 7-11 December 2011, 1837-1843. https://doi.org/10.1109/ROBIO.2011.6181557</mixed-citation></ref><ref id="scirp.97119-ref13"><label>13</label><mixed-citation publication-type="other" xlink:type="simple">Sallab, A.E.L., et al. (2017) Deep Reinforcement Learning Framework for Autonomous Driving. Electronic Imaging, 19, 70-76. https://doi.org/10.2352/ISSN.2470-1173.2017.19.AVM-023</mixed-citation></ref><ref id="scirp.97119-ref14"><label>14</label><mixed-citation publication-type="other" xlink:type="simple">Foster, K.R., Koprowski, R. and Skufca, J.D. (2014) Machine Learning, Medical Diagnosis, and Biomedical Engineering Research-Commentary. Biomedical Engineering Online, 13, 94. https://doi.org/10.1186/1475-925X-13-94</mixed-citation></ref><ref id="scirp.97119-ref15"><label>15</label><mixed-citation publication-type="other" xlink:type="simple">Kononenko, I. (2001) Machine Learning for Medical Diagnosis: History, State of the Art and Perspective. Artificial Intelligence in Medicine, 23, 89-109. https://doi.org/10.1016/S0933-3657(01)00077-X</mixed-citation></ref><ref id="scirp.97119-ref16"><label>16</label><mixed-citation publication-type="other" xlink:type="simple">Ben-Hur, A., et al. (2008) Support Vector Machines and Kernels for Computational Biology. PLoS Computational Biology, 4, e1000173. https://doi.org/10.1371/journal.pcbi.1000173</mixed-citation></ref><ref id="scirp.97119-ref17"><label>17</label><mixed-citation publication-type="other" xlink:type="simple">Angermueller, C., et al. (2016) Deep Learning for Computational Biology. Molecular Systems Biology, 12, 878. https://doi.org/10.15252/msb.20156651</mixed-citation></ref><ref id="scirp.97119-ref18"><label>18</label><mixed-citation publication-type="other" xlink:type="simple">Zinkevich, M., et al. (2010) Parallelized Stochastic Gradient Descent. Advances in Neural Information Processing Systems, 23, 2595-2603.</mixed-citation></ref><ref id="scirp.97119-ref19"><label>19</label><mixed-citation publication-type="other" xlink:type="simple">Andrychowicz, M., et al. (2016) Learning to Learn by Gradient Descent by Gradient Descent. Proceedings of the 30th International Conference on Neural Information Processing Systems, Barcelona, 5-10 December 2016, 3988-3996.</mixed-citation></ref></ref-list></back></article>