Knowledge-Graph-Hub/neat-ml

Missing key in defining metrics in the config

Closed this issue · 0 comments

When defining metrics in a neat config yaml as follows:

        metrics_config:
          metrics:
            - name: auprc
              type: tensorflow.keras.metrics.AUC
              curve: PR
            - name: auroc
              type: tensorflow.keras.metrics.AUC
              curve: ROC
            - name: Recall
              type: tensorflow.keras.metrics.Recall
            - name: Precision
              type: tensorflow.keras.metrics.Precision
            - type: accuracy

The mlp_model.py looks for the parameters key but can't find it, raising a KeyError.

        for m in metrics:
            if m["type"].startswith("tensorflow.keras"):
                m_class = self.dynamically_import_class(m["type"])
                m_parameters = m["parameters"]
                m_instance = m_class(**m_parameters)

Stack trace from a recent neat-kghub-scheduler run:

12:09:08  Traceback (most recent call last):
12:09:08    File "/home/jenkinsuser/anaconda3/bin/neat", line 8, in <module>
12:09:08      sys.exit(cli())
12:09:08    File "/home/jenkinsuser/.local/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
12:09:08      return self.main(*args, **kwargs)
12:09:08    File "/home/jenkinsuser/.local/lib/python3.8/site-packages/click/core.py", line 1053, in main
12:09:08      rv = self.invoke(ctx)
12:09:08    File "/home/jenkinsuser/.local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
12:09:08      return _process_result(sub_ctx.command.invoke(sub_ctx))
12:09:08    File "/home/jenkinsuser/.local/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
12:09:08      return ctx.invoke(self.callback, **ctx.params)
12:09:08    File "/home/jenkinsuser/.local/lib/python3.8/site-packages/click/core.py", line 754, in invoke
12:09:08      return __callback(*args, **kwargs)
12:09:08    File "/home/jenkinsuser/anaconda3/lib/python3.8/site-packages/neat_ml/cli.py", line 82, in run
12:09:08      model.compile()
12:09:08    File "/home/jenkinsuser/anaconda3/lib/python3.8/site-packages/neat_ml/link_prediction/mlp_model.py", line 45, in compile
12:09:08      m_parameters = m["parameters"]
12:09:08  KeyError: 'parameters'