Cost function builder. For fitting distribution. In beta stage (need tons of documentation)