diff --git a/absolut.py b/absolut.py new file mode 100644 index 0000000..cdb8af8 --- /dev/null +++ b/absolut.py @@ -0,0 +1,133 @@ +import pandas as pd +import numpy as np +import seaborn as sns +import matplotlib.pyplot as plt +from sklearn.metrics import f1_score +from sklearn.model_selection import train_test_split +from sklearn.ensemble import RandomForestClassifier +from sklearn.neighbors import KNeighborsClassifier +from sklearn.tree import DecisionTreeClassifier +from sklearn.preprocessing import LabelEncoder + +FEATURES = ["points", "x", "y"] + +# create dataframe from csv and drop any row with null values +def load_dataframe(): + try: + colum_list = FEATURES + df = pd.read_csv("data/shots.csv", usecols = colum_list).dropna() + return df.abs() + except FileNotFoundError as error: + print(error) + quit() + +def calc_f1_macro(y_true, y_pred): + f1_scores = [] + for column in y_true: + score = calc_f1_score(y_true[column].values, y_pred[column]) + f1_scores.append(score) + return np.mean(f1_scores) + +def calc_f1_score(y_true, y_pred): + tp = np.sum(np.multiply([i==True for i in y_pred], y_true)) + tn = np.sum(np.multiply([i==False for i in y_pred], [not(j) for j in y_true])) + 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)''' + + if tp != 0 and fp != 0: + precision = calc_precision(tp, fp) + else: + precision = 0 + + if tp != 0 and fn != 0: + recall = calc_recall(tp, fn) + else: + recall = 0 + + if precision != 0 and recall != 0: + f1 = (2 * precision * recall) / (precision + recall) + else: + f1 = 0 + return f1 + +def calc_precision(tp, fp): + return tp / (tp + fp) + +def calc_recall(tp, fn): + return tp / (tp + fn) + +def get_score_from_cli(): + try: + x = float(input("x: ")) + y = float(input("y: ")) + return np.array([x, y]).reshape(1, -1) + except ValueError: + print("Invalid input. Please enter numeric values.") + return None + +def main(): + df = load_dataframe() + print(df.describe()) + print(df.head()) + print(df.head().info()) + + + sns.countplot(x = df["points"]) + plt.show() + + sns.heatmap(df.corr(), annot=True, cmap='coolwarm') + plt.show() + + sns.scatterplot(x=df['x'], y=df['y'], hue=df['points']) + plt.show() + quit() + + features = ["x", "y"] + X = df[features] + + y = pd.get_dummies(df['points']) + + X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.4, random_state=0) + + random_forest = RandomForestClassifier(n_estimators=700, random_state=0) + decision_tree = DecisionTreeClassifier(random_state=0) + k_neighbors = KNeighborsClassifier(n_neighbors=5) + + models = { + "Random Forest Classifier": random_forest, + "Decision Tree Classifier": decision_tree, + "K-Neighbors": k_neighbors + } + + for name, model in models.items(): + model.fit(X_train.values, y_train.values) + + for name, model in models.items(): + pred = model.predict(X_test.values) + + my_f1_macro_score = calc_f1_macro(y_test, pd.DataFrame(pred)) + print(f'My F1 score of {name} is {my_f1_macro_score}\n') + + f1_sklearn = f1_score(y_test.values, pred, average='macro') + print(f'Sklearn F1 score of {name} is {f1_sklearn}\n') + + score = get_score_from_cli() + + label_encoder = LabelEncoder() + df["points"] = label_encoder.fit_transform(df["points"]) + + for name, model in models.items(): + pred = model.predict(score) + points_number = pd.DataFrame(pred).idxmax(axis=1) + points = label_encoder.inverse_transform(points_number)[0] + print(f"{name}: {points} Punkte") + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/data/shots.csv b/data/shots.csv index 9271d21..edb6562 100644 --- a/data/shots.csv +++ b/data/shots.csv @@ -780,7 +780,7 @@ points,x,y 10,0.0,0.0 6,4.0,-3.0 10,-1.0,-1.0 -9,6.0,-2.0 +9,1.5,-2.0 8,1.5,-2.5 6,-1.0,-4.5 6,5.5,-1.5 diff --git a/data/shots_dev.csv b/data/shots_dev.csv new file mode 100644 index 0000000..edb6562 --- /dev/null +++ b/data/shots_dev.csv @@ -0,0 +1,955 @@ +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.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/shots_dev.xlsx new file mode 100644 index 0000000..b3c9c97 Binary files /dev/null and b/data/shots_dev.xlsx differ diff --git a/data/synthetic_data.csv b/data/synthetic_data.csv new file mode 100644 index 0000000..69a4138 --- /dev/null +++ b/data/synthetic_data.csv @@ -0,0 +1,1001 @@ +points,x,y +0,-10.0,-8.5 +1,9.0,-4.5 +2,-9.0,-1.0 +3,5.5,-6.0 +6,0.5,-5.0 +2,-7.0,5.5 +2,2.0,-8.5 +2,-8.5,3.0 +0,-8.5,-7.5 +0,7.5,-9.5 +7,-4.0,-0.5 +0,-9.5,-8.0 +5,6.5,0.0 +2,4.0,8.0 +4,-7.0,-0.5 +5,3.0,-5.5 +7,-4.0,-1.0 +5,5.0,-4.0 +0,5.0,9.5 +3,-7.5,3.0 +2,-8.0,3.5 +1,6.5,7.5 +3,-7.5,-4.0 +8,0.0,-3.5 +10,-0.5,1.0 +0,7.5,-7.5 +2,-8.0,4.0 +10,-1.0,0.5 +1,4.5,9.0 +3,2.5,7.5 +4,7.0,2.5 +4,2.0,6.5 +0,-8.5,-7.5 +5,4.0,-4.5 +0,-5.0,9.5 +1,6.5,-8.0 +4,1.5,-7.0 +5,1.5,5.5 +7,-0.5,-3.5 +0,-9.0,-5.5 +1,-9.5,-4.0 +0,6.0,-9.5 +0,-9.0,6.0 +0,-8.0,-10.0 +6,0.0,5.0 +1,8.5,-4.5 +1,-6.0,8.5 +0,9.0,10.0 +1,8.5,6.0 +0,-9.0,-7.0 +9,-1.0,1.5 +5,-1.0,-6.0 +4,0.0,7.0 +8,-1.5,3.0 +0,-10.0,-7.0 +3,4.5,-6.5 +0,-6.5,9.0 +2,8.5,-3.5 +0,8.0,-10.0 +5,-0.5,-6.0 +8,-1.5,2.5 +10,1.5,0.0 +3,-6.5,4.5 +2,6.0,-7.0 +1,-1.5,10.0 +0,-9.5,-10.0 +6,-1.0,5.0 +4,-4.0,6.0 +5,-6.5,0.0 +2,-1.5,-8.5 +4,-4.0,5.5 +4,-6.0,-4.0 +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,2.5,-4.0 +6,5.0,-2.0 +0,9.5,-9.0 +3,-0.5,8.0 +7,4.0,1.5 +2,1.5,8.5 +7,-1.0,-3.5 +10,-1.5,0.0 +0,4.5,-9.5 +1,7.5,6.0 +3,0.0,8.0 +3,-8.0,0.0 +7,-4.0,2.0 +3,-7.5,-3.0 +3,7.0,4.5 +0,10.0,-7.5 +2,8.5,4.0 +3,0.5,-7.5 +1,7.0,7.5 +0,-8.0,-8.0 +0,-9.0,-6.5 +3,2.0,-8.0 +3,-3.5,7.0 +9,2.0,-1.0 +10,-1.0,-1.0 +3,4.0,-6.5 +5,6.0,2.5 +6,5.0,2.0 +4,3.5,-5.5 +7,-3.0,-2.0 +0,-7.0,-8.0 +4,1.0,-6.5 +1,-3.0,9.5 +2,-5.5,-6.5 +2,-2.0,8.5 +6,-5.0,1.5 +8,-1.5,3.0 +0,-5.5,-9.5 +8,0.0,-3.0 +8,1.5,2.5 +8,2.5,1.5 +1,-2.0,-10.0 +2,-8.5,1.0 +2,-9.0,-2.5 +8,-2.5,1.5 +3,-3.5,-7.5 +2,7.0,-5.0 +3,6.0,6.0 +0,8.0,9.0 +1,7.0,7.5 +9,-1.5,-2.0 +2,-8.0,-4.0 +7,4.0,-1.0 +3,7.0,-3.5 +3,4.5,-6.5 +0,10.0,-7.0 +6,-4.0,3.5 +6,4.5,2.5 +3,6.5,4.0 +3,2.0,7.5 +0,-8.0,10.0 +6,2.5,4.0 +2,4.5,8.0 +7,2.5,2.5 +2,-9.0,2.0 +4,-7.0,-1.5 +4,-7.0,2.5 +0,10.0,5.0 +3,-6.0,-5.0 +7,-0.5,-4.0 +0,-10.0,8.5 +3,5.5,-6.0 +1,-0.5,-10.0 +1,-1.5,-9.5 +0,-7.5,-8.0 diff --git a/main.py b/main.py index 7072a2d..fccea88 100644 --- a/main.py +++ b/main.py @@ -15,7 +15,8 @@ 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/shots.csv", usecols = colum_list).dropna() + df = pd.read_csv("data/synthetic_data.csv", usecols = colum_list).dropna() return df except FileNotFoundError as error: print(error) @@ -73,8 +74,9 @@ def get_score_from_cli(): def main(): df = load_dataframe() - '''print(df.head()) - + print(df.describe()) + #print(df.head()) + #print(df.head().info()) sns.countplot(x = df["points"]) plt.show() @@ -82,10 +84,11 @@ def main(): plt.show() sns.scatterplot(x=df['x'], y=df['y'], hue=df['points']) - plt.show()''' + plt.show() + - df["radius"] = np.sqrt(df["x"]**2 + df["y"]**2) - X = df[["radius"]] + features = ["x", "y"] + X = df[features] y = pd.get_dummies(df['points']) diff --git a/rule_based_values.py b/rule_based_values.py new file mode 100644 index 0000000..c362b03 --- /dev/null +++ b/rule_based_values.py @@ -0,0 +1,85 @@ +# 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) + +import pandas as pd +import numpy as np +import csv + +FEATURES = ["points", "x", "y"] + +# Area circle +A10 = 1.5 ** 2 * np.pi +A9 = 2.5 ** 2 * np.pi +A8 = 3.5 ** 2 * np.pi +A7 = 4.5 ** 2 * np.pi +A6 = 5.5 ** 2 * np.pi +A5 = 6.5 ** 2 * np.pi +A4 = 7.5 ** 2 * np.pi +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) # frin -10 to 10 with step 0.5 + +xy = [(np.random.choice(possible_values), np.random.choice(possible_values)) for _ in range(1000)] + +dataset = [] + +for i in xy: + A = (i[0]**2 + i[1]**2) * np.pi + + #print(A) + + if A <= A10: + dataset.append([10, i[0], i[1]]) + elif A > A10 and A <= A9: + dataset.append([9, i[0], i[1]]) + elif A > A9 and A <= A8: + dataset.append([8, i[0], i[1]]) + elif A > A8 and A <= A7: + dataset.append([7, i[0], i[1]]) + elif A > A7 and A <= A6: + dataset.append([6, i[0], i[1]]) + elif A > A6 and A <= A5: + dataset.append([5, i[0], i[1]]) + elif A > A5 and A <= A4: + dataset.append([4, i[0], i[1]]) + elif A > A4 and A <= A3: + dataset.append([3, i[0], i[1]]) + elif A > A3 and A <= A2: + dataset.append([2, i[0], i[1]]) + elif A > A2 and A <= A1: + dataset.append([1, i[0], i[1]]) + elif A > A1: + dataset.append([0, i[0], i[1]]) + +#print(dataset) + +with open('data/synthetic_data.csv', 'w', newline='') as csvfile: + fieldnames = ['points', 'x', 'y'] + writer = csv.writer(csvfile) + writer.writerows(dataset) diff --git a/vector.py b/vector.py new file mode 100644 index 0000000..13d713b --- /dev/null +++ b/vector.py @@ -0,0 +1,127 @@ +import pandas as pd +import numpy as np +import seaborn as sns +import matplotlib.pyplot as plt +from sklearn.metrics import f1_score +from sklearn.model_selection import train_test_split +from sklearn.ensemble import RandomForestClassifier +from sklearn.neighbors import KNeighborsClassifier +from sklearn.tree import DecisionTreeClassifier +from sklearn.preprocessing import LabelEncoder + +FEATURES = ["points", "x", "y"] + +# create dataframe from csv and drop any row with null values +def load_dataframe(): + try: + colum_list = FEATURES + df = pd.read_csv("data/synthetic_data.csv", usecols = colum_list).dropna() + return df + except FileNotFoundError as error: + print(error) + quit() + +def calc_f1_macro(y_true, y_pred): + f1_scores = [] + for column in y_true: + score = calc_f1_score(y_true[column].values, y_pred[column]) + f1_scores.append(score) + return np.mean(f1_scores) + +def calc_f1_score(y_true, y_pred): + tp = np.sum(np.multiply([i==True for i in y_pred], y_true)) + tn = np.sum(np.multiply([i==False for i in y_pred], [not(j) for j in y_true])) + 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)) + + precision = calc_precision(tp, fp) + recall = calc_recall(tp, fn) + + '''if tp != 0 and fp != 0: + precision = calc_precision(tp, fp) + else: + precision = 0 + + if tp != 0 and fn != 0: + recall = calc_recall(tp, fn) + else: + recall = 0''' + + if precision != 0 and recall != 0: + f1 = (2 * precision * recall) / (precision + recall) + else: + f1 = 0 + return f1 + +def calc_precision(tp, fp): + return tp / (tp + fp) + +def calc_recall(tp, fn): + return tp / (tp + fn) + +def get_score_from_cli(): + try: + x = float(input("x: ")) + y = float(input("y: ")) + abs_v = np.sqrt(x**2 + y**2) + return np.array([abs_v]).reshape(1, -1) + except ValueError: + print("Invalid input. Please enter numeric values.") + return None + +def main(): + df = load_dataframe() + print(df.head()) + + sns.countplot(x = df["points"]) + plt.show() + + sns.heatmap(df.corr(), annot=True, cmap='coolwarm') + plt.show() + + sns.scatterplot(x=df['x'], y=df['y'], hue=df['points']) + plt.show() + + df["radius"] = np.sqrt(df["x"]**2 + df["y"]**2) + X = df[["radius"]] + + y = pd.get_dummies(df['points']) + + X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.4, random_state=0) + + random_forest = RandomForestClassifier(n_estimators=700, random_state=0) + decision_tree = DecisionTreeClassifier(random_state=0) + k_neighbors = KNeighborsClassifier(n_neighbors=5) + + models = { + "Random Forest Classifier": random_forest, + "Decision Tree Classifier": decision_tree, + "K-Neighbors": k_neighbors + } + + for name, model in models.items(): + model.fit(X_train.values, y_train.values) + + for name, model in models.items(): + pred = model.predict(X_test.values) + + my_f1_macro_score = calc_f1_macro(y_test, pd.DataFrame(pred)) + print(f'My F1 score of {name} is {my_f1_macro_score}\n') + + f1_sklearn = f1_score(y_test.values, pred, average='macro') + print(f'Sklearn F1 score of {name} is {f1_sklearn}\n') + + score = get_score_from_cli() + + label_encoder = LabelEncoder() + df["points"] = label_encoder.fit_transform(df["points"]) + + for name, model in models.items(): + pred = model.predict(score) + points_number = pd.DataFrame(pred).idxmax(axis=1) + points = label_encoder.inverse_transform(points_number)[0] + print(f"{name}: {points} Punkte") + + +if __name__ == "__main__": + main() \ No newline at end of file