Ok thanks for your help, yes this helped. I also found a good solution on the forums here: Theano error with element wise multiplication
crime_p = (a[city] + b[city] * X).sum(axis=1)
In terms of getting out predictions, I take it most people would use alpha and beta (rather than a and b)? E.g. if I had some random new city that I had no data about.