mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-11-10 06:54:44 +00:00
analysis.py v 1.1.12.000
This commit is contained in:
parent
a92d28ace7
commit
1ae56f8dfd
Binary file not shown.
Binary file not shown.
@ -7,10 +7,12 @@
|
|||||||
# current benchmark of optimization: 1.33 times faster
|
# current benchmark of optimization: 1.33 times faster
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "1.1.11.010"
|
__version__ = "1.1.12.000"
|
||||||
|
|
||||||
# changelog should be viewed using print(analysis.__changelog__)
|
# changelog should be viewed using print(analysis.__changelog__)
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.1.12.000:
|
||||||
|
- temporarily fixed polynomial regressions by using sklearn's PolynomialFeatures
|
||||||
1.1.11.010:
|
1.1.11.010:
|
||||||
- alphabeticaly ordered import lists
|
- alphabeticaly ordered import lists
|
||||||
1.1.11.009:
|
1.1.11.009:
|
||||||
@ -317,10 +319,10 @@ def histo_analysis(hist_data):
|
|||||||
return basic_stats(derivative)[0], basic_stats(derivative)[3]
|
return basic_stats(derivative)[0], basic_stats(derivative)[3]
|
||||||
|
|
||||||
@jit(forceobj=True)
|
@jit(forceobj=True)
|
||||||
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
|
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 = []
|
regressions = []
|
||||||
Regression().set_device(device)
|
Regression().set_device(ndevice)
|
||||||
|
|
||||||
if 'lin' in args:
|
if 'lin' in args:
|
||||||
|
|
||||||
@ -340,6 +342,25 @@ def regression(device, inputs, outputs, args, loss = torch.nn.MSELoss(), _iterat
|
|||||||
if 'ply' in args:
|
if 'ply' in args:
|
||||||
|
|
||||||
plys = []
|
plys = []
|
||||||
|
limit = len(outputs[0])
|
||||||
|
|
||||||
|
for i in range(2, limit):
|
||||||
|
|
||||||
|
model = sklearn.preprocessing.PolynomialFeatures(degree = i)
|
||||||
|
model = sklearn.pipeline.make_pipeline(model, sklearn.linear_model.LinearRegression())
|
||||||
|
model = model.fit(np.rot90(inputs), np.rot90(outputs))
|
||||||
|
|
||||||
|
params = model.steps[1][1].intercept_.tolist()
|
||||||
|
params = np.append(params, model.steps[1][1].coef_[0].tolist()[1::])
|
||||||
|
params.flatten()
|
||||||
|
params = params.tolist()
|
||||||
|
|
||||||
|
plys.append(params)
|
||||||
|
|
||||||
|
regressions.append(plys)
|
||||||
|
|
||||||
|
""" non functional and dep
|
||||||
|
plys = []
|
||||||
|
|
||||||
if power_limit == None:
|
if power_limit == None:
|
||||||
|
|
||||||
@ -351,6 +372,7 @@ def regression(device, inputs, outputs, args, loss = torch.nn.MSELoss(), _iterat
|
|||||||
plys.append((model[0].parameters, model[1][::-1][0]))
|
plys.append((model[0].parameters, model[1][::-1][0]))
|
||||||
|
|
||||||
regressions.append(plys)
|
regressions.append(plys)
|
||||||
|
"""
|
||||||
|
|
||||||
if 'sig' in args:
|
if 'sig' in args:
|
||||||
|
|
||||||
|
@ -24,4 +24,10 @@ __all__ = [
|
|||||||
|
|
||||||
from analysis import analysis as an
|
from analysis import analysis as an
|
||||||
from numba import jit
|
from numba import jit
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
main()
|
Loading…
Reference in New Issue
Block a user