I'm writing a K-Nearest Neighbors classifier class. I would like to allow the client the ability to specify the distance function to be used.
Can the constructor of my KNNClassifier
object take a method as a parameter? In Python I'm doing this as follows:
class KNNClassifier:
def __init__(self, examples, membership, n_classes, distance_func):
self.examples = examples
self.membership = membership
self.n_classes = n_classes
self.distance_func = distance_func
self.m = len(self.membership)
self.n = len(self.examples[0])`
Can this be done in C#? I'm new to C# and an elementary example would be appreciated.