Milan fell 2-1 to the Azzurri at the San Siro.
Allegri said: "Tonight the team put in a decent performance in technical terms, though we were naive in the first 10 minutes and conceded that avoidable goal. It was in a way our best performance of the Serie A season so far. We were lucky to get back the 2-2 draw at Torino, so we paid for that good fortune this time around.
"If we were going to play badly and earn a result, I preferred to play well and lose, even if this was a head-to-head. We could've done better in the box, but apart from the opening 10 minutes it was our best performance of the season."
Milan are now in 11th place with only four points from as many Serie A matches.
"We must try to pick up as many points as possible now. Napoli are one of the candidates for the Scudetto and we played on a par with them overall despite missing many key players.
"I already have ideas on how to fix things, but I need some of the players to recover from injuries first."