Added the assign_weights method