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.

logistic_def.h 2.1 kB

1234567891011121314151617181920212223242526272829303132333435
  1. #include"../matrix/matrix_def.h"
  2. #include"../matrix/matrix_pro.h"
  3. #include<math.h>
  4. #include<iostream>
  5. using namespace std;
  6. /*
  7. ███████╗██████╗ ██████╗ ███████╗ ███████╗███╗ ██╗ ██████╗ ██╗███╗ ██╗███████╗
  8. ██╔════╝██╔══██╗██╔════╝ ██╔════╝ ██╔════╝████╗ ██║██╔════╝ ██║████╗ ██║██╔════╝
  9. █████╗ ██║ ██║██║ ███╗█████╗ █████╗ ██╔██╗ ██║██║ ███╗██║██╔██╗ ██║█████╗
  10. ██╔══╝ ██║ ██║██║ ██║██╔══╝ ██╔══╝ ██║╚██╗██║██║ ██║██║██║╚██╗██║██╔══╝
  11. ███████╗██████╔╝╚██████╔╝███████╗ ███████╗██║ ╚████║╚██████╔╝██║██║ ╚████║███████╗
  12. ╚══════╝╚═════╝ ╚═════╝ ╚══════╝ ╚══════╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝╚═╝ ╚═══╝╚══════╝
  13. Author:Edge
  14. Web:likedge.top
  15. Date:20200925
  16. */
  17. double get_sigmoid(double temp)
  18. {
  19. // cout<<"temp"<<temp<<endl;
  20. return 1/1+exp(0-temp);
  21. }
  22. Matrix e_sigmoid(Matrix mid1)
  23. {
  24. Matrix result = CreateMatrix(mid1.row,mid1.col);
  25. for(int index_x = 0;index_x<mid1.row;index_x++)
  26. {
  27. for(int index_y=0;index_y<mid1.col;index_y++)
  28. {
  29. // cout<<"ex:"<<get_sigmoid(mid1.matrix[index_x][index_y])<<endl;
  30. result.matrix[index_x][index_y]= 1.0/(1+exp(-mid1.matrix[index_x][index_y]));
  31. }
  32. }
  33. return result;
  34. }

Edge : 一个开源的科学计算引擎