您好,欢迎访问三七文档
当前位置:首页 > 办公文档 > 统计图表 > 理解偏差和方差平衡技术
理解偏差和方差平衡技术2014-08-2720:58459人阅读评论(0)收藏举报目录(?)[+]1.BiasandVarianceUnderstandinghowdifferentsourcesoferrorleadtobiasandvariancehelpsusimprovethedatafittingprocessresultinginmoreaccuratemodels.Wedefinebiasandvarianceinthreeways:conceptually,graphicallyandmathematically.1.偏差和方差理解不同错误导致的偏差和方差可以帮助我们提高数据对于模型的集合程度,从而提高模型的争取率。我们从三个方面来定义偏差和方差。这三个方面分别是概念定义,图形定义和数学定义。1.1ConceptualDefinitionErrorduetoBias:Theerrorduetobiasistakenasthedifferencebetweentheexpected(oraverage)predictionofourmodelandthecorrectvaluewhichwearetryingtopredict.Ofcourseyouonlyhaveonemodelsotalkingaboutexpectedoraveragepredictionvaluesmightseemalittlestrange.However,imagineyoucouldrepeatthewholemodelbuildingprocessmorethanonce:eachtimeyougathernewdataandrunanewanalysiscreatinganewmodel.Duetorandomnessintheunderlyingdatasets,theresultingmodelswillhavearangeofpredictions.Biasmeasureshowfaroffingeneralthesemodels'predictionsarefromthecorrectvalue.ErrorduetoVariance:Theerrorduetovarianceistakenasthevariabilityofamodelpredictionforagivendatapoint.Again,imagineyoucanrepeattheentiremodelbuildingprocessmultipletimes.Thevarianceishowmuchthepredictionsforagivenpointvarybetweendifferentrealizationsofthemodel1.1概念定义由于偏差导致的错误:偏差错误被认为是我们模型预测结果的期望和真实值期望之间的差异。当然你只有一个模型,所以谈论预测结果的期望有点奇怪。但是,想象一下,你不断使用新数据来构造模型,这样你就得到了多个模型,也就得到了多个预测结果。由于模型的数据是随机的,所以会产生一系列的预测。偏差就是衡量这些模型的预测与真实值的差别的。由于方差导致的错误:由于方差导致的错误被认为是一个模型对于一个数据点的预测的变化程度。想象一下,你可以构建你的模型多次。方差被认为是对于一个数据点来说预测的分散程度。1.2GraphicalDefinitionWecancreateagraphicalvisualizationofbiasandvarianceusingabulls-eyediagram.Imaginethatthecenterofthetargetisamodelthatperfectlypredictsthecorrectvalues.Aswemoveawayfromthebulls-eye,ourpredictionsgetworseandworse.Imaginewecanrepeatourentiremodelbuildingprocesstogetanumberofseparatehitsonthetarget.Eachhitrepresentsanindividualrealizationofourmodel,giventhechancevariabilityinthetrainingdatawegather.Sometimeswewillgetagooddistributionoftrainingdatasowepredictverywellandweareclosetothebulls-eye,whilesometimesourtrainingdatamightbefullofoutliersornon-standardvaluesresultinginpoorerpredictions.Thesedifferentrealizationsresultinascatterofhitsonthetarget.Wecanplotfourdifferentcasesrepresentingcombinationsofbothhighandlowbiasandvariance.1.2图形定义我们可以用一个打靶图来说明偏差和方差。想象靶心就是我们模型要预测的真实值。当我们离靶子越远时,我们的预测变得越来越糟糕。想象重复整个模型建立的过程来得到多个散点在靶子上。每一个点代表一次模型的实现。当我们接近靶心时,可以认为我们得到了好的训练数据,因此我们可以做出好的预测。但是有时我们的训练数据可能充满了异常值和不标准值,导致预测的结果不好。这些不同的实现可以看做是靶子上的散点。我们可以看四张图来代表偏差值和方差值的高低程度。1.3数学定义我们可以把要预测的变量定义为Y,协变量定义为X。我们可以推测Y和X之间有一个关系,例如Y=f(X)+e.其中e是服从正态分布的一个误差。我们可以用线性回归或者其他别的技术来做一个估计。在这种情况下,预测的错误的平方的期望就可以写作:Err(x)=E[(Y-f(x))^2]这个错误可以主要分解成偏差和方差。(如上图公式)第三项是一个噪音项,噪音项是真实存在关系中的,不能被模型去除的。当给定真实模型和无穷数据去预测这种关系的,我们就可以把偏差和方差降低到0.但是现实世界中,我们往往无法找到准确的模型和无限的数据,所以在减小偏差和方差之间就要有一个平衡技术。
本文标题:理解偏差和方差平衡技术
链接地址:https://www.777doc.com/doc-2195394 .html