-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
32 lines (22 loc) · 862 Bytes
/
example.py
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
from kerneldensityestimator import KDE
def main():
"""Example usage of KDE class."""
kde = KDE()
print(f"Bandwidth (h) = {kde.bandwidth}")
kde.training_model.load("train.csv")
accuracy = kde.get_training_accuracy()
print(f"Training Accuracy {accuracy}%")
kde.testing_model.load("test.csv")
accuracy = kde.get_testing_accuracy()
print(f"Testing Accuracy {accuracy}%")
# Warning, this function can be slow....
kde.plot_class_boundaries(kde.testing_model)
kde.training_model.load("zipcode_train.csv")
accuracy = kde.get_training_accuracy()
print(f"Training Accuracy {accuracy}%")
kde.testing_model.load("zipcode_test.csv")
accuracy = kde.get_testing_accuracy()
print(f"Testing Accuracy {accuracy}%")
#We can't plot this data, it is 16D, not 2D.
if __name__ == "__main__":
main()