mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-11-09 22:44:44 +00:00
analysis.py - v 1.0.3.007
changelog v 1.0.3.007: - added builtin benchmark function - added builtin random (linear) data generation function
This commit is contained in:
parent
a8e2391206
commit
99fee36f20
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
benchmark_data.csv
|
Binary file not shown.
31
analysis.py
31
analysis.py
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#setup:
|
#setup:
|
||||||
|
|
||||||
__version__ = "1.0.3.006"
|
__version__ = "1.0.3.007"
|
||||||
|
|
||||||
__author__ = (
|
__author__ = (
|
||||||
"Arthur Lu <arthurlu@ttic.edu>, "
|
"Arthur Lu <arthurlu@ttic.edu>, "
|
||||||
@ -48,6 +48,7 @@ import math
|
|||||||
import matplotlib
|
import matplotlib
|
||||||
import numbers
|
import numbers
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import random
|
||||||
import scipy
|
import scipy
|
||||||
from sklearn import *
|
from sklearn import *
|
||||||
#import statistics <-- statistics.py functions have been integrated into analysis.py as of v 1.0.3.002
|
#import statistics <-- statistics.py functions have been integrated into analysis.py as of v 1.0.3.002
|
||||||
@ -584,6 +585,34 @@ def basic_analysis(filepath): #assumes that rows are the independent variable an
|
|||||||
|
|
||||||
return[row_b_stats, column_b_stats, row_histo]
|
return[row_b_stats, column_b_stats, row_histo]
|
||||||
|
|
||||||
|
def benchmark(x, y):
|
||||||
|
|
||||||
|
start_g = time.time()
|
||||||
|
generate_data("benchmark_data.csv", x, y, -10, 10)
|
||||||
|
end_g = time.time()
|
||||||
|
|
||||||
|
start_a = time.time()
|
||||||
|
basic_analysis("benchmark_data.csv")
|
||||||
|
end_a = time.time()
|
||||||
|
|
||||||
|
return [(end_g - start_g), (end_a - start_a)]
|
||||||
|
|
||||||
|
def generate_data(filename, x, y, low, high):
|
||||||
|
|
||||||
|
file = open(filename, "w")
|
||||||
|
|
||||||
|
for i in range (0, y, 1):
|
||||||
|
|
||||||
|
temp = ""
|
||||||
|
|
||||||
|
for j in range (0, x - 1, 1):
|
||||||
|
|
||||||
|
temp = str(random.uniform(low, high)) + "," + temp
|
||||||
|
|
||||||
|
temp = temp + str(random.uniform(low, high))
|
||||||
|
file.write(temp + "\n")
|
||||||
|
|
||||||
|
|
||||||
#statistics def below------------------------------------------------------------------------------------------------------------------------------------------------------
|
#statistics def below------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class StatisticsError(ValueError):
|
class StatisticsError(ValueError):
|
||||||
|
Loading…
Reference in New Issue
Block a user