mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-27 01:59:08 +00:00
superscript.py v 0.0.2.001
This commit is contained in:
parent
941383de4b
commit
e815a2fbf7
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
2020ilch
|
2020ilch
|
||||||
balls-blocked,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal
|
balls-blocked,basic_stats,historical_analysis
|
||||||
balls-collected,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal
|
balls-collected,basic_stats,historical_analysis
|
||||||
balls-lower,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal
|
balls-lower,basic_stats,historical_analysis
|
||||||
balls-started,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal
|
balls-started,basic_stats,historical_analysis
|
||||||
balls-upper,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal
|
balls-upper,basic_stats,historical_analysis
|
|
@ -62,3 +62,15 @@ def push_team_metrics_data(apikey, competition, team_num, data, dbname = "data_p
|
|||||||
db = client[dbname]
|
db = client[dbname]
|
||||||
mdata = db[colname]
|
mdata = db[colname]
|
||||||
mdata.replace_one({"competition" : competition, "team": team_num}, {"_id": competition+str(team_num)+"am", "competition" : competition, "team" : team_num, "metrics" : data}, True)
|
mdata.replace_one({"competition" : competition, "team": team_num}, {"_id": competition+str(team_num)+"am", "competition" : competition, "team" : team_num, "metrics" : data}, True)
|
||||||
|
|
||||||
|
def get_analysis_flags(apikey, flag):
|
||||||
|
client = pymongo.MongoClient(apikey)
|
||||||
|
db = client.data_processing
|
||||||
|
mdata = db.flags
|
||||||
|
return mdata.find_one({flag:{"$exists":True}})
|
||||||
|
|
||||||
|
def set_analysis_flags(apikey, flag, data):
|
||||||
|
client = pymongo.MongoClient(apikey)
|
||||||
|
db = client.data_processing
|
||||||
|
mdata = db.flags
|
||||||
|
return mdata.replace_one({flag:{"$exists":True}}, data, True)
|
@ -3,10 +3,16 @@
|
|||||||
# Notes:
|
# Notes:
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "0.0.1.004"
|
__version__ = "0.0.2.001"
|
||||||
|
|
||||||
# changelog should be viewed using print(analysis.__changelog__)
|
# changelog should be viewed using print(analysis.__changelog__)
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
0.0.2.001:
|
||||||
|
- minor stability patches
|
||||||
|
- implemented db syncing for timestamps
|
||||||
|
- fixed bugs
|
||||||
|
0.0.2.000:
|
||||||
|
- finalized testing and small fixes
|
||||||
0.0.1.004:
|
0.0.1.004:
|
||||||
- finished metrics implement, trueskill is bugged
|
- finished metrics implement, trueskill is bugged
|
||||||
0.0.1.003:
|
0.0.1.003:
|
||||||
@ -67,6 +73,7 @@ import time
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
while(True):
|
while(True):
|
||||||
|
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
print("time: " + str(current_time))
|
print("time: " + str(current_time))
|
||||||
|
|
||||||
@ -79,6 +86,19 @@ def main():
|
|||||||
tbakey = an.load_csv("keys.txt")[1][0]
|
tbakey = an.load_csv("keys.txt")[1][0]
|
||||||
print(" loaded keys")
|
print(" loaded keys")
|
||||||
|
|
||||||
|
previous_time = d.get_analysis_flags(apikey, "latest_update")
|
||||||
|
|
||||||
|
if(previous_time == None):
|
||||||
|
|
||||||
|
d.set_analysis_flags(apikey, "latest_update", 0)
|
||||||
|
previous_time = 0
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
previous_time = previous_time["latest_update"]
|
||||||
|
|
||||||
|
print(" analysis backtimed to: " + str(previous_time))
|
||||||
|
|
||||||
print(" loading data")
|
print(" loading data")
|
||||||
data = d.get_data_formatted(apikey, competition)
|
data = d.get_data_formatted(apikey, competition)
|
||||||
print(" loaded data")
|
print(" loaded data")
|
||||||
@ -88,9 +108,11 @@ def main():
|
|||||||
print(" finished tests")
|
print(" finished tests")
|
||||||
|
|
||||||
print(" running metrics")
|
print(" running metrics")
|
||||||
metrics = metricsloop(tbakey, apikey, competition, 0)
|
metrics = metricsloop(tbakey, apikey, competition, previous_time)
|
||||||
print(" finished metrics")
|
print(" finished metrics")
|
||||||
|
|
||||||
|
d.set_analysis_flags(apikey, "latest_update", {"latest_update":current_time})
|
||||||
|
|
||||||
print(" pushing to database")
|
print(" pushing to database")
|
||||||
push_to_database(apikey, competition, results, metrics)
|
push_to_database(apikey, competition, results, metrics)
|
||||||
print(" pushed to database")
|
print(" pushed to database")
|
||||||
@ -127,22 +149,22 @@ def simplestats(data, test):
|
|||||||
return an.basic_stats(data)
|
return an.basic_stats(data)
|
||||||
|
|
||||||
if(test == "historical_analysis"):
|
if(test == "historical_analysis"):
|
||||||
return an.histo_analysis(data)
|
return an.histo_analysis([list(range(len(data))), data])
|
||||||
|
|
||||||
if(test == "regression_linear"):
|
if(test == "regression_linear"):
|
||||||
return an.regression('cpu', list(range(len(data))), data, ['lin'])
|
return an.regression('cpu', [list(range(len(data)))], [data], ['lin'], _iterations = 5000)
|
||||||
|
|
||||||
if(test == "regression_logarithmic"):
|
if(test == "regression_logarithmic"):
|
||||||
return an.regression('cpu', list(range(len(data))), data, ['log'])
|
return an.regression('cpu', [list(range(len(data)))], [data], ['log'], _iterations = 5000)
|
||||||
|
|
||||||
if(test == "regression_exponential"):
|
if(test == "regression_exponential"):
|
||||||
return an.regression('cpu', list(range(len(data))), data, ['exp'])
|
return an.regression('cpu', [list(range(len(data)))], [data], ['exp'], _iterations = 5000)
|
||||||
|
|
||||||
if(test == "regression_polynomial"):
|
if(test == "regression_polynomial"):
|
||||||
return an.regression('cpu', list(range(len(data))), data, ['ply'])
|
return an.regression('cpu', [list(range(len(data)))], [data], ['ply'], _iterations = 5000)
|
||||||
|
|
||||||
if(test == "regression_sigmoidal"):
|
if(test == "regression_sigmoidal"):
|
||||||
return an.regression('cpu', list(range(len(data))), data, ['sig'])
|
return an.regression('cpu', [list(range(len(data)))], [data], ['sig'], _iterations = 5000)
|
||||||
|
|
||||||
def push_to_database(apikey, competition, results, metrics):
|
def push_to_database(apikey, competition, results, metrics):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user