diff --git a/data analysis/analysis/__pycache__/analysis.cpython-36.pyc b/data analysis/analysis/__pycache__/analysis.cpython-36.pyc index d55c9939..86d0aace 100644 Binary files a/data analysis/analysis/__pycache__/analysis.cpython-36.pyc and b/data analysis/analysis/__pycache__/analysis.cpython-36.pyc differ diff --git a/data analysis/analysis/__pycache__/analysis.cpython-37.pyc b/data analysis/analysis/__pycache__/analysis.cpython-37.pyc index f59c8be2..d43e7882 100644 Binary files a/data analysis/analysis/__pycache__/analysis.cpython-37.pyc and b/data analysis/analysis/__pycache__/analysis.cpython-37.pyc differ diff --git a/data analysis/analysis/analysis.py b/data analysis/analysis/analysis.py index 1bdce5cb..671f4906 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.11.010" +__version__ = "1.1.12.000" # changelog should be viewed using print(analysis.__changelog__) __changelog__ = """changelog: + 1.1.12.000: + - temporarily fixed polynomial regressions by using sklearn's PolynomialFeatures 1.1.11.010: - alphabeticaly ordered import lists 1.1.11.009: @@ -317,10 +319,10 @@ def histo_analysis(hist_data): return basic_stats(derivative)[0], basic_stats(derivative)[3] @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 = [] - Regression().set_device(device) + Regression().set_device(ndevice) if 'lin' in args: @@ -340,6 +342,25 @@ def regression(device, inputs, outputs, args, loss = torch.nn.MSELoss(), _iterat if 'ply' in args: 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: @@ -351,6 +372,7 @@ def regression(device, inputs, outputs, args, loss = torch.nn.MSELoss(), _iterat plys.append((model[0].parameters, model[1][::-1][0])) regressions.append(plys) + """ if 'sig' in args: diff --git a/data analysis/superscript.py b/data analysis/superscript.py index 3a5019db..2e4d6fd4 100644 --- a/data analysis/superscript.py +++ b/data analysis/superscript.py @@ -24,4 +24,10 @@ __all__ = [ from analysis import analysis as an from numba import jit -import numpy as np \ No newline at end of file +import numpy as np + +def main(): + + pass + +main() \ No newline at end of file