fitAndCategorize function

Fit and categorize.