Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

gandlf_generateMetrics 2.0 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  1. #!usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import os
  4. import argparse
  5. import ast
  6. import sys
  7. from GANDLF import version
  8. from GANDLF.cli import generate_metrics, copyrightMessage
  9. if __name__ == "__main__":
  10. parser = argparse.ArgumentParser(
  11. prog="GANDLF_Metrics",
  12. formatter_class=argparse.RawTextHelpFormatter,
  13. description="Metrics calculator.\n\n" + copyrightMessage,
  14. )
  15. parser.add_argument(
  16. "-c",
  17. "--config",
  18. "--parameters_file",
  19. metavar="",
  20. type=str,
  21. required=True,
  22. help="The configuration file (contains all the information related to the training/inference session)",
  23. )
  24. parser.add_argument(
  25. "-i",
  26. "--inputdata",
  27. "--data_path",
  28. metavar="",
  29. type=str,
  30. required=True,
  31. help="The CSV file of input data that is used to generate the metrics; should contain 3 columns: 'SubjectID,Target,Prediction'",
  32. )
  33. parser.add_argument(
  34. "-o",
  35. "--outputfile",
  36. "--output_path",
  37. metavar="",
  38. type=str,
  39. default=None,
  40. help="Location to save the output dictionary. If not provided, will print to stdout.",
  41. )
  42. parser.add_argument(
  43. "-v",
  44. "--version",
  45. action="version",
  46. version="%(prog)s v{}".format(version) + "\n\n" + copyrightMessage,
  47. help="Show program's version number and exit.",
  48. )
  49. # This is a dummy argument that exists to trigger MLCube mounting requirements.
  50. # Do not remove.
  51. parser.add_argument("-rawinput", "--rawinput", help=argparse.SUPPRESS)
  52. args = parser.parse_args()
  53. assert args.config is not None, "Missing required parameter: config"
  54. assert args.inputdata is not None, "Missing required parameter: inputdata"
  55. try:
  56. generate_metrics.generate_metrics_dict(
  57. args.inputdata,
  58. args.config,
  59. args.outputfile,
  60. )
  61. except Exception as e:
  62. sys.exit("ERROR: " + str(e))
  63. print("Finished.")
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...