class_docstr: Evaluator for property optimization task. Metric is top-3 property scores among generated molecules.
  
  Args:
      prop_name (str): A string indicating the name of the molecular property, use 'plogp' for penalized logP or 'qed' for 
          Quantitative Estimate of Druglikeness (QED). (default: :obj:`plogp`)
docstr: Run evaluation in property optimization task. Find top-3 molucules which have highest property scores.
  
  Args:
      input_dict (dict): A python dict with the following items:
          "mols" --- a list of generated molecules reprsented by rdkit Chem.Mol or Chem.RWMol objects.
      
  :rtype: :class:`dict` a python dict with the following items:
              1 --- information of molecule with the highest property score;
              2 --- information of molecule with the second highest property score;
              3 --- information of molecule with the third highest property score.
              The molecule information is given in the form of a tuple (SMILES string, property score).
code: def eval(self, input_dict):
      r"""Run evaluation in property optimization task. Find top-3 molucules which have highest property scores.
  
      Args:
          input_dict (dict): A python dict with the following items:
              "mols" --- a list of generated molecules reprsented by rdkit Chem.Mol or Chem.RWMol objects.
  
      :rtype: :class:`dict` a python dict with the following items:
                  1 --- information of molecule with the highest property score;
                  2 --- information of molecule with the second highest property score;
                  3 --- information of molecule with the third highest property score.
                  The molecule information is given in the form of a tuple (SMILES string, property score).
      """
  
      mols = input_dict["mols"]
      prop_fn = qed if self.prop_name == "qed" else calculate_min_plogp
  
      results = {}
      valid_mols = [mol for mol in mols if check_chemical_validity(mol)]
      valid_smiles = [Chem.MolToSmiles(mol) for mol in valid_mols]
      props = [prop_fn(mol) for mol in valid_mols]
      sorted_index = np.argsort(props)[::-1]
  
      assert len(valid_mols) >= 3
      for i in range(3):
          print(
              "Top {} property score: {}".format(
                  i + 1, props[sorted_index[i]]
              )
          )
          results[i + 1] = (
              valid_smiles[sorted_index[i]],
              props[sorted_index[i]],
          )
  
      return results
  
file_path: DIG/dig/ggraph/evaluation/metric.py
imports: from rdkit import Chem
  import numpy
  from dig.ggraph.utils import check_chemical_validity, qed, calculate_min_plogp, reward_target_molecule_similarity
label_desc: Use image node_id 2 for calling the PropOptEvaluator obj's underlying member method code with example usage: obj.eval(input_dict) and returns: results