mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-11-13 22:56:18 +00:00
4
This commit is contained in:
parent
94ecd09e0b
commit
b51102b260
Binary file not shown.
24
analysis.py
24
analysis.py
@ -102,16 +102,26 @@ from sklearn import *
|
|||||||
import time
|
import time
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
class error(ValueError):
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
def _init_device (setting, arg): #initiates computation device for ANNs
|
def _init_device (setting, arg): #initiates computation device for ANNs
|
||||||
if setting == "cuda":
|
if setting == "cuda":
|
||||||
temp = setting + ":" + str(arg)
|
temp = setting + ":" + str(arg)
|
||||||
the_device_woman = torch.device(temp if torch.cuda.is_available() else "cpu")
|
try:
|
||||||
return the_device_woman #name that reference
|
the_device_woman = torch.device(temp if torch.cuda.is_available() else "cpu")
|
||||||
|
return the_device_woman #name that reference
|
||||||
|
except:
|
||||||
|
raise error("could not assign cuda or cpu")
|
||||||
elif setting == "cpu":
|
elif setting == "cpu":
|
||||||
the_device_woman = torch.device("cpu")
|
try:
|
||||||
return the_device_woman #name that reference
|
the_device_woman = torch.device("cpu")
|
||||||
|
return the_device_woman #name that reference
|
||||||
|
except:
|
||||||
|
raise error("could not assign cpu")
|
||||||
else:
|
else:
|
||||||
return "error: specified device does not exist (this is a bad error, either a non existent device was selected or the current device does not have a CPU."
|
raise error("specified device does not exist")
|
||||||
|
|
||||||
class c_entities:
|
class c_entities:
|
||||||
|
|
||||||
@ -359,6 +369,8 @@ def load_csv(filepath):
|
|||||||
file_array = list(csv.reader(csvfile))
|
file_array = list(csv.reader(csvfile))
|
||||||
return file_array
|
return file_array
|
||||||
|
|
||||||
|
def load_csv():
|
||||||
|
|
||||||
def basic_stats(data, method, arg): # data=array, mode = ['1d':1d_basic_stats, 'column':c_basic_stats, 'row':r_basic_stats], arg for mode 1 or mode 2 for column or row
|
def basic_stats(data, method, arg): # data=array, mode = ['1d':1d_basic_stats, 'column':c_basic_stats, 'row':r_basic_stats], arg for mode 1 or mode 2 for column or row
|
||||||
|
|
||||||
if method == 'debug':
|
if method == 'debug':
|
||||||
@ -451,7 +463,7 @@ def basic_stats(data, method, arg): # data=array, mode = ['1d':1d_basic_stats, '
|
|||||||
|
|
||||||
return out
|
return out
|
||||||
else:
|
else:
|
||||||
return ["ERROR: method error"]
|
raise error("method error")
|
||||||
|
|
||||||
def z_score(point, mean, stdev): #returns z score with inputs of point, mean and standard deviation of spread
|
def z_score(point, mean, stdev): #returns z score with inputs of point, mean and standard deviation of spread
|
||||||
score = (point - mean)/stdev
|
score = (point - mean)/stdev
|
||||||
|
Loading…
Reference in New Issue
Block a user