berechnet Vektorbetrag und nutzt diesen als Feature

This commit is contained in:
Sandro Zimmermann 2025-11-29 11:17:06 +01:00
parent de62eb1e43
commit 0d978b9463
2 changed files with 13 additions and 7 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.venv

17
main.py
View File

@ -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'])