I\'ve been trying for several days to get @jit
working to speed up my code.
Finally I came across this, describing adding @jit
to object methods:
h
From what I can see from the documentation, you cannot apply the decorator to a method; the error you see is from the JIT parser not handling the source code indentation when not in the context of a class
statement.
If you want the body of that method to be compiled, you'll need to factor it out to a separate function, and call that function from the method:
@jit(void(object_, float_[:,:], int_[:], int_))
def train_function(instance, X, y, H):
# do stuff
class GentleBoostC(object):
def train(self, X, y, H):
train_function(self, X, y, H)