Algorithms for hierarchial classification with applications in portfolio management