diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b694934 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.venv \ No newline at end of file diff --git a/main.py b/main.py index fe075fa..7072a2d 100644 --- a/main.py +++ b/main.py @@ -19,7 +19,7 @@ def load_dataframe(): return df except FileNotFoundError as error: print(error) - quit() + quit() def calc_f1_macro(y_true, y_pred): f1_scores = [] @@ -34,6 +34,12 @@ 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)''' + if tp != 0 and fp != 0: precision = calc_precision(tp, fp) else: @@ -58,9 +64,9 @@ def calc_recall(tp, fn): def get_score_from_cli(): try: - culmen_depth = float(input("x: ")) - culmen_length = float(input("y: ")) - return np.array([culmen_depth, culmen_length]).reshape(1, -1) + 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 @@ -78,9 +84,8 @@ def main(): sns.scatterplot(x=df['x'], y=df['y'], hue=df['points']) plt.show()''' - features = ["x", "y"] - - X = df[features] + df["radius"] = np.sqrt(df["x"]**2 + df["y"]**2) + X = df[["radius"]] y = pd.get_dummies(df['points'])