code: def intra_list_similarity(
      predicted: List[list], feature_df: pd.DataFrame
  ) -> float:
      """
      Computes the average intra-list similarity of all recommendations.
      This metric can be used to measure diversity of the list of recommended items.
      Parameters
      ----------
      predicted : a list of lists
          Ordered predictions
          Example: [['X', 'Y', 'Z'], ['X', 'Y', 'Z']]
      feature_df: dataframe
          A dataframe with one hot encoded or latent features.
          The dataframe should be indexed by the id used in the recommendations.
      Returns:
      -------
          The average intra-list similarity for recommendations.
      """
      feature_df = feature_df.fillna(0)
      Users = range(len(predicted))
      ils = [
          _single_list_similarity(predicted[u], feature_df, u)
          for u in Users
      ]
      return np.mean(ils)
  
imports: import random
  from itertools import product
  from math import sqrt
  from typing import List
  import matplotlib.pyplot
  import numpy
  import pandas
  import scipy.sparse
  from sklearn.metrics import confusion_matrix, mean_squared_error
  from sklearn.metrics.pairwise import cosine_similarity
  import warnings
label_desc: Use image node_id 10 for calling a global function with example usage: intra_list_similarity(predicted, feature_df) and returns: np