berechnet Vektorbetrag und nutzt diesen als Feature
This commit is contained in:
parent
de62eb1e43
commit
0d978b9463
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.venv
|
||||
19
main.py
19
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'])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user