From 978a9a9a256cb53b045d319d96433ecb77ee87da Mon Sep 17 00:00:00 2001 From: art Date: Tue, 18 Feb 2020 16:16:57 -0600 Subject: [PATCH] doc --- .../__pycache__/analysis.cpython-37.pyc | Bin 32774 -> 33502 bytes data analysis/analysis/analysis.py | 34 ++++++++++++------ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/data analysis/analysis/__pycache__/analysis.cpython-37.pyc b/data analysis/analysis/__pycache__/analysis.cpython-37.pyc index d43e7882fa37c1f491a18d05b2443a70e305571d..be9e95849d18caa524a13087456c900f79537377 100644 GIT binary patch delta 7729 zcmb_h4O~>$m7hCb48sf`f(i&S2%@6~QBlx}DF}!PBSnH{R3;DR0fY19od<$q#w^j+ zm{{XU(hs{?NYgZJW13{zrfu3p+w{w(X=9q2ynZFy-Rx%5Zjz?mwy90_ocji51k4(L zJN)K9=bn4+|DJR1=X)GItpCjseR`eUZq?zZ($n1e+Q~c9bJ?j!7v-=yY5jA@a>sRE zr*{c`draP?-qc%TyO_eFE6Xb?R!GO@>2%$FQm|L{hkDmp9r#&Mj(?(7E0gXzhc6K3 zp+VW};IicPb@}{0W!Mqw!D26$BN1OH=m-rc;Q=M$=o)rJ6z&U$eZgLbA_pTO?(j;A zB-k~!fyiE@3P@qcexK6k@JoR%ujEid4yn6O_6^DorB9x*%OsA=ovlcAR*?hY5SO^m zKkVr74Z%Mwxr>Bf0}=8mvez$5Jcz2+kbgKB3iu>{qbw-{7)k7R`UeV_4Q?yCjb*@W z$In=H>{Z7?#`3|oV2C;4$b!dM1yq;(m92#prPca!1MDr$OS@mujq3XKif+sR&y|%z zth8ve)oaYt^;-|6DQRAl*LJzYStIG*j62vNE0(gyaz?DMs>~Us4B)qa z-dMr74)c|(Wu`x0c9)O(d4@Oo_KWV`{2muJ^CV&Mktk8eUjHONEZYoX~Nn%xsL zZbR5V{2Ju|<1~9|vyk0}i0_&_v=jBw32L}+(Y8u!SmIJZR%9Mg4Y;4EW+@z&gI?9v z9O`Y8d$-C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+s(dnBp|}ZVu?ygcgkRn^eWE+BQDmbbFhObwmSlBNS@^ivddjR%(xp;Yyu| zjkc{~#<=A9ScB-!@Chlk`ZmFo9ncqn%)-zC$Y$Ua(yp!G!oPHaN;_A6UEt*a+yGQo z=7P!t6qaJFpbXS+7#7j(yHD5P29fCW5*^dHVQ@5M696@p=uLXo>h;SSVu^%AQt~&( z4KbYQ1IfRVwSw;>ytICiaEh(;W@4**7`sjFKk3JuD?1U?*7^Apxy?sWZF@@Nl4chH zdQ)5DF3QkohDMeR8i6+2))6Wnfiy+|TG(mtGtiGCJCE8l=-Wh{1#sVq<;{aar?yt6$GkKKm z-2ZTOUx4y@Ojj`Q_pI7_gQ<@PAKph|LhWF+VbRcyErX?&SPY43N@S~+z*vk)7^;&??{pW4P4sd1gzhgu zWj|mGpbKySa1c<$(72&d4Ln(m{GF@VxAqF)1NROL2yiE)J=q3F37!P|6xfaOG-$Q9 z-(-rP+hBA{3=FF$K`8-4ga6+5bFg5$(U`!aQKr2slA~hlh_tTJlW(YmuT`b6&ND^k zqcB4NLjeUe_fWa$plydni(Rz;&~&?cQx(#qhwgMBM{Bof6*V2+WOaz*1$6fCj6VZU CvzYP# diff --git a/data analysis/analysis/analysis.py b/data analysis/analysis/analysis.py index 671f4906..2dae3d28 100644 --- a/data analysis/analysis/analysis.py +++ b/data analysis/analysis/analysis.py @@ -7,10 +7,15 @@ # current benchmark of optimization: 1.33 times faster # setup: -__version__ = "1.1.12.000" +__version__ = "1.1.12.001" # changelog should be viewed using print(analysis.__changelog__) __changelog__ = """changelog: + 1.1.12.001: + - improved readibility of regression outputs by stripping tensor data + - used map with lambda to acheive the improved readibility + - lost numba jit support with regression, and generated_jit hangs at execution + - TODO: reimplement correct numba integration in regression 1.1.12.000: - temporarily fixed polynomial regressions by using sklearn's PolynomialFeatures 1.1.11.010: @@ -318,28 +323,33 @@ def histo_analysis(hist_data): return basic_stats(derivative)[0], basic_stats(derivative)[3] -@jit(forceobj=True) def regression(ndevice, inputs, outputs, args, loss = torch.nn.MSELoss(), _iterations = 10000, lr = 0.01, _iterations_ply = 10000, lr_ply = 0.01): # inputs, outputs expects N-D array regressions = [] Regression().set_device(ndevice) - if 'lin' in args: + if 'lin' in args: # formula: ax + b 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])) + params = model[0].parameters + params[:] = map(lambda x: x.item(), params) + regressions.append((params, model[1][::-1][0])) - if 'log' in args: + if 'log' in args: # formula: a log (b(x + c)) + d 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])) + params = model[0].parameters + params[:] = map(lambda x: x.item(), params) + regressions.append((params, model[1][::-1][0])) - if 'exp' in args: + if 'exp' in args: # formula: a e ^ (b(x + c)) + d 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])) + params = model[0].parameters + params[:] = map(lambda x: x.item(), params) + regressions.append((params, model[1][::-1][0])) - if 'ply' in args: + if 'ply' in args: # formula: a + bx^1 + cx^2 + dx^3 + ... plys = [] limit = len(outputs[0]) @@ -374,10 +384,12 @@ def regression(ndevice, inputs, outputs, args, loss = torch.nn.MSELoss(), _itera regressions.append(plys) """ - if 'sig' in args: + if 'sig' in args: # formula: a sig (b(x + c)) + d | sig() = 1/(1 + e ^ -x) 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])) + params = model[0].parameters + params[:] = map(lambda x: x.item(), params) + regressions.append((params, model[1][::-1][0])) return regressions