def predict(self, peptides, allele_encoding=None, batch_size=<NUM_LIT>):
assert self.prediction_cache is not None<EOL>use_cache = (<EOL>allele_encoding is None and<EOL>isinstance(peptides, EncodableSequences))<EOL>if use_cache and peptides in self.prediction_cache:<EOL><INDENT>return self.prediction_cache[peptides].copy()<EOL><DEDENT>x_dict = {<EOL>'<STR_LIT>': self.peptides_to_network_input(peptides)<EOL>}<EOL>if allele_encoding is not None:<EOL><INDENT>allele_input = self.allele_encoding_to_network_input(allele_encoding)<EOL>x_dict['<STR_LIT>'] = allele_input<EOL><DEDENT>network = self.network(borrow=True)<EOL>raw_predictions = network.predict(x_dict, batch_size=batch_size)<EOL>predictions = numpy.array(raw_predictions, dtype = "<STR_LIT>")[:,<NUM_LIT:0>]<EOL>result = to_ic50(predictions)<EOL>if use_cache:<EOL><INDENT>self.prediction_cache[peptides] = result<EOL><DEDENT>return result<EOL>
Predict affinities.

If peptides are specified as EncodableSequences, then the predictions
will be cached for this predictor as long as the EncodableSequences object
remains in memory. The cache is keyed in the object identity of the
EncodableSequences, not the sequences themselves.

Parameters
----------
peptides : EncodableSequences or list of string

allele_encoding : AlleleEncoding, optional
    Only required when this model is a pan-allele model

batch_size : int
    batch_size passed to Keras

Returns
-------
numpy.array of nM affinity predictions