Partition function and risk sensitivity