added argv support with class Arguments and Enum
This commit is contained in:
parent
3bcbbdf544
commit
c1a72b706d
BIN
__pycache__/arguments.cpython-313.pyc
Normal file
BIN
__pycache__/arguments.cpython-313.pyc
Normal file
Binary file not shown.
13
absolut.py
13
absolut.py
@ -15,7 +15,7 @@ FEATURES = ["points", "x", "y"]
|
||||
def load_dataframe():
|
||||
try:
|
||||
colum_list = FEATURES
|
||||
df = pd.read_csv("data/shots.csv", usecols = colum_list).dropna()
|
||||
df = pd.read_csv("data/synthetic_data.csv", usecols = colum_list).dropna()
|
||||
return df.abs()
|
||||
except FileNotFoundError as error:
|
||||
print(error)
|
||||
@ -34,13 +34,10 @@ def calc_f1_score(y_true, y_pred):
|
||||
fp = np.sum(np.multiply([i==True for i in y_pred], [not(j) for j in y_true]))
|
||||
fn = np.sum(np.multiply([i==False for i in y_pred], y_true))
|
||||
|
||||
'''print(tp)
|
||||
print(fp)
|
||||
|
||||
precision = calc_precision(tp, fp)
|
||||
recall = calc_recall(tp, fn)'''
|
||||
recall = calc_recall(tp, fn)
|
||||
|
||||
if tp != 0 and fp != 0:
|
||||
'''if tp != 0 and fp != 0:
|
||||
precision = calc_precision(tp, fp)
|
||||
else:
|
||||
precision = 0
|
||||
@ -48,7 +45,7 @@ def calc_f1_score(y_true, y_pred):
|
||||
if tp != 0 and fn != 0:
|
||||
recall = calc_recall(tp, fn)
|
||||
else:
|
||||
recall = 0
|
||||
recall = 0'''
|
||||
|
||||
if precision != 0 and recall != 0:
|
||||
f1 = (2 * precision * recall) / (precision + recall)
|
||||
@ -77,7 +74,6 @@ def main():
|
||||
print(df.head())
|
||||
print(df.head().info())
|
||||
|
||||
|
||||
sns.countplot(x = df["points"])
|
||||
plt.show()
|
||||
|
||||
@ -86,7 +82,6 @@ def main():
|
||||
|
||||
sns.scatterplot(x=df['x'], y=df['y'], hue=df['points'])
|
||||
plt.show()
|
||||
quit()
|
||||
|
||||
features = ["x", "y"]
|
||||
X = df[features]
|
||||
|
||||
52
arguments.py
Normal file
52
arguments.py
Normal file
@ -0,0 +1,52 @@
|
||||
from enum import Enum
|
||||
|
||||
class Mode(Enum):
|
||||
V = "v"
|
||||
A = "a"
|
||||
C = "c"
|
||||
|
||||
class Information(Enum):
|
||||
DISABLED = False
|
||||
ENABLED = True
|
||||
|
||||
class Graph(Enum):
|
||||
DISABLED = False
|
||||
ENABLED = True
|
||||
|
||||
class Arguments:
|
||||
|
||||
def __init__(self, file_path):
|
||||
self.file_path = file_path
|
||||
self.mode = None
|
||||
self.information = None
|
||||
self.graph = None
|
||||
|
||||
def get_file_path(self):
|
||||
return self.file_path
|
||||
|
||||
def get_mode(self):
|
||||
return self.mode
|
||||
|
||||
def set_mode(self, value):
|
||||
try:
|
||||
self.mode = Mode(value)
|
||||
except ValueError:
|
||||
raise ValueError(f"Invalid mode '{value}'. Allowed values: {[m.value for m in Mode]}")
|
||||
|
||||
def get_information(self):
|
||||
return self.information
|
||||
|
||||
def set_information(self, value):
|
||||
try:
|
||||
self.information = Information(value)
|
||||
except ValueError:
|
||||
raise ValueError(f"Invalid information '{value}'. Allowed values: {[m.value for m in Information]}")
|
||||
|
||||
def get_graph(self):
|
||||
return self.graph
|
||||
|
||||
def set_graph(self, value):
|
||||
try:
|
||||
self.graph = Graph(value)
|
||||
except ValueError:
|
||||
raise ValueError(f"Invalid graph '{value}'. Allowed values: {[m.value for m in Graph]}")
|
||||
@ -1,955 +0,0 @@
|
||||
points,x,y
|
||||
7,-2.5,-3.0
|
||||
0,-11.0,-4.0
|
||||
9,1.5,2.0
|
||||
6,-3.5,4.5
|
||||
10,0.5,-1.0
|
||||
4,-6.5,1.0
|
||||
8,2.5,1.5
|
||||
0,12.5,6.5
|
||||
10,0.0,-0.5
|
||||
6,-4.5,3.5
|
||||
7,-3.0,-3.5
|
||||
6,5.0,0.0
|
||||
0,-10.5,-4.0
|
||||
7,-3.5,1.5
|
||||
0,-10.5,-1.0
|
||||
4,-1.0,-7.0
|
||||
8,-1.0,2.5
|
||||
8,2.5,-1.5
|
||||
7,-1.5,4.0
|
||||
6,-4.0,-3.0
|
||||
6,-4.5,-1.0
|
||||
7,4.0,-0.5
|
||||
8,0.0,2.5
|
||||
4,6.5,4.0
|
||||
8,2.5,-1.5
|
||||
7,-2.5,-2.5
|
||||
7,-1.0,3.5
|
||||
6,4.5,2.5
|
||||
7,-4.0,0.0
|
||||
7,-4.0,-2.5
|
||||
9,2.5,-1.5
|
||||
7,1.5,4.0
|
||||
6,-5.0,-2.0
|
||||
7,-3.0,-2.0
|
||||
6,5.0,2.0
|
||||
2,8.5,-3.5
|
||||
8,-2.0,2.5
|
||||
10,-0.5,-1.5
|
||||
4,-7.5,1.0
|
||||
8,-3.0,-0.5
|
||||
8,-1.0,2.5
|
||||
8,1.0,-3.0
|
||||
10,-1.0,0.5
|
||||
10,-1.0,0.5
|
||||
9,-1.5,2.0
|
||||
7,3.0,3.5
|
||||
9,0.0,2.0
|
||||
9,-1.5,2.0
|
||||
9,-1.0,-1.5
|
||||
6,4.5,-1.5
|
||||
6,4.5,3.0
|
||||
1,10.0,2.5
|
||||
5,3.5,4.5
|
||||
8,3.0,-1.5
|
||||
9,1.5,0.5
|
||||
0,10.5,8.0
|
||||
7,-3.5,2.5
|
||||
8,2.5,-2.0
|
||||
3,-8.0,-3.5
|
||||
4,7.0,2.0
|
||||
8,1.5,2.5
|
||||
6,3.5,4.0
|
||||
4,-6.5,-3.5
|
||||
5,4.0,5.0
|
||||
8,1.5,3.0
|
||||
6,2.5,-4.0
|
||||
9,-2.0,-0.5
|
||||
7,-4.0,-0.5
|
||||
8,0.5,3.0
|
||||
8,1.0,-3.0
|
||||
4,6.0,4.0
|
||||
6,-4.5,1.0
|
||||
9,2.0,0.5
|
||||
9,-2.0,-1.5
|
||||
5,-5.0,3.5
|
||||
5,3.5,-5.5
|
||||
10,1.0,-1.0
|
||||
9,3.0,1.0
|
||||
8,-1.5,-2.5
|
||||
3,7.5,4.0
|
||||
10,-0.5,1.0
|
||||
5,5.0,-3.0
|
||||
10,-0.5,1.5
|
||||
7,-2.0,3.5
|
||||
9,0.0,2.0
|
||||
8,-3.0,0.0
|
||||
5,-5.5,-3.0
|
||||
3,-8.0,2.5
|
||||
7,3.5,3.5
|
||||
7,1.5,-4.0
|
||||
10,0.5,-1.0
|
||||
8,3.5,1.0
|
||||
10,1.0,0.5
|
||||
5,-5.0,-3.0
|
||||
9,-2.0,-0.5
|
||||
7,-2.5,3.0
|
||||
5,-2.5,6.0
|
||||
10,-1.0,1.0
|
||||
6,-1.5,-4.5
|
||||
5,-5.5,-2.5
|
||||
3,-6.0,6.0
|
||||
7,-2.5,-3.5
|
||||
4,2.0,6.5
|
||||
7,-1.5,4.0
|
||||
7,-2.5,3.0
|
||||
6,-5.0,0.0
|
||||
9,-1.5,-1.5
|
||||
6,-4.5,-2.0
|
||||
8,-1.0,-2.5
|
||||
4,3.5,-6.0
|
||||
5,4.0,5.5
|
||||
10,-1.0,-1.0
|
||||
5,3.0,6.0
|
||||
5,-1.5,-5.5
|
||||
6,-4.0,-3.0
|
||||
5,-5.5,0.5
|
||||
7,0.5,-4.0
|
||||
3,-1.0,-7.5
|
||||
10,-0.5,0.0
|
||||
10,1.5,0.0
|
||||
6,-4.5,-3.0
|
||||
7,3.5,1.5
|
||||
6,-4.0,-3.0
|
||||
5,-5.0,-3.0
|
||||
9,-1.5,-1.0
|
||||
6,2.5,4.5
|
||||
6,-1.5,-4.5
|
||||
5,-2.5,-5.5
|
||||
10,-0.5,0.0
|
||||
6,4.0,-3.5
|
||||
10,0.0,0.5
|
||||
5,5.0,-4.0
|
||||
9,-1.5,-1.5
|
||||
7,-3.0,-3.0
|
||||
5,-5.5,-4.0
|
||||
0,10.0,3.5
|
||||
9,-1.5,-1.0
|
||||
9,-1.5,-2.0
|
||||
7,-3.5,-2.0
|
||||
8,-2.5,-0.5
|
||||
6,-4.5,-1.5
|
||||
4,-6.5,-1.0
|
||||
5,-5.5,3.5
|
||||
7,-2.0,-3.0
|
||||
7,-2.5,-3.0
|
||||
5,6.0,-1.0
|
||||
8,-2.0,-2.5
|
||||
7,2.0,-3.0
|
||||
10,-1.0,-1.0
|
||||
8,-3.0,-1.0
|
||||
8,-2.5,-1.5
|
||||
8,-1.5,-3.0
|
||||
4,7.0,1.0
|
||||
0,-16.0,-2.0
|
||||
10,-1.0,0.5
|
||||
7,3.0,2.5
|
||||
9,-0.5,-2.5
|
||||
7,3.5,-2.5
|
||||
5,1.5,-5.5
|
||||
0,8.5,9.0
|
||||
7,-2.5,-3.0
|
||||
7,-1.5,-4.0
|
||||
7,-3.5,1.5
|
||||
7,-2.0,-3.5
|
||||
8,0.5,3.5
|
||||
6,3.0,4.5
|
||||
8,2.0,2.5
|
||||
5,5.5,3.0
|
||||
7,3.5,1.0
|
||||
6,4.5,0.5
|
||||
6,-1.5,-5.0
|
||||
5,-5.5,-1.0
|
||||
0,11.5,1.5
|
||||
8,-3.0,-1.0
|
||||
7,4.0,-1.0
|
||||
4,4.5,-5.5
|
||||
6,5.0,1.5
|
||||
4,6.5,-1.5
|
||||
6,2.5,-5.0
|
||||
5,5.0,-4.5
|
||||
6,5.0,2.5
|
||||
6,-3.5,-4.0
|
||||
10,1.5,1.5
|
||||
6,-5.0,-1.0
|
||||
7,-2.5,-3.0
|
||||
6,-4.5,1.0
|
||||
7,-3.5,1.0
|
||||
7,4.0,1.5
|
||||
10,0.5,0.5
|
||||
3,7.5,1.0
|
||||
6,-5.0,-1.5
|
||||
10,1.5,0.0
|
||||
8,-1.0,3.0
|
||||
5,5.0,-3.5
|
||||
10,0.5,0.5
|
||||
5,5.5,-1.0
|
||||
8,-1.5,-2.5
|
||||
7,3.5,2.5
|
||||
9,-2.0,-2.0
|
||||
6,5.0,3.0
|
||||
9,1.0,1.5
|
||||
8,3.5,-1.5
|
||||
10,-1.0,1.0
|
||||
6,5.0,-1.0
|
||||
9,-1.0,1.5
|
||||
8,6.5,-1.0
|
||||
6,-4.5,-2.0
|
||||
5,3.5,5.0
|
||||
7,-3.5,-2.0
|
||||
7,-4.5,0.0
|
||||
9,-0.5,2.0
|
||||
8,-2.0,2.5
|
||||
8,1.5,2.5
|
||||
6,4.0,4.5
|
||||
10,1.0,-1.5
|
||||
8,0.5,3.5
|
||||
4,7.0,2.0
|
||||
4,-5.0,-4.5
|
||||
8,-0.5,2.5
|
||||
7,-3.5,-1.5
|
||||
8,2.5,2.0
|
||||
6,-5.0,-1.0
|
||||
3,-7.5,-2.5
|
||||
9,-1.0,1.5
|
||||
9,1.5,2.0
|
||||
7,-3.5,2.0
|
||||
8,2.5,-0.5
|
||||
5,-5.5,1.0
|
||||
6,-4.5,2.0
|
||||
8,-1.5,-3.0
|
||||
9,-1.5,2.0
|
||||
6,-4.5,2.5
|
||||
9,0.0,2.0
|
||||
8,-2.5,-2.0
|
||||
8,-2.5,-1.5
|
||||
6,-4.0,-2.5
|
||||
5,-6.0,-1.5
|
||||
9,-1.0,-2.0
|
||||
8,1.5,2.5
|
||||
7,-3.5,1.0
|
||||
7,-3.5,2.0
|
||||
8,3.0,1.5
|
||||
9,-2.0,-1.0
|
||||
10,-1.5,-1.0
|
||||
6,2.5,4.0
|
||||
8,2.5,1.5
|
||||
9,-1.5,-2.0
|
||||
7,1.5,-3.5
|
||||
7,-3.5,-2.0
|
||||
5,5.5,0.0
|
||||
8,-2.5,-2.0
|
||||
6,-5.0,0.5
|
||||
7,-3.5,1.5
|
||||
7,-3.5,-1.0
|
||||
6,2.5,4.5
|
||||
3,-4.5,-6.5
|
||||
9,-1.5,-1.0
|
||||
9,0.0,-2.0
|
||||
7,-3.5,2.5
|
||||
5,-5.0,-3.0
|
||||
9,-1.0,-2.0
|
||||
7,-3.0,3.5
|
||||
10,0.0,-1.5
|
||||
8,2.5,-2.0
|
||||
9,1.5,1.5
|
||||
8,3.0,1.5
|
||||
10,-1.5,0.0
|
||||
7,-2.5,-3.5
|
||||
8,2.5,1.0
|
||||
4,7.0,1.0
|
||||
6,-1.0,-4.5
|
||||
7,-2.0,-4.0
|
||||
9,-1.5,-2.0
|
||||
4,-7.0,-1.0
|
||||
9,1.5,1.5
|
||||
9,-2.0,-1.5
|
||||
6,-4.0,3.0
|
||||
10,0.5,0.5
|
||||
7,-3.0,3.5
|
||||
5,-5.5,2.5
|
||||
8,-1.5,3.0
|
||||
4,-6.0,5.5
|
||||
9,1.0,2.0
|
||||
9,2.5,1.5
|
||||
4,-0.5,7.0
|
||||
9,-2.0,0.5
|
||||
8,-1.5,2.5
|
||||
2,-8.0,4.0
|
||||
10,0.0,0.5
|
||||
9,1.5,1.0
|
||||
7,2.5,3.0
|
||||
5,-5.5,-2.0
|
||||
3,-6.0,7.0
|
||||
7,3.5,2.5
|
||||
9,-1.0,2.0
|
||||
3,7.5,3.0
|
||||
2,-8.0,4.5
|
||||
6,5.0,-2.5
|
||||
4,-6.0,4.0
|
||||
7,3.5,3.0
|
||||
7,-4.0,-2.0
|
||||
7,2.5,-4.0
|
||||
9,-1.5,-1.5
|
||||
7,-3.5,-3.0
|
||||
7,-3.5,1.0
|
||||
4,-7.0,-1.5
|
||||
9,2.0,1.5
|
||||
7,3.0,3.0
|
||||
8,-2.0,2.5
|
||||
5,4.0,5.0
|
||||
8,2.5,1.5
|
||||
8,0.5,-3.0
|
||||
8,1.5,3.0
|
||||
7,4.5,1.5
|
||||
10,-1.0,-1.0
|
||||
9,1.5,2.0
|
||||
8,3.0,1.5
|
||||
8,-2.5,-1.5
|
||||
5,0.0,-5.5
|
||||
8,2.5,-2.5
|
||||
8,2.5,2.5
|
||||
9,1.5,-1.5
|
||||
9,1.5,1.5
|
||||
9,1.5,1.5
|
||||
7,-3.5,-1.0
|
||||
4,-3.0,-6.5
|
||||
10,-1.0,-1.0
|
||||
7,-2.5,3.5
|
||||
8,0.0,3.0
|
||||
7,-1.0,-3.5
|
||||
9,-1.5,0.0
|
||||
8,2.5,-0.5
|
||||
9,1.5,-1.5
|
||||
8,1.5,-2.5
|
||||
8,0.0,-2.5
|
||||
8,-2.0,-2.5
|
||||
9,-1.5,1.5
|
||||
7,-2.5,3.5
|
||||
9,0.0,-1.5
|
||||
3,1.0,7.5
|
||||
9,-1.5,0.0
|
||||
6,-4.5,1.0
|
||||
10,1.0,1.0
|
||||
8,-1.0,3.0
|
||||
10,1.0,0.0
|
||||
9,0.0,2.0
|
||||
10,0.5,0.5
|
||||
10,0.5,1.0
|
||||
8,-2.5,0.0
|
||||
7,2.0,3.5
|
||||
8,2.0,-3.0
|
||||
8,-2.5,1.5
|
||||
9,1.5,-1.5
|
||||
8,-3.0,-2.0
|
||||
5,3.0,5.5
|
||||
6,-5.0,1.0
|
||||
9,1.5,-3.5
|
||||
7,3.5,0.0
|
||||
7,-3.5,3.0
|
||||
6,2.5,-4.5
|
||||
7,-3.0,3.0
|
||||
7,-3.5,2.5
|
||||
10,0.0,-1.0
|
||||
8,-1.5,3.0
|
||||
8,-2.5,-2.5
|
||||
7,-1.5,3.5
|
||||
9,-1.5,0.5
|
||||
7,2.5,3.5
|
||||
5,-5.0,3.5
|
||||
4,-5.5,-4.5
|
||||
9,-1.5,0.5
|
||||
8,1.5,2.5
|
||||
9,2.0,0.0
|
||||
5,-1.0,6.0
|
||||
10,0.5,-1.0
|
||||
8,2.5,2.5
|
||||
7,3.5,0.0
|
||||
7,-3.5,1.5
|
||||
10,0.0,1.0
|
||||
6,0.0,-4.5
|
||||
8,1.5,2.5
|
||||
8,0.0,-3.0
|
||||
9,0.5,1.5
|
||||
8,1.5,3.0
|
||||
8,-1.5,-2.5
|
||||
8,-0.5,2.5
|
||||
9,1.5,1.5
|
||||
6,4.0,3.5
|
||||
8,3.0,-0.5
|
||||
7,-3.5,-1.0
|
||||
7,1.5,3.5
|
||||
7,3.5,3.5
|
||||
6,5.0,0.0
|
||||
6,4.5,4.0
|
||||
9,2.0,-1.5
|
||||
8,2.0,3.0
|
||||
10,0.5,0.5
|
||||
7,1.5,4.0
|
||||
8,1.5,2.5
|
||||
8,0.0,2.5
|
||||
8,-3.5,2.5
|
||||
7,3.5,0.0
|
||||
10,-1.0,1.0
|
||||
10,1.0,-1.0
|
||||
10,-1.0,-1.0
|
||||
8,2.5,-0.5
|
||||
8,-2.0,2.5
|
||||
9,1.0,0.0
|
||||
5,-2.5,5.5
|
||||
10,0.5,1.0
|
||||
7,2.5,3.0
|
||||
8,-2.5,-2.5
|
||||
8,-2.5,-2.5
|
||||
4,2.0,6.5
|
||||
9,1.5,-2.0
|
||||
1,9.5,-3.5
|
||||
8,2.5,-1.0
|
||||
6,-3.5,3.5
|
||||
8,-2.5,-2.0
|
||||
6,-3.5,3.5
|
||||
9,1.5,1.0
|
||||
8,0.0,2.5
|
||||
7,3.5,-3.5
|
||||
5,1.5,-5.5
|
||||
9,1.5,0.0
|
||||
9,1.5,1.0
|
||||
9,1.5,0.5
|
||||
5,1.5,-5.5
|
||||
10,0.5,0.0
|
||||
9,-1.5,1.5
|
||||
8,0.0,3.5
|
||||
7,-3.5,3.0
|
||||
10,0.0,-0.5
|
||||
9,0.5,1.5
|
||||
7,2.5,3.5
|
||||
6,3.0,-4.5
|
||||
9,2.0,-1.5
|
||||
7,2.5,3.5
|
||||
9,1.5,0.5
|
||||
6,0.5,-4.5
|
||||
7,-3.5,3.5
|
||||
4,3.5,6.5
|
||||
10,0.0,0.0
|
||||
7,-1.5,-3.5
|
||||
8,0.0,-3.0
|
||||
6,-4.5,-3.0
|
||||
8,0.0,3.0
|
||||
6,1.5,-4.5
|
||||
9,-1.5,1.0
|
||||
7,-1.5,3.5
|
||||
10,0.0,0.0
|
||||
5,-2.0,-5.5
|
||||
8,-2.5,-2.5
|
||||
4,-4.5,-6.5
|
||||
8,-2.5,-2.0
|
||||
8,-2.5,-2.0
|
||||
9,1.5,-1.5
|
||||
8,-2.0,2.5
|
||||
7,-3.5,-1.5
|
||||
7,2.5,-3.5
|
||||
8,2.5,-2.5
|
||||
8,-3.0,1.0
|
||||
10,-0.5,0.0
|
||||
7,-3.5,1.0
|
||||
10,0.0,0.5
|
||||
10,-0.5,-0.5
|
||||
9,0.0,2.0
|
||||
6,-2.0,5.0
|
||||
7,1.0,3.5
|
||||
7,-2.5,-4.0
|
||||
9,1.5,-1.0
|
||||
7,-3.5,1.0
|
||||
9,1.5,0.0
|
||||
8,-2.5,2.5
|
||||
8,-2.5,2.5
|
||||
7,-3.5,-3.5
|
||||
7,3.5,-2.0
|
||||
9,0.0,-1.5
|
||||
8,-2.5,0.0
|
||||
7,-2.5,4.0
|
||||
9,1.0,1.5
|
||||
8,1.0,2.5
|
||||
9,-0.5,1.5
|
||||
8,-2.5,-2.5
|
||||
9,-0.5,-2.0
|
||||
6,-2.5,4.5
|
||||
10,0.5,-0.5
|
||||
10,0.5,-0.5
|
||||
8,-2.5,-2.0
|
||||
7,2.5,3.5
|
||||
7,0.0,4.0
|
||||
6,-4.5,0.0
|
||||
8,-0.5,-2.5
|
||||
8,-0.5,-2.5
|
||||
9,0.0,2.5
|
||||
7,-0.5,3.5
|
||||
10,0.0,-0.5
|
||||
7,-2.0,-3.5
|
||||
9,-1.5,2.0
|
||||
8,-2.5,2.0
|
||||
10,-1.0,0.0
|
||||
8,-2.5,-2.5
|
||||
9,2.0,0.0
|
||||
7,-2.0,3.5
|
||||
8,-2.5,-1.0
|
||||
6,-4.5,-3.0
|
||||
9,-1.5,-1.5
|
||||
7,3.5,2.5
|
||||
10,-0.5,0.0
|
||||
8,1.5,2.5
|
||||
8,-2.0,-2.5
|
||||
6,-0.5,-6.0
|
||||
9,2.0,-1.5
|
||||
9,-1.0,-1.5
|
||||
9,0.0,1.5
|
||||
8,1.0,3.0
|
||||
9,1.5,0.5
|
||||
8,1.5,0.5
|
||||
8,-2.5,2.0
|
||||
7,-3.5,-4.0
|
||||
10,0.0,0.0
|
||||
7,-3.0,-2.5
|
||||
10,1.5,0.5
|
||||
9,-2.0,-1.5
|
||||
7,1.0,4.0
|
||||
6,-2.5,4.5
|
||||
7,2.5,1.5
|
||||
8,-3.0,2.5
|
||||
8,-2.5,2.0
|
||||
6,4.0,-3.5
|
||||
9,-1.5,2.0
|
||||
8,-2.5,1.0
|
||||
10,0.0,0.5
|
||||
9,1.5,2.0
|
||||
10,0.0,-0.5
|
||||
8,3.0,1.5
|
||||
6,-4.5,-2.0
|
||||
7,-2.5,-2.5
|
||||
10,-1.5,0.5
|
||||
7,3.5,1.5
|
||||
9,-1.5,1.5
|
||||
8,2.0,2.0
|
||||
9,-1.0,2.0
|
||||
7,0.0,3.5
|
||||
10,-1.0,0.0
|
||||
9,-2.5,-1.0
|
||||
10,-0.5,-0.5
|
||||
9,-1.5,-1.5
|
||||
9,-2.0,-1.0
|
||||
9,-1.0,-2.0
|
||||
9,-1.0,-1.5
|
||||
8,2.5,1.5
|
||||
10,1.0,0.0
|
||||
10,1.0,-1.0
|
||||
9,2.0,1.0
|
||||
8,-0.5,2.5
|
||||
9,1.0,1.0
|
||||
8,3.0,0.0
|
||||
10,0.5,0.5
|
||||
9,-1.0,2.0
|
||||
9,-1.5,0.0
|
||||
9,2.0,0.0
|
||||
9,1.0,2.0
|
||||
9,2.0,1.0
|
||||
10,0.5,-1.0
|
||||
9,-1.0,1.0
|
||||
7,-1.0,-2.0
|
||||
9,-1.0,-2.0
|
||||
7,2.0,3.0
|
||||
6,-4.0,3.0
|
||||
8,0.0,-3.0
|
||||
8,1.0,-3.0
|
||||
7,-3.5,2.0
|
||||
9,-2.5,-1.0
|
||||
5,-5.0,-1.0
|
||||
9,2.0,-1.5
|
||||
7,-3.5,0.0
|
||||
8,-0.5,-3.5
|
||||
9,1.0,-1.5
|
||||
8,2.5,0.0
|
||||
7,-4.5,-1.0
|
||||
9,0.0,-2.0
|
||||
8,-2.5,-1.5
|
||||
7,-4.0,-1.0
|
||||
6,-3.0,-5.5
|
||||
5,-5.0,-3.5
|
||||
9,0.0,1.5
|
||||
7,4.0,2.5
|
||||
6,-4.0,-2.5
|
||||
7,1.0,-3.5
|
||||
8,-2.5,-1.0
|
||||
8,-2.0,-3.0
|
||||
8,0.0,3.0
|
||||
7,4.0,1.0
|
||||
9,-1.0,1.0
|
||||
8,2.0,2.0
|
||||
9,1.0,1.0
|
||||
5,-3.5,-4.5
|
||||
9,-0.5,-2.0
|
||||
8,-1.0,-3.5
|
||||
9,0.0,2.0
|
||||
8,-1.5,-2.5
|
||||
5,-5.0,-4.0
|
||||
7,4.0,-1.5
|
||||
9,0.5,-2.0
|
||||
8,-3.0,0.5
|
||||
9,1.5,-1.5
|
||||
9,1.5,-1.5
|
||||
8,-3.5,1.0
|
||||
8,2.5,-2.5
|
||||
7,-2.5,-3.0
|
||||
3,-7.0,-2.5
|
||||
10,0.0,-1.5
|
||||
8,-1.0,-3.5
|
||||
10,-1.0,1.0
|
||||
8,-2.5,-1.5
|
||||
10,1.0,1.0
|
||||
7,4.0,0.0
|
||||
10,0.0,0.0
|
||||
4,-3.0,-6.5
|
||||
10,-1.0,-1.5
|
||||
7,4.0,-0.5
|
||||
10,0.0,-1.5
|
||||
8,-2.5,-1.0
|
||||
10,1.5,0.0
|
||||
6,-5.0,1.5
|
||||
8,-2.0,2.0
|
||||
7,2.5,-3.5
|
||||
9,1.5,-1.5
|
||||
7,-2.0,-3.0
|
||||
9,-2.0,-0.5
|
||||
9,-1.0,-2.0
|
||||
8,1.0,-3.0
|
||||
8,1.5,-3.0
|
||||
9,2.0,0.0
|
||||
8,2.0,-3.0
|
||||
10,-0.5,0.0
|
||||
8,2.0,1.0
|
||||
9,2.0,1.0
|
||||
8,-1.5,-3.0
|
||||
7,2.0,-3.5
|
||||
8,3.5,-2.0
|
||||
9,0.0,-2.0
|
||||
7,1.5,-3.5
|
||||
5,6.0,-1.0
|
||||
4,5.0,-5.5
|
||||
5,0.0,6.0
|
||||
8,0.0,3.0
|
||||
6,5.0,1.0
|
||||
5,5.5,-2.5
|
||||
9,2.0,0.0
|
||||
9,2.0,0.0
|
||||
10,0.5,-0.5
|
||||
9,2.5,1.0
|
||||
9,0.0,2.0
|
||||
6,-1.0,4.5
|
||||
10,0.0,0.0
|
||||
7,3.5,-3.0
|
||||
9,2.5,1.0
|
||||
7,1.0,-3.5
|
||||
10,-1.5,0.0
|
||||
8,3.5,-1.0
|
||||
8,0.0,2.5
|
||||
7,4.0,-1.5
|
||||
10,1.0,-0.5
|
||||
9,-1.5,-2.0
|
||||
10,-1.5,-1.0
|
||||
9,-1.0,-1.5
|
||||
10,1.5,-1.0
|
||||
9,1.0,-1.5
|
||||
8,-3.0,-1.0
|
||||
9,2.0,0.0
|
||||
9,-1.5,1.0
|
||||
8,3.5,-1.5
|
||||
9,1.0,-1.5
|
||||
6,1.0,-4.5
|
||||
9,2.0,1.0
|
||||
7,4.0,2.0
|
||||
7,4.0,-1.0
|
||||
7,4.0,-2.5
|
||||
10,1.0,-1.5
|
||||
8,-3.0,-1.5
|
||||
9,0.5,-1.5
|
||||
9,-2.0,1.0
|
||||
8,-1.0,1.5
|
||||
9,1.0,3.0
|
||||
10,-1.0,0.0
|
||||
9,-1.0,-2.0
|
||||
8,0.0,-3.0
|
||||
8,-3.0,-1.5
|
||||
9,-2.5,0.5
|
||||
8,-2.0,-2.0
|
||||
7,-4.5,-1.0
|
||||
10,0.0,0.0
|
||||
7,-4.0,-3.0
|
||||
10,0.5,-0.5
|
||||
9,-1.5,1.0
|
||||
8,-1.5,-2.5
|
||||
9,-1.0,2.0
|
||||
7,-3.0,-2.5
|
||||
9,-1.0,2.5
|
||||
10,1.5,0.0
|
||||
7,4.0,1.0
|
||||
7,4.0,2.0
|
||||
10,1.0,-1.0
|
||||
9,1.5,-1.5
|
||||
9,-2.0,1.0
|
||||
10,-1.0,0.5
|
||||
8,-2.0,2.0
|
||||
9,1.0,1.5
|
||||
9,-1.0,1.5
|
||||
8,-3.5,-1.5
|
||||
7,-3.0,2.5
|
||||
8,1.5,-2.5
|
||||
9,-1.5,1.5
|
||||
7,-2.5,3.5
|
||||
9,-1.0,2.0
|
||||
8,2.5,2.0
|
||||
9,-1.0,1.5
|
||||
10,1.5,-1.0
|
||||
7,3.5,-2.5
|
||||
9,0.5,2.0
|
||||
10,0.0,0.0
|
||||
8,1.5,-3.0
|
||||
9,1.5,-2.0
|
||||
4,7.0,1.5
|
||||
10,-1.0,0.0
|
||||
8,2.5,-1.5
|
||||
8,2.5,0.0
|
||||
7,3.0,-2.0
|
||||
8,1.5,3.0
|
||||
7,0.0,3.5
|
||||
9,0.0,2.0
|
||||
8,-0.5,2.5
|
||||
10,0.0,-1.5
|
||||
9,0.0,-2.0
|
||||
7,-3.0,2.5
|
||||
9,-1.0,-2.0
|
||||
10,-0.5,-1.5
|
||||
8,-1.5,-2.5
|
||||
9,-1.0,1.5
|
||||
9,1.5,2.0
|
||||
9,-1.5,1.0
|
||||
9,-2.0,0.0
|
||||
10,0.0,1.0
|
||||
10,-1.0,1.0
|
||||
9,0.0,1.5
|
||||
9,2.0,0.0
|
||||
10,-0.5,-0.5
|
||||
8,-2.0,-2.0
|
||||
10,1.0,1.0
|
||||
10,1.0,-1.0
|
||||
8,1.0,-2.5
|
||||
8,-2.0,-2.0
|
||||
10,0.0,-0.5
|
||||
6,2.0,-4.5
|
||||
8,-2.0,-2.5
|
||||
7,4.0,-2.0
|
||||
10,1.5,-1.0
|
||||
8,2.5,-1.5
|
||||
9,1.0,1.5
|
||||
6,-4.5,-1.0
|
||||
9,1.5,-1.5
|
||||
9,1.0,-2.0
|
||||
10,1.0,1.0
|
||||
6,-5.0,-1.5
|
||||
6,-4.0,-3.0
|
||||
7,-3.0,-1.5
|
||||
10,1.5,0.5
|
||||
7,4.0,-1.5
|
||||
9,-2.0,-1.5
|
||||
8,1.0,-2.5
|
||||
9,1.0,2.0
|
||||
6,-1.5,-4.5
|
||||
5,-2.5,-5.5
|
||||
6,-5.0,2.0
|
||||
10,0.0,0.0
|
||||
9,-1.5,0.5
|
||||
10,0.0,0.0
|
||||
6,4.0,-3.0
|
||||
10,-1.0,-1.0
|
||||
9,1.5,-2.0
|
||||
8,1.5,-2.5
|
||||
6,-1.0,-4.5
|
||||
6,5.5,-1.5
|
||||
9,1.0,-2.0
|
||||
3,6.0,-4.5
|
||||
3,3.0,-5.5
|
||||
10,1.0,-1.0
|
||||
5,2.5,-5.0
|
||||
9,1.5,2.0
|
||||
5,5.0,-3.0
|
||||
8,-3.0,-1.0
|
||||
5,5.0,-3.0
|
||||
9,1.5,-2.0
|
||||
9,2.0,-1.5
|
||||
8,1.5,-2.5
|
||||
7,3.0,-2.0
|
||||
8,-3.0,-0.5
|
||||
7,2.0,-3.0
|
||||
10,1.0,0.5
|
||||
7,3.0,1.5
|
||||
10,-1.0,-0.5
|
||||
6,3.5,-2.5
|
||||
10,1.0,-1.0
|
||||
8,2.0,-2.0
|
||||
9,1.5,-1.0
|
||||
9,1.5,-2.5
|
||||
6,4.0,-2.0
|
||||
6,3.0,-4.0
|
||||
9,1.5,1.5
|
||||
9,-1.5,-1.5
|
||||
9,1.0,-2.0
|
||||
6,3.5,-3.5
|
||||
10,1.0,-0.5
|
||||
9,2.0,-0.5
|
||||
9,-1.0,2.0
|
||||
6,4.0,2.5
|
||||
7,1.0,1.5
|
||||
6,5.0,1.0
|
||||
5,0.0,5.5
|
||||
5,-3.0,4.5
|
||||
8,2.5,1.5
|
||||
8,-1.0,2.5
|
||||
9,1.0,2.0
|
||||
8,-0.5,2.5
|
||||
10,1.0,1.0
|
||||
8,3.0,-1.5
|
||||
9,2.0,-1.0
|
||||
7,3.0,1.5
|
||||
9,-1.5,-1.5
|
||||
7,3.0,2.0
|
||||
9,-1.0,1.5
|
||||
7,3.5,1.0
|
||||
8,3.0,1.0
|
||||
5,6.0,2.5
|
||||
9,1.0,1.5
|
||||
7,2.5,3.0
|
||||
8,3.0,0.0
|
||||
8,3.0,-1.5
|
||||
10,-1.0,0.5
|
||||
7,-3.5,1.0
|
||||
9,2.0,-1.0
|
||||
8,-2.5,0.5
|
||||
9,-2.0,1.5
|
||||
9,-2.0,-1.5
|
||||
9,0.0,2.0
|
||||
9,-1.5,0.0
|
||||
8,0.0,3.0
|
||||
9,-2.0,-1.0
|
||||
8,1.5,1.0
|
||||
5,4.5,3.5
|
||||
9,-2.0,2.0
|
||||
7,4.0,2.0
|
||||
10,0.0,-1.5
|
||||
9,2.0,0.0
|
||||
10,1.0,-1.5
|
||||
8,3.0,1.5
|
||||
10,0.0,0.0
|
||||
8,2.0,-3.0
|
||||
9,2.0,-1.5
|
||||
5,6.5,-1.0
|
||||
10,-0.5,0.5
|
||||
9,1.5,1.5
|
||||
8,1.5,-3.0
|
||||
3,8.5,1.5
|
||||
5,4.5,1.5
|
||||
6,-5.5,1.0
|
||||
5,-5.5,-1.5
|
||||
9,-1.5,0.0
|
||||
8,2.0,-1.5
|
||||
7,3.5,-1.5
|
||||
7,-1.0,3.0
|
||||
9,-1.5,1.0
|
||||
10,1.5,-1.0
|
||||
9,2.0,-1.0
|
||||
9,-1.5,0.0
|
||||
9,1.5,-1.5
|
||||
7,2.0,3.0
|
||||
7,-3.0,-3.0
|
||||
8,0.0,3.0
|
||||
8,-2.0,2.0
|
||||
8,2.0,2.5
|
||||
7,3.5,0.0
|
||||
9,-1.5,1.5
|
||||
5,5.5,3.0
|
||||
9,-2.0,1.0
|
||||
6,4.5,1.0
|
||||
9,1.0,2.0
|
||||
7,-3.5,0.0
|
||||
9,1.5,1.5
|
||||
6,3.5,3.0
|
||||
8,2.5,-1.5
|
||||
7,3.5,-1.0
|
||||
8,-3.0,0.0
|
||||
8,-2.0,2.5
|
||||
10,0.0,0.0
|
||||
8,-3.0,-1.5
|
||||
9,1.5,-1.5
|
||||
7,3.0,1.0
|
||||
9,-1.5,0.5
|
||||
7,2.0,-3.5
|
||||
9,0.0,2.0
|
||||
8,2.5,1.5
|
||||
10,0.0,1.0
|
||||
8,3.0,-2.0
|
||||
9,0.0,-2.0
|
||||
9,1.5,0.5
|
||||
8,2.5,-1.5
|
||||
6,4.5,2.5
|
||||
8,2.0,-1.5
|
||||
6,4.5,-2.0
|
||||
9,0.0,2.0
|
||||
5,6.0,-1.0
|
||||
10,0.0,-1.0
|
||||
8,3.0,-1.5
|
||||
9,1.5,0.5
|
||||
8,2.0,1.0
|
||||
8,2.0,-2.0
|
||||
7,3.0,-2.0
|
||||
10,1.0,-1.0
|
||||
5,5.5,0.0
|
||||
10,0.0,1.0
|
||||
7,2.5,-3.0
|
||||
10,1.0,-1.0
|
||||
8,2.5,-2.5
|
||||
8,-1.5,2.5
|
||||
7,4.0,0.0
|
||||
8,3.0,1.5
|
||||
7,3.5,-1.0
|
||||
10,0.0,1.0
|
||||
7,3.5,0.5
|
||||
9,2.0,1.0
|
||||
9,1.5,-2.0
|
||||
10,-0.5,0.0
|
||||
10,1.0,-1.0
|
||||
9,2.0,1.0
|
||||
7,-0.5,-3.5
|
||||
6,-4.5,1.0
|
||||
9,2.0,-1.0
|
||||
9,1.0,2.5
|
||||
6,1.5,-4.5
|
||||
10,1.0,-1.0
|
||||
8,-2.0,2.0
|
||||
10,-1.0,0.5
|
||||
9,3.0,-1.0
|
||||
7,-1.5,3.5
|
||||
8,2.5,1.5
|
||||
9,1.5,1.0
|
||||
8,-1.0,-3.0
|
||||
7,3.5,1.5
|
||||
7,-3.5,2.0
|
||||
5,-3.0,0.0
|
||||
8,1.5,2.0
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
25001
data/synthetic_shots.csv
Normal file
25001
data/synthetic_shots.csv
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,23 +1,26 @@
|
||||
# generate points and x, y coordinates based on this rules
|
||||
# 1. points possible: 0 to 10
|
||||
# 2. possible points for x, y range
|
||||
# 2a. 10 (0,0) (1.5, 1.5)
|
||||
# 2.b 9 (1.5,0) (1.5, 1.5)
|
||||
# 2.c 8 (0,0) (1.5, 1.5)
|
||||
# 2.d 7 (0,0) (1.5, 1.5)
|
||||
# 2.e 6 (0,0) (1.5, 1.5)
|
||||
# 2.f 5 (0,0) (1.5, 1.5)
|
||||
# 2.g 4 (0,0) (1.5, 1.5)
|
||||
# 2.h 3 (0,0) (1.5, 1.5)
|
||||
# 2.i 2 (0,0) (1.5, 1.5)
|
||||
# 2.j 1 (0,0) (1.5, 1.5)
|
||||
# 2.j 0 (0,0) (1.5, 1.5)
|
||||
'''--------------------------------------------------
|
||||
Script randomly generates coordinates from (-10, -10)
|
||||
to (10, 10), with step 0.5.
|
||||
Then applies points from 0 to 10 to the coordinates.
|
||||
|
||||
Points value is determined by circle area.
|
||||
|
||||
Export the dataset to "data/synthetic_shots.csv"
|
||||
|
||||
---------------------------------------------------'''
|
||||
|
||||
import sys
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import csv
|
||||
|
||||
FEATURES = ["points", "x", "y"]
|
||||
args = sys.argv[1:]
|
||||
|
||||
if not args:
|
||||
print("Usage: python3 generate_synthetic_shots.py <number of generated shots>")
|
||||
sys.exit(1)
|
||||
|
||||
n = int(args[0])
|
||||
|
||||
# Area circle
|
||||
A10 = 1.5 ** 2 * np.pi
|
||||
@ -31,21 +34,9 @@ A3 = 8.5 ** 2 * np.pi
|
||||
A2 = 9.5 ** 2 * np.pi
|
||||
A1 = 10.5 ** 2 * np.pi
|
||||
|
||||
'''print(A10)
|
||||
print(A9)
|
||||
print(A8)
|
||||
print(A7)
|
||||
print(A6)
|
||||
print(A5)
|
||||
print(A4)
|
||||
print(A3)
|
||||
print(A2)
|
||||
print(A1)
|
||||
print("")'''
|
||||
possible_values = np.linspace(-10, 10, 41) # fromn -10 to 10 with step 0.5
|
||||
|
||||
possible_values = np.linspace(-10, 10, 41) # frin -10 to 10 with step 0.5
|
||||
|
||||
xy = [(np.random.choice(possible_values), np.random.choice(possible_values)) for _ in range(1000)]
|
||||
xy = [(np.random.choice(possible_values), np.random.choice(possible_values)) for _ in range(n)]
|
||||
|
||||
dataset = []
|
||||
|
||||
@ -77,9 +68,8 @@ for i in xy:
|
||||
elif A > A1:
|
||||
dataset.append([0, i[0], i[1]])
|
||||
|
||||
#print(dataset)
|
||||
|
||||
with open('data/synthetic_data.csv', 'w', newline='') as csvfile:
|
||||
with open('data/synthetic_shots.csv', 'w', newline='') as csvfile:
|
||||
fieldnames = ['points', 'x', 'y']
|
||||
writer = csv.writer(csvfile)
|
||||
writer.writerow(fieldnames)
|
||||
writer.writerows(dataset)
|
||||
23
main.py
23
main.py
@ -1,3 +1,5 @@
|
||||
import sys
|
||||
from arguments import Arguments
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import seaborn as sns
|
||||
@ -9,14 +11,27 @@ from sklearn.neighbors import KNeighborsClassifier
|
||||
from sklearn.tree import DecisionTreeClassifier
|
||||
from sklearn.preprocessing import LabelEncoder
|
||||
|
||||
if not sys.argv[1:]:
|
||||
print("Usage: python3 main.py <path to csv> <mode vector [v] (default) or absolut [a] or cartesian [c]> <optional information [true]> <optional graphs [true]>")
|
||||
sys.exit(1)
|
||||
|
||||
args = Arguments(sys.argv[1])
|
||||
args.set_mode(sys.argv[2])
|
||||
|
||||
try:
|
||||
args.set_information(sys.argv[3])
|
||||
args.set_graph(sys.argv[4])
|
||||
except IndexError:
|
||||
args.set_information(False)
|
||||
args.set_graph(False)
|
||||
|
||||
FEATURES = ["points", "x", "y"]
|
||||
|
||||
# create dataframe from csv and drop any row with null values
|
||||
def load_dataframe():
|
||||
def load_dataframe(file_path):
|
||||
try:
|
||||
colum_list = FEATURES
|
||||
#df = pd.read_csv("data/shots.csv", usecols = colum_list).dropna()
|
||||
df = pd.read_csv("data/synthetic_data.csv", usecols = colum_list).dropna()
|
||||
df = pd.read_csv(file_path, usecols = colum_list).dropna()
|
||||
return df
|
||||
except FileNotFoundError as error:
|
||||
print(error)
|
||||
@ -73,7 +88,7 @@ def get_score_from_cli():
|
||||
return None
|
||||
|
||||
def main():
|
||||
df = load_dataframe()
|
||||
df = load_dataframe(args.get_file_path())
|
||||
print(df.describe())
|
||||
#print(df.head())
|
||||
#print(df.head().info())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user