mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-26 01:29:10 +00:00
analysis.py v 1.2.2.000
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
30b39aafff
commit
8f8fb6c156
@ -7,10 +7,12 @@
|
|||||||
# current benchmark of optimization: 1.33 times faster
|
# current benchmark of optimization: 1.33 times faster
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "1.2.1.002"
|
__version__ = "1.2.2.000"
|
||||||
|
|
||||||
# changelog should be viewed using print(analysis.__changelog__)
|
# changelog should be viewed using print(analysis.__changelog__)
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.2.2.000:
|
||||||
|
- changed output of regressions to function strings instead of list of coefficients
|
||||||
1.2.1.002:
|
1.2.1.002:
|
||||||
- renamed ArrayTest class to Array
|
- renamed ArrayTest class to Array
|
||||||
1.2.1.001:
|
1.2.1.001:
|
||||||
@ -412,7 +414,8 @@ def regression(inputs, outputs, args): # inputs, outputs expects N-D array
|
|||||||
|
|
||||||
popt, pcov = scipy.optimize.curve_fit(lin, X, y)
|
popt, pcov = scipy.optimize.curve_fit(lin, X, y)
|
||||||
|
|
||||||
regressions.append((popt.flatten().tolist(), None))
|
coeffs = popt.flatten().tolist()
|
||||||
|
regressions.append(str(coeffs[0]) + "*x+" + str(coeffs[1]))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
@ -428,7 +431,8 @@ def regression(inputs, outputs, args): # inputs, outputs expects N-D array
|
|||||||
|
|
||||||
popt, pcov = scipy.optimize.curve_fit(log, X, y)
|
popt, pcov = scipy.optimize.curve_fit(log, X, y)
|
||||||
|
|
||||||
regressions.append((popt.flatten().tolist(), None))
|
coeffs = popt.flatten().tolist()
|
||||||
|
regressions.append(str(coeffs[0]) + "*log(" + str(coeffs[1]) + "*(x+" + str(coeffs[2]) + "))+" + str(coeffs[3]))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
@ -444,7 +448,8 @@ def regression(inputs, outputs, args): # inputs, outputs expects N-D array
|
|||||||
|
|
||||||
popt, pcov = scipy.optimize.curve_fit(exp, X, y)
|
popt, pcov = scipy.optimize.curve_fit(exp, X, y)
|
||||||
|
|
||||||
regressions.append((popt.flatten().tolist(), None))
|
coeffs = popt.flatten().tolist()
|
||||||
|
regressions.append(str(coeffs[0]) + "*e^(" + str(coeffs[1]) + "*(x+" + str(coeffs[2]) + "))+" + str(coeffs[3]))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
@ -466,10 +471,14 @@ def regression(inputs, outputs, args): # inputs, outputs expects N-D array
|
|||||||
|
|
||||||
params = model.steps[1][1].intercept_.tolist()
|
params = model.steps[1][1].intercept_.tolist()
|
||||||
params = np.append(params, model.steps[1][1].coef_[0].tolist()[1::])
|
params = np.append(params, model.steps[1][1].coef_[0].tolist()[1::])
|
||||||
params.flatten()
|
params = params.flatten().tolist()
|
||||||
params = params.tolist()
|
|
||||||
|
|
||||||
plys.append(params)
|
temp = ""
|
||||||
|
counter = 0
|
||||||
|
for param in params:
|
||||||
|
temp += "(" + str(param) + "*x^" + str(counter) + ")"
|
||||||
|
counter += 1
|
||||||
|
plys.append(temp)
|
||||||
|
|
||||||
regressions.append(plys)
|
regressions.append(plys)
|
||||||
|
|
||||||
@ -483,7 +492,8 @@ def regression(inputs, outputs, args): # inputs, outputs expects N-D array
|
|||||||
|
|
||||||
popt, pcov = scipy.optimize.curve_fit(sig, X, y)
|
popt, pcov = scipy.optimize.curve_fit(sig, X, y)
|
||||||
|
|
||||||
regressions.append((popt.flatten().tolist(), None))
|
coeffs = popt.flatten().tolist()
|
||||||
|
regressions.append(str(coeffs[0]) + "*tanh(" + str(coeffs[1]) + "*(x+" + str(coeffs[2]) + "))+" + str(coeffs[3]))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user