@staticmethod<EOL><INDENT>def load(models_dir=None, max_models=None):<DEDENT>
if models_dir is None:<EOL><INDENT>models_dir = get_default_class1_models_dir()<EOL><DEDENT>manifest_path = join(models_dir, "<STR_LIT>")<EOL>manifest_df = pandas.read_csv(manifest_path, nrows=max_models)<EOL>allele_to_allele_specific_models = collections.defaultdict(list)<EOL>class1_pan_allele_models = []<EOL>all_models = []<EOL>for (_, row) in manifest_df.iterrows():<EOL><INDENT>weights_filename = Class1AffinityPredictor.weights_path(<EOL>models_dir, row.model_name)<EOL>config = json.loads(row.config_json)<EOL>model = Class1NeuralNetwork.from_config(<EOL>config,<EOL>weights_loader=partial(<EOL>Class1AffinityPredictor.load_weights,<EOL>abspath(weights_filename)))<EOL>if row.allele == "<STR_LIT>":<EOL><INDENT>class1_pan_allele_models.append(model)<EOL><DEDENT>else:<EOL><INDENT>allele_to_allele_specific_models[row.allele].append(model)<EOL><DEDENT>all_models.append(model)<EOL><DEDENT>manifest_df["<STR_LIT>"] = all_models<EOL>allele_to_fixed_length_sequence = None<EOL>if exists(join(models_dir, "<STR_LIT>")):<EOL><INDENT>allele_to_fixed_length_sequence = pandas.read_csv(<EOL>join(models_dir, "<STR_LIT>"),<EOL>index_col="<STR_LIT>").to_dict()<EOL><DEDENT>allele_to_percent_rank_transform = {}<EOL>percent_ranks_path = join(models_dir, "<STR_LIT>")<EOL>if exists(percent_ranks_path):<EOL><INDENT>percent_ranks_df = pandas.read_csv(percent_ranks_path, index_col=<NUM_LIT:0>)<EOL>for allele in percent_ranks_df.columns:<EOL><INDENT>allele_to_percent_rank_transform[allele] = (<EOL>PercentRankTransform.from_series(percent_ranks_df[allele]))<EOL><DEDENT><DEDENT>logging.info(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (<EOL>len(class1_pan_allele_models),<EOL>len(allele_to_fixed_length_sequence) if allele_to_fixed_length_sequence else <NUM_LIT:0>,<EOL>len(allele_to_percent_rank_transform),<EOL>sum(len(v) for v in allele_to_allele_specific_models.values()),<EOL>"<STR_LIT:U+002CU+0020>".join(<EOL>"<STR_LIT>" % (allele, len(v))<EOL>for (allele, v)<EOL>in sorted(allele_to_allele_specific_models.items()))))<EOL>result = Class1AffinityPredictor(<EOL>allele_to_allele_specific_models=allele_to_allele_specific_models,<EOL>class1_pan_allele_models=class1_pan_allele_models,<EOL>allele_to_fixed_length_sequence=allele_to_fixed_length_sequence,<EOL>manifest_df=manifest_df,<EOL>allele_to_percent_rank_transform=allele_to_percent_rank_transform,<EOL>)<EOL>return result<EOL>
Deserialize a predictor from a directory on disk.

Parameters
----------
models_dir : string
    Path to directory

max_models : int, optional
    Maximum number of `Class1NeuralNetwork` instances to load

Returns
-------
`Class1AffinityPredictor` instance