Best way to tell if a comment is from a user?

You can simplly check

if ($comment->user_id > 0){
//comment by registered user
}else{
//comment by none registered user
}