You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

eval.py 1.7 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # Copyright 2021 The KubeEdge Authors.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import json
  15. from sedna.datasources import CSVDataParse
  16. from sedna.common.config import BaseConfig
  17. from sedna.core.lifelong_learning import LifelongLearning
  18. from interface import DATACONF, Estimator, feature_process
  19. def main():
  20. test_dataset_url = BaseConfig.test_dataset_url
  21. valid_data = CSVDataParse(data_type="valid", func=feature_process)
  22. valid_data.parse(test_dataset_url, label=DATACONF["LABEL"])
  23. attribute = json.dumps({"attribute": DATACONF["ATTRIBUTES"]})
  24. task_definition = {
  25. "method": "TaskDefinitionByDataAttr",
  26. "param": attribute
  27. }
  28. ll_job = LifelongLearning(
  29. estimator=Estimator,
  30. task_definition=task_definition,
  31. task_relationship_discovery=None,
  32. task_mining=None,
  33. task_remodeling=None,
  34. inference_integrate=None,
  35. unseen_task_detect=None
  36. )
  37. eval_experiment = ll_job.evaluate(
  38. data=valid_data, metrics="precision_score",
  39. metrics_param={"average": "micro"}
  40. )
  41. return eval_experiment
  42. if __name__ == '__main__':
  43. print(main())