mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-26 17:49:09 +00:00
analysis pkg v 1.0.0.005
This commit is contained in:
parent
3e38446eae
commit
b669e55283
@ -1,6 +1,6 @@
|
|||||||
Metadata-Version: 2.1
|
Metadata-Version: 2.1
|
||||||
Name: analysis
|
Name: analysis
|
||||||
Version: 1.0.0.4
|
Version: 1.0.0.5
|
||||||
Summary: analysis package developed by Titan Scouting for The Red Alliance
|
Summary: analysis package developed by Titan Scouting for The Red Alliance
|
||||||
Home-page: https://github.com/titanscout2022/tr2022-strategy
|
Home-page: https://github.com/titanscout2022/tr2022-strategy
|
||||||
Author: The Titan Scouting Team
|
Author: The Titan Scouting Team
|
||||||
|
@ -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.12.006"
|
__version__ = "1.1.13.000"
|
||||||
|
|
||||||
# changelog should be viewed using print(analysis.__changelog__)
|
# changelog should be viewed using print(analysis.__changelog__)
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.1.13.000:
|
||||||
|
- fixed all regressions to now properly work
|
||||||
1.1.12.006:
|
1.1.12.006:
|
||||||
- fixed bg with a division by zero in histo_analysis
|
- fixed bg with a division by zero in histo_analysis
|
||||||
1.1.12.005:
|
1.1.12.005:
|
||||||
@ -268,6 +270,8 @@ import numba
|
|||||||
from numba import jit
|
from numba import jit
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import math
|
import math
|
||||||
|
import scipy
|
||||||
|
from scipy import *
|
||||||
import sklearn
|
import sklearn
|
||||||
from sklearn import *
|
from sklearn import *
|
||||||
import torch
|
import torch
|
||||||
@ -346,24 +350,62 @@ def regression(ndevice, inputs, outputs, args, loss = torch.nn.MSELoss(), _itera
|
|||||||
|
|
||||||
if 'lin' in args: # formula: ax + b
|
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)
|
try:
|
||||||
params = model[0].parameters
|
|
||||||
params[:] = map(lambda x: x.item(), params)
|
X = np.array(inputs).reshape(-1,1)
|
||||||
regressions.append((params, model[1][::-1][0]))
|
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
|
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)
|
try:
|
||||||
params = model[0].parameters
|
|
||||||
params[:] = map(lambda x: x.item(), params)
|
X = np.array(inputs)
|
||||||
regressions.append((params, model[1][::-1][0]))
|
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
|
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)
|
try:
|
||||||
params = model[0].parameters
|
|
||||||
params[:] = map(lambda x: x.item(), params)
|
X = np.array(inputs)
|
||||||
regressions.append((params, model[1][::-1][0]))
|
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 + ...
|
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)
|
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)
|
try:
|
||||||
params = model[0].parameters
|
|
||||||
params[:] = map(lambda x: x.item(), params)
|
X = np.array(inputs)
|
||||||
regressions.append((params, model[1][::-1][0]))
|
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
|
return regressions
|
||||||
|
|
||||||
|
Binary file not shown.
BIN
analysis-master/dist/analysis-1.0.0.1.tar.gz
vendored
BIN
analysis-master/dist/analysis-1.0.0.1.tar.gz
vendored
Binary file not shown.
Binary file not shown.
BIN
analysis-master/dist/analysis-1.0.0.2.tar.gz
vendored
BIN
analysis-master/dist/analysis-1.0.0.2.tar.gz
vendored
Binary file not shown.
Binary file not shown.
BIN
analysis-master/dist/analysis-1.0.0.3.tar.gz
vendored
BIN
analysis-master/dist/analysis-1.0.0.3.tar.gz
vendored
Binary file not shown.
BIN
analysis-master/dist/analysis-1.0.0.4.tar.gz
vendored
BIN
analysis-master/dist/analysis-1.0.0.4.tar.gz
vendored
Binary file not shown.
Binary file not shown.
BIN
analysis-master/dist/analysis-1.0.0.5.tar.gz
vendored
Normal file
BIN
analysis-master/dist/analysis-1.0.0.5.tar.gz
vendored
Normal file
Binary file not shown.
@ -2,7 +2,7 @@ import setuptools
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="analysis", # Replace with your own username
|
name="analysis", # Replace with your own username
|
||||||
version="1.0.0.004",
|
version="1.0.0.005",
|
||||||
author="The Titan Scouting Team",
|
author="The Titan Scouting Team",
|
||||||
author_email="titanscout2022@gmail.com",
|
author_email="titanscout2022@gmail.com",
|
||||||
description="analysis package developed by Titan Scouting for The Red Alliance",
|
description="analysis package developed by Titan Scouting for The Red Alliance",
|
||||||
|
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
2020ilch
|
2020ilch
|
||||||
balls-blocked,basic_stats,historical_analysis
|
balls-blocked,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal
|
||||||
balls-collected,basic_stats,historical_analysis
|
balls-collected,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal
|
||||||
balls-lower,basic_stats,historical_analysis
|
balls-lower,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal
|
||||||
balls-started,basic_stats,historical_analysis
|
balls-started,basic_stats,historical_analyss,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal
|
||||||
balls-upper,basic_stats,historical_analysis
|
balls-upper,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal
|
|
Loading…
Reference in New Issue
Block a user