From 07a381b01b1a9d2103599cc7b53dfe90e5728abf Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Tue, 27 Nov 2018 18:08:39 -0600 Subject: [PATCH] 6 --- .../__pycache__/analysis.cpython-37.pyc | Bin 22921 -> 23794 bytes data analysis/analysis.py | 62 +++++++++++++++++- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/data analysis/__pycache__/analysis.cpython-37.pyc b/data analysis/__pycache__/analysis.cpython-37.pyc index 6cd5efbeb0eb07cc6c65475917e20d0f144b2783..c1b475c5fc788fc5f0c795a1697a15f294199c8e 100644 GIT binary patch delta 2078 zcmaJ?U2GIp6rOWuc6Yk;2X;$;XuEE!mTZ91E+9|}RD`zlXA6|F+ZHHG?^v65ciTHd zX~~i%wh~P+)ZUmFUsQ;M7l~wrgrGhc6JJaW@#kSRK5C2+1wue0spm}Bc0uAy?|1H= z-|yaY@AS14+_?_=fD1582YFh0L@*ZB#x6Oe35!Q4!@n-bd%3Jtel=Zxq zxAFEF=-tLUcnCEOyp!)kxt;Il2T<oJ zg;VeYg1s7G<KgYK$AF+_3~V{Du$-5dcww;Q=Q4QHaBGtg~>+w8YS8 zKe2clid(BhfU)xP!vl^Vo?i*RZ(a$4n$y3Ij!Mv;BZd# zS}JEr#?@k?r|wpcG@W)OwRbhkk;FwLUDGO`Vx`J^07}yFh+55PosVd>1?^ZctW2E2 z^fQ2sf;+R4kYsG6NrdKBKrRl(UVh;^UNml-{3_e@!Wrj#92g{g|U*blGKupq;pWkGvExJ zDiVg77&&1LCF1_r3Dfc)H~d3!ORT^iitPju1mhQu7|2O$*5s%mCP`0+MC>HkOt6d~ zkD!Mj7a^dFb2OhtNIUyQG(Kpg-Ae`W=#80aO~gzyt%{&2VMSqA+M5`)hGIjfjDBGZ zqO*zAF43W@#WV`bWjfRBw}=%%5v*b*j4>bhpo%$}`;lL{OkBp8)Rp?z0lrD?Y*+@R zwPIBJ!E$CWp9$N;%rx?!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x-X?O%K2s*-YI0yP3MWL*%D U5pf$D$5ZeQ?Hr$^ugBN?3u96@{{R30 diff --git a/data analysis/analysis.py b/data analysis/analysis.py index fb346164..3172c8a0 100644 --- a/data analysis/analysis.py +++ b/data analysis/analysis.py @@ -618,10 +618,10 @@ def exp_regression(x, y, base): y_fit = [] for i in range(len(y)): - + y_fit.append(np.log(y[i]) / np.log(base)) #change of base for logs - reg_eq = np.polyfit(x, y_fit, 1, w=np.sqrt(y)) # y = base ^ (reg_eq[0] * x) * base ^ (reg_eq[1]) + reg_eq = np.polyfit(x, y_fit, 1, w=np.sqrt(y_fit)) # y = base ^ (reg_eq[0] * x) * base ^ (reg_eq[1]) eq_str = "(" + str(base) + "**(" + str(reg_eq[0]) + "*z))*(" + str(base) + "**(" + str(reg_eq[1]) + "))" @@ -663,6 +663,64 @@ def rms(predictions, targets): # assumes equal size inputs return float(out) +def strip_data(data, mode): + + if mode == "adam": #x is the row number, y are the data + + pass + + if mode == "eve": #x are the data, y is the column number + + pass + + else: + + raise error("mode error") + +def optimize_regression(x, y, _range, resolution):#_range in poly regression is the range of powers tried, and in log/exp it is the inverse of the stepsize taken from -1000 to 1000 + + if type(resolution) != int: + + raise error("resolution must be int") + + eqs = [] + + rmss = [] + + r2s = [] + + for i in range (0, _range + 1, 1): + + eqs.append(poly_regression(x, y, i)[0]) + rmss.append(poly_regression(x, y, i)[1]) + r2s.append(poly_regression(x, y, i)[2]) + + for i in range (1, 100 * resolution + 1): + + try: + + eqs.append(exp_regression(x, y, float(i / resolution))[0]) + rmss.append(exp_regression(x, y, float(i / resolution))[1]) + r2s.append(exp_regression(x, y, float(i / resolution))[2]) + + except: + + pass + + for i in range (1, 100 * resolution + 1): + + try: + + eqs.append(log_regression(x, y, float(i / resolution))[0]) + rmss.append(log_regression(x, y, float(i / resolution))[1]) + r2s.append(log_regression(x, y, float(i / resolution))[2]) + + except: + + pass + + return [eqs, rmss, r2s] + def basic_analysis(filepath): #assumes that rows are the independent variable and columns are the dependant. also assumes that time flows from lowest column to highest column. data = load_csv(filepath)