A bottom-up approach to pattern classification