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.

example_rkme.py 793 B

12345678910111213141516171819202122232425262728
  1. import numpy as np
  2. import learnware.specification as specification
  3. if __name__ == "__main__":
  4. data_X = np.random.randn(10000, 20, 10, 5)
  5. for i in range(10):
  6. data_X[i, i] = np.nan
  7. spec1 = specification.utils.generate_rkme_spec(X=data_X, gamma=0.1, cuda_idx=-1)
  8. spec2 = specification.rkme.RKMEStatSpecification()
  9. spec1.generate_stat_spec_from_data(data_X)
  10. spec1.save("spec.json")
  11. beta = spec1.get_beta()
  12. z = spec1.get_z()
  13. print(type(beta), beta.shape)
  14. print(type(z), z.shape)
  15. spec2.load("spec.json")
  16. beta = spec1.get_beta()
  17. z = spec1.get_z()
  18. print(type(beta), beta.shape)
  19. print(type(z), z.shape)
  20. print(spec1.inner_prod(spec2))
  21. print(spec1.dist(spec2))
  22. print(spec1.get_z().shape)
  23. print(spec2.get_z().shape)

基于学件范式,全流程地支持学件上传、检测、组织、查搜、部署和复用等功能。同时,该仓库作为北冥坞系统的引擎,支撑北冥坞系统的核心功能。