From 56b575a7531d84532d691f2a482570991ff018ea Mon Sep 17 00:00:00 2001 From: art Date: Fri, 25 Oct 2019 09:19:18 -0500 Subject: [PATCH] analysis.py v 1,1,5,001 --- .../__pycache__/analysis.cpython-37.pyc | Bin 21478 -> 20902 bytes .../__pycache__/trueskill.cpython-37.pyc | Bin 32167 -> 32174 bytes data analysis/analysis/analysis.py | 84 +++++------------- 3 files changed, 24 insertions(+), 60 deletions(-) diff --git a/data analysis/analysis/__pycache__/analysis.cpython-37.pyc b/data analysis/analysis/__pycache__/analysis.cpython-37.pyc index 2b00907edf29617257e93b9f88015578d4674091..87dd500e72db8362645c72277f6faf0fe1ac69f1 100644 GIT binary patch delta 3955 zcmb_fdu&tJ8NcV+*LIvZ$?_l%1mpo(th}5+fF>y+kQamy;y}{6A(4q4$9dT1_y&?< z#9G>oQM%H88(Z4}Nwb!1)wXt7r~bjJu~+wys5Dh$vNW~Yv`Mt9#x!->v_G=*JJ(69 z(5n1_Bmex}@0|1d9_KsXJ^9-;_R0cF-{WxD74f;n7LT6uyq@k-H`Q0WTrO{OmZFS| zc|!sJWH``ZudS}FmIDoxomEm;q=$>RKfwLbXfPZqcQzJHhjf2b_xl#z>QMH9wwkf< zl)uJ1IbFlU$HIDWBwC~MI#*p?RaEC*-5;2(@p*M`kvHU>oQ(#fHFpWsky)N2JbRly z&OOh5OJ7*`Cw7yD@;+dHpndtB%tO!RSFpd(TltsS2Q*mlANDUgQn+*5byZPfDL!RF zN zOL+Wd!n+J4y#Kx?JZA4xoQ{LMmR{RbU&%8?ecoOYpSVe!lDNq~6Y-cLle4!)4Jx;B zuso({FyPGOTPdfgjfRS5Sq=TM==k;}F&1?RP)s&vS8b|U;(k`9+SSe^G^?5FAgdHw zp{Hxb0ZXk|#2=)b5_fAEJaTfVQ^!v@F>|y#`dA0`M8!3Iu3#^-}%kt=_TMk(s z0r{XDP7|VA3_P576v`4nsQ{;Ts=ma#=L`6Wuq^oqR;v*5kFDtjOz4T#aHM>TIRi|vohS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88A3D|@=$e#^6q{G7tSH{BjAHD z)=k(H6pw;pEh!d&A3*FVzK@r=2=ME&bUB?#e#q{v$N<#6i0}=BZ^E8l%lcs^YKA-i sz@SE48GvVcI~Ba`=^6O2*C(&jNje$cZq0%pwJI>YXDitQFYL+v4>FGSMgRZ+ diff --git a/data analysis/analysis/__pycache__/trueskill.cpython-37.pyc b/data analysis/analysis/__pycache__/trueskill.cpython-37.pyc index dad0acd321b5dde2c586863393dff1b492003f68..e906e4739e6c73d7c7fe1c5c82d35af7b9b1c598 100644 GIT binary patch delta 2663 zcmZ{m3s96*6vw&C?#If)wn7M~6qHVFlVX&Jg0zB&sAX2pG;6ti$}VoQKzCPpNR!&b zsi_7$NKTSSO<|G-eE1rzY|0)}O=;R=dnmngilJtD4Wo7b_aoPu31)tC?z!ild(Y$E zZ@Wjto)O_JNls3TWLG zjk0GBh;}+TbC%f3ZZ@WD#lnjiZi^fXxrL66Nu~X>HfWDy_yiRf7O>Cy!uz!+pm>}_ z(Rk}N7D+Em6PsyzQL#hKn1`pKf=koedHPZ8Y-ho4Nz&}`c1^bP?wRy%(N@txf!PIO zy9(sM>^-7|s)`q;KFP*WZA~2~%r6UhAh*-e;wwd~F;qOCb3`*d6})JJ=ZcvyHBCBM za@*C}qqbm8rN1F+TUqN51mt$u2G9H}SX-h?cBo);N;ip}^jzr_m#W`$@U;u* zQL+D3`oZ;TA_KZi0JV@VWdg)jY~rEYVIEZVfjU?>jV+tSRajKEfXTT}-N|+z#j2j9 z$({68*)GvTk$I&SBaU`7WYDpB^V53azYd7)-bYi*vqZn@0bhBJ*h?GAUlIq&GvCnq zVY*FCB~@H04$;r~nRH{tutPcWVD_+4v0#O;KFczB7EUzYUbsoPUc$@~;1%Fi@?1M< z!eJKEEZiYUEZBw9!5yOh*+-PFD0K+c;`9AdaNGkvDT`K8a(`kTL+1_Svv5P_-LQZi=x7N)$w zGGI4#-IQVU+%h8gDBVllVxMtr=^V?Vr!ZLzT+eVPnw^teOoA=-+)ug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0RoiYT3IT`p zDU-^WvITT9osG}bKYe03OMM@F2jD2+1HeNl9Xm{~PR?M5_3e|VG8>YTBgl1%Ep;Sy z;h_m*7Rgomg7vUqF{ZRg&7!y|%{EyrISRXEen+RA?)@=*pomztvY@NnD@Mi%*(|^= zYMpv;z;Td=1gMHp+j~yNVC{sySccp*?PM-2`3XP>KE_n?sLv-*bvXm(j3@ zaoN@xDr?s-&KPTAEtEO4m(mWC(^N1sE$INrVt^NL7N_d9GyUca>;U6wnj#5eDR~1G zu4;`7liRa?Rq+M`eUr3KbvH0L@pFz#w>q`Swb zg+lIttH$lEcs3N|5t=tQh3%(Ru1so}dm_zgBE$nlfiyf^!*C1T-P;JF}|#gdEd2ZZ>R zR%*@9A4H%#FGCvq1l@T6f<+Q4c;&(>SI}GM=3hYiCEz>2kAR;6DFQ?`7eIdlhyY|H z8S^68E+>QC4@lMDD)X4x6-w~TFt)$EwgO!fReDkf{ok39c)vH`DtG%r8ovVb->KEZ z*&lk}itkM944D^9W}W)f1tpA~lY_rxRxIs(Zsm}3!dPs#)9^vwJQXlsKrge{$R

w8d@jfw+b0JseJ6M*6weUneNf!_6HrruY@PT2fHmwct!IGT?K$T?jF z>Nmh2fUAK0RO(N+eFgGszyad^Y(*y9slVY*H;chgR zsrbF+ORla$dtUcX&_QUcGF>M>t&0w;XplJ8(rhWu!FJ9elXko0zMdFMFFzhao)VAb&C3BCRf!-J+Vh+@8_wV~r;qeW9H&?tz;vyF0rv zj9;VQ>xLyqlQtP{=V6?JYrNFO7(8_*_sn`BW;3ggX<^gFTs?KSXsD|gv$OIXFfVs; zy-E6_Cfj>L%8vlHP-*?VR06pM&$jom+ L+oi$OYjNYhFHh-N diff --git a/data analysis/analysis/analysis.py b/data analysis/analysis/analysis.py index 3b1d9844..fa0f6245 100644 --- a/data analysis/analysis/analysis.py +++ b/data analysis/analysis/analysis.py @@ -7,10 +7,12 @@ # current benchmark of optimization: 1.33 times faster # setup: -__version__ = "1.1.5.000" +__version__ = "1.1.5.001" # changelog should be viewed using print(analysis.__changelog__) __changelog__ = """changelog: +1.1.5.001: + - simplified regression by using .to(device) 1.1.5.000: - added polynomial regression to regression(); untested 1.1.4.000: @@ -256,81 +258,43 @@ def histo_analysis(hist_data): def regression(device, inputs, outputs, args, loss = torch.nn.MSELoss(), _iterations = 10000, lr = 0.01, _iterations_ply = 10000, lr_ply = 0.01, power_limit = None): # inputs, outputs expects N-D array if power_limit == None: - power_limit = len(outputs[0]) + power_limit = len(outputs) else: power_limit += 1 regressions = [] + Regression.set_device(device) - if 'cuda' in device: + if 'lin' in args: - Regression.set_device(device) + model = Regression.SGDTrain(Regression.LinearRegKernel(len(inputs)), torch.tensor(inputs).to(torch.float).to(device), torch.tensor([outputs]).to(torch.float).to(device), iterations=_iterations, learning_rate=lr, return_losses=True) + regressions.append((model[0].parameters, model[1][::-1][0])) - if 'lin' in args: + if 'log' in args: - model = Regression.SGDTrain(Regression.LinearRegKernel(len(inputs)), torch.tensor(inputs).to(torch.float).cuda(), torch.tensor([outputs]).to(torch.float).cuda(), iterations=_iterations, learning_rate=lr, return_losses=True) - regressions.append((model[0].parameters, model[1][::-1][0])) + model = Regression.SGDTrain(Regression.LogRegKernel(len(inputs)), torch.tensor(inputs).to(torch.float).to(device), torch.tensor(outputs).to(torch.float).to(device), iterations=_iterations, learning_rate=lr, return_losses=True) + regressions.append((model[0].parameters, model[1][::-1][0])) - if 'log' in args: + if 'exp' in args: - model = Regression.SGDTrain(Regression.LogRegKernel(len(inputs)), torch.tensor(inputs).to(torch.float).cuda(), torch.tensor(outputs).to(torch.float).cuda(), iterations=_iterations, learning_rate=lr, return_losses=True) - regressions.append((model[0].parameters, model[1][::-1][0])) + model = Regression.SGDTrain(Regression.ExpRegKernel(len(inputs)), torch.tensor(inputs).to(torch.float).to(device), torch.tensor(outputs).to(torch.float).to(device), iterations=_iterations, learning_rate=lr, return_losses=True) + regressions.append((model[0].parameters, model[1][::-1][0])) - if 'exp' in args: + if 'ply' in args: - model = Regression.SGDTrain(Regression.ExpRegKernel(len(inputs)), torch.tensor(inputs).to(torch.float).cuda(), torch.tensor(outputs).to(torch.float).cuda(), iterations=_iterations, learning_rate=lr, return_losses=True) - regressions.append((model[0].parameters, model[1][::-1][0])) + plys = [] - if 'ply' in args: + for i in range(2, power_limit): - plys = [] + model = Regression.SGDTrain(Regression.PolyRegKernel(len(inputs),i), torch.tensor(inputs).to(torch.float).to(device), torch.tensor(outputs).to(torch.float).to(device), iterations=_iterations_ply * 10 ** i, learning_rate=lr_ply * 10 ** -i, return_losses=True) + plys.append((model[0].parameters, model[1][::-1][0])) + + regressions.append(plys) - for i in range(2, power_limit): + if 'sig' in args: - model = Regression.SGDTrain(Regression.PolyRegKernel(len(inputs),i), torch.tensor(inputs).to(torch.float).cuda(), torch.tensor(outputs).to(torch.float).cuda(), iterations=_iterations_ply * 10 ** i, learning_rate=lr_ply * 10 ** -i, return_losses=True) - plys.append((model[0].parameters, model[1][::-1][0])) - - regressions.append(plys) - - if 'sig' in args: - - model = Regression.SGDTrain(Regression.SigmoidalRegKernelArthur(len(inputs)), torch.tensor(inputs).to(torch.float).cuda(), torch.tensor(outputs).to(torch.float).cuda(), iterations=_iterations, learning_rate=lr, return_losses=True) - regressions.append((model[0].parameters, model[1][::-1][0])) - - else: - - Regression.set_device(device) - - if 'linear' in args: - - model = Regression.SGDTrain(Regression.LinearRegKernel(len(inputs)), torch.tensor(inputs).to(torch.float), torch.tensor(outputs).to(torch.float), iterations=_iterations, learning_rate=lr, return_losses=True) - regressions.append((model[0].parameters, model[1][::-1][0])) - - if 'log' in args: - - model = Regression.SGDTrain(Regression.LogRegKernel(len(inputs)), torch.tensor(inputs).to(torch.float), torch.tensor(outputs).to(torch.float), iterations=_iterations, learning_rate=lr, return_losses=True) - regressions.append((model[0].parameters, model[1][::-1][0])) - - if 'exp' in args: - - model = Regression.SGDTrain(Regression.ExpRegKernel(len(inputs)), torch.tensor(inputs).to(torch.float), torch.tensor(outputs).to(torch.float), iterations=_iterations, learning_rate=lr, return_losses=True) - regressions.append((model[0].parameters, model[1][::-1][0])) - - if 'ply' in args: - - plys = [] - - for i in range(2, power_limit): - - model = Regression.SGDTrain(Regression.PolyRegKernel(len(inputs),i), torch.tensor(inputs).to(torch.float), torch.tensor(outputs).to(torch.float), iterations=_iterations_ply * 10 ** i, learning_rate=lr_ply * 10 ** -i, return_losses=True) - plys.append((model[0].parameters, model[1][::-1][0])) - - regressions.append(plys) - - if 'sig' in args: - - model = Regression.SGDTrain(Regression.SigmoidalRegKernelArthur(len(inputs)), torch.tensor(inputs).to(torch.float), torch.tensor(outputs).to(torch.float), iterations=_iterations, learning_rate=lr, return_losses=True) - regressions.append((model[0].parameters, model[1][::-1][0])) + model = Regression.SGDTrain(Regression.SigmoidalRegKernelArthur(len(inputs)), torch.tensor(inputs).to(torch.float).to(device), torch.tensor(outputs).to(torch.float).to(device), iterations=_iterations, learning_rate=lr, return_losses=True) + regressions.append((model[0].parameters, model[1][::-1][0])) return regressions