better constructor for cross validation with dictionaries