diff --git a/analysis-master/analysis.egg-info/PKG-INFO b/analysis-master/analysis.egg-info/PKG-INFO index 7816a03b..8c5afbee 100644 --- a/analysis-master/analysis.egg-info/PKG-INFO +++ b/analysis-master/analysis.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: analysis -Version: 1.0.0.4 +Version: 1.0.0.5 Summary: analysis package developed by Titan Scouting for The Red Alliance Home-page: https://github.com/titanscout2022/tr2022-strategy Author: The Titan Scouting Team diff --git a/analysis-master/build/lib/analysis/analysis.py b/analysis-master/build/lib/analysis/analysis.py index 36e17a08..b73d37a3 100644 --- a/analysis-master/build/lib/analysis/analysis.py +++ b/analysis-master/build/lib/analysis/analysis.py @@ -7,10 +7,12 @@ # current benchmark of optimization: 1.33 times faster # setup: -__version__ = "1.1.12.006" +__version__ = "1.1.13.000" # changelog should be viewed using print(analysis.__changelog__) __changelog__ = """changelog: + 1.1.13.000: + - fixed all regressions to now properly work 1.1.12.006: - fixed bg with a division by zero in histo_analysis 1.1.12.005: @@ -268,6 +270,8 @@ import numba from numba import jit import numpy as np import math +import scipy +from scipy import * import sklearn from sklearn import * import torch @@ -346,24 +350,62 @@ def regression(ndevice, inputs, outputs, args, loss = torch.nn.MSELoss(), _itera 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) - params = model[0].parameters - params[:] = map(lambda x: x.item(), params) - regressions.append((params, model[1][::-1][0])) + try: + + X = np.array(inputs).reshape(-1,1) + y = np.array(outputs) + + model = sklearn.linear_model.LinearRegression().fit(X, y) + + ret = model.coef_.flatten().tolist() + ret.append(model.intercept_) + + regressions.append((ret, model.score(X,y))) + + except Exception as e: + + print(e) + pass 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) - params = model[0].parameters - params[:] = map(lambda x: x.item(), params) - regressions.append((params, model[1][::-1][0])) + try: + + X = np.array(inputs) + y = np.array(outputs) + + def func(x, a, b, c, d): + + return a * np.log(b*(x + c)) + d + + popt, pcov = scipy.optimize.curve_fit(func, X, y) + + regressions.append((popt.flatten().tolist(), None)) + + except Exception as e: + + print(e) + pass 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) - params = model[0].parameters - params[:] = map(lambda x: x.item(), params) - regressions.append((params, model[1][::-1][0])) + try: + + X = np.array(inputs) + y = np.array(outputs) + + def func(x, a, b, c, d): + + return a * np.exp(b*(x + c)) + d + + popt, pcov = scipy.optimize.curve_fit(func, X, y) + + regressions.append((popt.flatten().tolist(), None)) + + except Exception as e: + + print(e) + pass if 'ply' in args: # formula: a + bx^1 + cx^2 + dx^3 + ... @@ -385,12 +427,25 @@ def regression(ndevice, inputs, outputs, args, loss = torch.nn.MSELoss(), _itera regressions.append(plys) - if 'sig' in args: # formula: a sig (b(x + c)) + d | sig() = 1/(1 + e ^ -x) + if 'sig' in args: # formula: a tanh (b(x + c)) + d - 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) - params = model[0].parameters - params[:] = map(lambda x: x.item(), params) - regressions.append((params, model[1][::-1][0])) + try: + + X = np.array(inputs) + y = np.array(outputs) + + def func(x, a, b, c, d): + + return a * np.tanh(b*(x + c)) + d + + popt, pcov = scipy.optimize.curve_fit(func, X, y) + + regressions.append((popt.flatten().tolist(), None)) + + except Exception as e: + + print(e) + pass return regressions diff --git a/analysis-master/dist/analysis-1.0.0.1-py3-none-any.whl b/analysis-master/dist/analysis-1.0.0.1-py3-none-any.whl deleted file mode 100644 index d9d2a7e9..00000000 Binary files a/analysis-master/dist/analysis-1.0.0.1-py3-none-any.whl and /dev/null differ diff --git a/analysis-master/dist/analysis-1.0.0.1.tar.gz b/analysis-master/dist/analysis-1.0.0.1.tar.gz deleted file mode 100644 index 7106238f..00000000 Binary files a/analysis-master/dist/analysis-1.0.0.1.tar.gz and /dev/null differ diff --git a/analysis-master/dist/analysis-1.0.0.2-py3-none-any.whl b/analysis-master/dist/analysis-1.0.0.2-py3-none-any.whl deleted file mode 100644 index 8e0ef0ee..00000000 Binary files a/analysis-master/dist/analysis-1.0.0.2-py3-none-any.whl and /dev/null differ diff --git a/analysis-master/dist/analysis-1.0.0.2.tar.gz b/analysis-master/dist/analysis-1.0.0.2.tar.gz deleted file mode 100644 index 835b6843..00000000 Binary files a/analysis-master/dist/analysis-1.0.0.2.tar.gz and /dev/null differ diff --git a/analysis-master/dist/analysis-1.0.0.3-py3-none-any.whl b/analysis-master/dist/analysis-1.0.0.3-py3-none-any.whl deleted file mode 100644 index 13eca2cc..00000000 Binary files a/analysis-master/dist/analysis-1.0.0.3-py3-none-any.whl and /dev/null differ diff --git a/analysis-master/dist/analysis-1.0.0.3.tar.gz b/analysis-master/dist/analysis-1.0.0.3.tar.gz deleted file mode 100644 index 939ada77..00000000 Binary files a/analysis-master/dist/analysis-1.0.0.3.tar.gz and /dev/null differ diff --git a/analysis-master/dist/analysis-1.0.0.4.tar.gz b/analysis-master/dist/analysis-1.0.0.4.tar.gz deleted file mode 100644 index e67998e4..00000000 Binary files a/analysis-master/dist/analysis-1.0.0.4.tar.gz and /dev/null differ diff --git a/analysis-master/dist/analysis-1.0.0.4-py3-none-any.whl b/analysis-master/dist/analysis-1.0.0.5-py3-none-any.whl similarity index 53% rename from analysis-master/dist/analysis-1.0.0.4-py3-none-any.whl rename to analysis-master/dist/analysis-1.0.0.5-py3-none-any.whl index 7df40a5c..ef2bc9e7 100644 Binary files a/analysis-master/dist/analysis-1.0.0.4-py3-none-any.whl and b/analysis-master/dist/analysis-1.0.0.5-py3-none-any.whl differ diff --git a/analysis-master/dist/analysis-1.0.0.5.tar.gz b/analysis-master/dist/analysis-1.0.0.5.tar.gz new file mode 100644 index 00000000..784081b1 Binary files /dev/null and b/analysis-master/dist/analysis-1.0.0.5.tar.gz differ diff --git a/analysis-master/setup.py b/analysis-master/setup.py index eaa7be71..56cf0877 100644 --- a/analysis-master/setup.py +++ b/analysis-master/setup.py @@ -2,7 +2,7 @@ import setuptools setuptools.setup( name="analysis", # Replace with your own username - version="1.0.0.004", + version="1.0.0.005", author="The Titan Scouting Team", author_email="titanscout2022@gmail.com", description="analysis package developed by Titan Scouting for The Red Alliance", diff --git a/data analysis/__pycache__/data.cpython-37.pyc b/data analysis/__pycache__/data.cpython-37.pyc index b84e9ed5..e331827b 100644 Binary files a/data analysis/__pycache__/data.cpython-37.pyc and b/data analysis/__pycache__/data.cpython-37.pyc differ diff --git a/data analysis/config.csv b/data analysis/config.csv index 900ccba9..1022fc2f 100644 --- a/data analysis/config.csv +++ b/data analysis/config.csv @@ -1,6 +1,6 @@ 2020ilch -balls-blocked,basic_stats,historical_analysis -balls-collected,basic_stats,historical_analysis -balls-lower,basic_stats,historical_analysis -balls-started,basic_stats,historical_analysis -balls-upper,basic_stats,historical_analysis \ No newline at end of file +balls-blocked,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal +balls-collected,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal +balls-lower,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal +balls-started,basic_stats,historical_analyss,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal +balls-upper,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal \ No newline at end of file