Max-margin non-negative matrix factorization with flexible spatial constraints based on factor analysis