You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/02/26 04:37:33 UTC

[GitHub] [spark] zhengruifeng commented on pull request #31657: [Spark-34448][3.0][DO NOT MERGE] Binary logistic regression incorrectly computes the intercept and coefficients when data is not centered

zhengruifeng commented on pull request #31657:
URL: https://github.com/apache/spark/pull/31657#issuecomment-786405441


   logs for first commit:
   ```
   [info] LogisticRegressionSuite:
   featuresMean: [0.4999142959117828,1.4847274177074965]
   featuresStd: [0.28501348037270735,0.28375633081273305]
   optimizer: breeze.optimize.LBFGS@e0d13c1
   initialCoefWithInterceptMatrix 0.0  0.0  -3.548107045716773  
   gradient: [-0.002305300414829984,-0.001540091613926333,3.625153510711243E-16]
   solution: 0.0,0.0,-3.548107045716773
   gradient: [1.270197141453041,3.420900875935085,0.6340310033871515]
   gradient: [0.02712239947522615,0.07838873390702962,0.014843589590906155]
   gradient: [5.742212568839818E-5,0.004963605142872151,0.0012130388688036885]
   gradient: [-0.0011314004879724678,0.0016935454656592792,6.032615470892342E-4]
   solution: 0.004180284984790963,0.002792704069058841,-3.5481070457167734
   gradient: [-0.0010728634715018125,0.00160772260209591,5.917007493574007E-4]
   gradient: [-0.0010434636154917003,0.0015652858941190642,5.860092709095692E-4]
   gradient: [-9.99199410343589E-4,0.0015022235418333052,5.775831071855921E-4]
   solution: 0.010568018954399284,7.631146700935471E-4,-3.549657937366679
   gradient: [1.2390525210071498E-4,1.4717833756368236E-4,3.984793999995559E-4]
   solution: 0.06279624904315896,-0.014248302675022488,-3.571101773719935
   gradient: [9.7770168512076E-5,-1.373828594793572E-4,3.400255628368619E-4]
   gradient: [8.481446986403304E-5,-2.790060362521768E-4,3.1093063707884655E-4]
   solution: 0.06716764247861332,-0.013115419667116011,-3.588130852021863
   gradient: [-9.968656875832441E-5,-0.0021390619743561936,-1.5963325443471433E-4]
   solution: 0.09216063924943523,0.009066818457207741,-3.767127156279349
   gradient: [-1.1037293015684862E-4,-0.001941870473764838,-2.5262563678862614E-4]
   solution: 0.09825523866837622,0.03454325895969772,-3.915627606930046
   gradient: [-2.0482663038072557E-5,-4.43210469688911E-4,-7.738226665332456E-5]
   solution: 0.08968371353490419,0.055787393265421564,-4.005407480573733
   gradient: [-7.5354046131570336E-6,-5.834078775921241E-5,-1.3492011139001316E-5]
   solution: 0.08582579292847434,0.05750880834200776,-4.005067048017333
   gradient: [-9.990118197823818E-7,-1.9016389487075713E-6,-8.202512294008946E-7]
   solution: 0.08520584612951042,0.057117003687867866,-4.001392447236977
   gradient: [-2.1269163009208114E-8,1.6634162741361534E-7,1.4415507203052513E-8]
   solution: 0.08518495364769638,0.05703053481014659,-4.000866357569121
   gradient: [-1.0143803239515137E-10,6.222596734389185E-9,1.0190080001226675E-9]
   solution: 0.08518662793392717,0.05702725297223899,-4.000852573726639
   Just the blr data
   Coefficients: [0.29888631170192387,0.20097261903867272]
   Intercept: -4.000852573726639
   objectives: 0.12762747240529596,0.1276204770445784,0.1276095137555505,0.12756395823655467,0.12755829996951326,0.12751789363970717,0.12749589534392758,0.1274859125261507,0.12748551910072972,0.12748550724997348,0.12748550712365025,0.127485507123459
   featuresMean: [0.4999142959117828,1.4847274177074965,0.9899999976158129]
   featuresStd: [0.28501348037270735,0.28375633081273305,0.03000002215257344]
   optimizer: breeze.optimize.LBFGS@225c477f
   initialCoefWithInterceptMatrix 0.0  0.0  0.0  -3.548107045716773  
   gradient: [-0.002305300414829984,-0.001540091613926333,-4.4666644349528265E-5,3.625153510711243E-16]
   solution: 0.0,0.0,0.0,-3.548107045716773
   gradient: [1.4043881959417224,3.884356710917848,23.954743028917907,0.7257390266235928]
   gradient: [0.031201599585874356,0.09016374509441172,0.5634823144261903,0.017072723505223292]
   gradient: [3.232595426584435E-4,0.005753607491472995,0.044972059597789826,0.0013638840438085728]
   gradient: [-0.0012590176292179422,0.001365692563291016,0.01789481499206562,5.435186208776085E-4]
   solution: 0.003361311019887606,0.0022455758391510356,6.512751349352555E-5,-3.5481070457167734
   gradient: [-0.0012058526178998585,0.0013107514665489008,0.017161368441663608,5.216994435121182E-4]
   gradient: [-0.0011790396852133288,0.001284089723365383,0.01679996576337007,5.109510894332127E-4]
   gradient: [-0.0011385318209425725,0.0012451072263457426,0.016264501895099932,4.950297871192996E-4]
   gradient: [-0.0010771199438327206,0.0011889041731884607,0.015476221524179956,4.715998596198084E-4]
   solution: 0.014585851627457428,0.009492561757612174,-0.0017615363470460436,-3.5481690479854455
   gradient: [1.538887596861738E-4,5.298765454822907E-4,0.003464779223103357,1.160666951868568E-4]
   solution: 0.08327888456493171,0.05384078236770347,-0.012962432443477992,-3.548558824766501
   gradient: [-3.2589948482520296E-6,1.0213435092852024E-6,1.9811253571497672E-5,1.1886786287249719E-5]
   solution: 0.08453485443429141,0.05463738823981839,-0.013274937663181247,-3.548583974676902
   gradient: [-2.385174172773077E-7,5.526130808482889E-7,-3.4939774539634526E-7,1.1294707984496084E-5]
   solution: 0.0846875705174748,0.054735933110898506,-0.013299818781811643,-3.548585606117963
   gradient: [-3.3810264008587864E-7,2.670868522249066E-7,-1.75510037687809E-6,1.125118225882494E-5]
   gradient: [-3.878950828871268E-7,1.243242276239016E-7,-2.4579490735686702E-6,1.1229419476802874E-5]
   gradient: [-4.6258353642127757E-7,-8.981909696433376E-8,-3.5122188552941224E-6,1.1196775406189872E-5]
   gradient: [-5.746157420832957E-7,-4.1103270748129716E-7,-5.09361616893375E-6,1.1147809527964553E-5]
   gradient: [-7.426629843554906E-7,-8.928500247250781E-7,-7.465695576017879E-6,1.1074361225055086E-5]
   gradient: [-9.947314471921232E-7,-1.6155690306649716E-6,-1.1023777437736044E-5,1.0964189927105351E-5]
   gradient: [-1.3728287414776048E-6,-2.699631852435118E-6,-1.636081641822193E-5,1.0798935582432377E-5]
   gradient: [-1.939962530948605E-6,-4.325690796620734E-6,-2.4366186309353907E-5,1.0551059920859132E-5]
   gradient: [-2.7906358765086735E-6,-6.764699811755861E-6,-3.637381684693582E-5,1.0179259601508278E-5]
   gradient: [-4.0665843845300455E-6,-1.0423034688555446E-5,-5.438430802060975E-5,9.621588762150324E-6]
   solution: 0.0846875705174748,0.054735933110898506,-0.013299818781811643,-3.548585606117963
   gradient: [-2.385174172773077E-7,5.526130808482889E-7,-3.4939774539634526E-7,1.1294707984496084E-5]
   gradient: [-3.440101174710719E-7,2.140211317141052E-7,-2.358906082786234E-6,1.123348788290265E-5]
   gradient: [-3.967563806994008E-7,4.4725463667759864E-8,-3.3636584917312575E-6,1.1202877885420761E-5]
   gradient: [-4.7587566701034233E-7,-2.09217654962913E-7,-4.870784943797389E-6,1.115696295650889E-5]
   gradient: [-5.94554352885666E-7,-5.901314705197364E-7,-7.131469709530847E-6,1.1088090713180832E-5]
   gradient: [-7.725718324804517E-7,-1.161500254371333E-6,-1.0522485813565708E-5,1.0984782686918663E-5]
   gradient: [-1.0395968172452967E-6,-2.0185490637795736E-6,-1.5608985118804412E-5,1.0829821408901281E-5]
   gradient: [-1.4401315155747625E-6,-3.304112455660856E-6,-2.323867816976326E-5,1.059738120594298E-5]
   gradient: [-2.040927311571323E-6,-5.2324354461108556E-6,-3.468309193828281E-5,1.024872475681238E-5]
   gradient: [-2.9421069396890685E-6,-8.124870208995275E-6,-5.1849429549435624E-5,9.725748758568528E-6]
   gradient: [-4.293844733636149E-6,-1.2463410482831362E-5,-7.75982991109886E-5,8.94130428013014E-6]
   solution: 0.0846875705174748,0.054735933110898506,-0.013299818781811643,-3.548585606117963
   blr data plus one vector that is filled with 1's and .9's
   Coefficients: [0.29713531586902586,0.1928976631256973,-0.44332696536594945]
   Intercept: -3.548585606117963
   objectives: 0.12762747240529596,0.12762184862587836,0.12758748705248976,0.12748833468678486,0.12748809482977605,0.12748809437935926,0.12748809437935926,0.12748809437935926
   
   
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org