I have a class created in python, with the following structure.
class Bayes():
def __init__(self,k=1):
...
def train(self,X,y):
...
def classify_prob(self,ejemplo):
...
def classify(self,ejemplo):
...
Now, I need to generate a class that gives me an exception (with raise). This exception should give me if I call the classify or classify_prob methods before calling the train method.
The class must have the following structure:
class ClassifyNoTrain(Exception): pass
How could I do this class?. Thank you