-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel_confidence_mapping.py
More file actions
42 lines (32 loc) · 1.39 KB
/
Copy pathmodel_confidence_mapping.py
File metadata and controls
42 lines (32 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import pandas as pd
from typing import Optional
import os
def model_accuracy_mapping(
augmentation_magnitude: Optional[float],
augmentation_type: Optional[str],
root_path: Optional[str] = "/kaggle/working/MasterArbeit",
) -> Optional[float]:
# For local testing
# root_path = '/home/ekagra/Documents/GitHub/MasterArbeit'
filename = os.path.join(root_path, f"{augmentation_type}_MAPPING_results.csv")
data = pd.read_csv(filename)
augmentation_magnitude_list = data["Severity"]
model_accuracy_list = data["Accuracy"]
# idx = np.where(augmentation_magnitude_list == augmentation_magnitude)
for i in range(len(augmentation_magnitude_list)):
mag = augmentation_magnitude_list[i]
if round(mag, 5) == round(augmentation_magnitude, 5):
return model_accuracy_list[i], i
if __name__ == "__main__":
augmentation_type = "Posterize"
data = pd.read_csv(
f"non_linear_mapping_data/{augmentation_type}/{augmentation_type}_MAPPING_results.csv"
)
augmentation_magnitude = data["Severity"]
augmentation_mean = data["Mean"]
augmentation_std = data["Std"]
model_accuracy = data["Accuracy"]
augmentation_value = augmentation_magnitude[25]
print(augmentation_value)
model_accuracy_value = model_accuracy_mapping(augmentation_value, augmentation_type)
print(f"Model Accuracy: {model_accuracy_value}")