Learning the pattern of epistasis linking genotype and phenotype in a protein