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
|
||||||
17
main.py
17
main.py
@ -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]))
|
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))
|
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:
|
if tp != 0 and fp != 0:
|
||||||
precision = calc_precision(tp, fp)
|
precision = calc_precision(tp, fp)
|
||||||
else:
|
else:
|
||||||
@ -58,9 +64,9 @@ def calc_recall(tp, fn):
|
|||||||
|
|
||||||
def get_score_from_cli():
|
def get_score_from_cli():
|
||||||
try:
|
try:
|
||||||
culmen_depth = float(input("x: "))
|
x = float(input("x: "))
|
||||||
culmen_length = float(input("y: "))
|
y = float(input("y: "))
|
||||||
return np.array([culmen_depth, culmen_length]).reshape(1, -1)
|
return np.array([x, y]).reshape(1, -1)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("Invalid input. Please enter numeric values.")
|
print("Invalid input. Please enter numeric values.")
|
||||||
return None
|
return None
|
||||||
@ -78,9 +84,8 @@ def main():
|
|||||||
sns.scatterplot(x=df['x'], y=df['y'], hue=df['points'])
|
sns.scatterplot(x=df['x'], y=df['y'], hue=df['points'])
|
||||||
plt.show()'''
|
plt.show()'''
|
||||||
|
|
||||||
features = ["x", "y"]
|
df["radius"] = np.sqrt(df["x"]**2 + df["y"]**2)
|
||||||
|
X = df[["radius"]]
|
||||||
X = df[features]
|
|
||||||
|
|
||||||
y = pd.get_dummies(df['points'])
|
y = pd.get_dummies(df['points'])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user