aimodelshare 0.1.4__tar.gz → 0.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of aimodelshare might be problematic. Click here for more details.

Files changed (158) hide show
  1. {aimodelshare-0.1.4/aimodelshare.egg-info → aimodelshare-0.1.5}/PKG-INFO +1 -3
  2. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/aimsonnx.py +20 -10
  3. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/api.py +2 -1
  4. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/eval_lambda.txt +14 -0
  5. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/playground.py +8 -1
  6. {aimodelshare-0.1.4 → aimodelshare-0.1.5/aimodelshare.egg-info}/PKG-INFO +1 -3
  7. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/setup.py +1 -1
  8. aimodelshare-0.1.5/tests/test_aimsonnx.py +135 -0
  9. aimodelshare-0.1.5/tests/test_playground.py +721 -0
  10. aimodelshare-0.1.4/tests/test_aimsonnx.py +0 -0
  11. aimodelshare-0.1.4/tests/test_playground.py +0 -345
  12. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/LICENSE +0 -0
  13. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/MANIFEST.in +0 -0
  14. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/README.md +0 -0
  15. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/README.md +0 -0
  16. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/__init__.py +0 -0
  17. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/aws.py +0 -0
  18. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/aws_client.py +0 -0
  19. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/base_image.py +0 -0
  20. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/bucketpolicy.py +0 -0
  21. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/color_mappings/color_mapping_keras.csv +0 -0
  22. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/color_mappings/color_mapping_pytorch.csv +0 -0
  23. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/containerisation.py +0 -0
  24. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/containerization.py +0 -0
  25. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/containerization_templates/Dockerfile.txt +0 -0
  26. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/containerization_templates/Dockerfile_PySpark.txt +0 -0
  27. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/containerization_templates/buildspec.txt +0 -0
  28. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/containerization_templates/lambda_function.txt +0 -0
  29. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/custom_approach/__init__.py +0 -0
  30. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/custom_approach/lambda_function.py +0 -0
  31. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/custom_eval_metrics.py +0 -0
  32. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/data_sharing/__init__.py +0 -0
  33. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/data_sharing/data_sharing_templates/Dockerfile.txt +0 -0
  34. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/data_sharing/data_sharing_templates/__init__.py +0 -0
  35. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/data_sharing/data_sharing_templates/buildspec.txt +0 -0
  36. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/data_sharing/data_sharing_templates/codebuild_policies.txt +0 -0
  37. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/data_sharing/data_sharing_templates/codebuild_trust_relationship.txt +0 -0
  38. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/data_sharing/download_data.py +0 -0
  39. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/data_sharing/share_data.py +0 -0
  40. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/data_sharing/utils.py +0 -0
  41. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/deploy_custom_lambda.py +0 -0
  42. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/Makefile +0 -0
  43. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/__init__.py +0 -0
  44. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/_version.py +0 -0
  45. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/breadcrumbs.html +0 -0
  46. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/layout.html +0 -0
  47. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/search.html +0 -0
  48. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/searchbox.html +0 -0
  49. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/static/css/custom.css +0 -0
  50. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/static/css/custom.css.map +0 -0
  51. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/static/css/theme.css +0 -0
  52. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/static/css/theme.css.map +0 -0
  53. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/static/css/theme.min.css +0 -0
  54. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/static/css/theme.min.css.map +0 -0
  55. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/static/font/fontello.eot +0 -0
  56. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/static/font/fontello.svg +0 -0
  57. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/static/font/fontello.ttf +0 -0
  58. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/static/font/fontello.woff +0 -0
  59. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/static/font/fontello.woff2 +0 -0
  60. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/static/js/theme.js +0 -0
  61. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/karma_sphinx_theme/theme.conf +0 -0
  62. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/make.bat +0 -0
  63. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/requirements.txt +0 -0
  64. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/about.rst +0 -0
  65. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/advanced_features.rst +0 -0
  66. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/competition.rst +0 -0
  67. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/conf.py +0 -0
  68. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/create_credentials.rst +0 -0
  69. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/example_notebooks.rst +0 -0
  70. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/functions.rst +0 -0
  71. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/gettingstarted.rst +0 -0
  72. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/images/creds1.png +0 -0
  73. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/images/creds2.png +0 -0
  74. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/images/creds3.png +0 -0
  75. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/images/creds4.png +0 -0
  76. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/images/creds5.png +0 -0
  77. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/images/creds_file_example.png +0 -0
  78. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/images/predict_tab.png +0 -0
  79. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/index.rst +0 -0
  80. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/documentation/source/modelplayground.rst +0 -0
  81. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/exceptions.py +0 -0
  82. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/generatemodelapi.py +0 -0
  83. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/iam/codebuild_policy.txt +0 -0
  84. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/iam/codebuild_trust_relationship.txt +0 -0
  85. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/iam/lambda_policy.txt +0 -0
  86. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/iam/lambda_trust_relationship.txt +0 -0
  87. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/__init__.py +0 -0
  88. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/api_json.txt +0 -0
  89. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/auth/policy.txt +0 -0
  90. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/auth/role.txt +0 -0
  91. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/eval/policy.txt +0 -0
  92. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/eval/role.txt +0 -0
  93. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/function/policy.txt +0 -0
  94. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/function/role.txt +0 -0
  95. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/integration_response.txt +0 -0
  96. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/lambda_policy_1.txt +0 -0
  97. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/lambda_policy_2.txt +0 -0
  98. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/lambda_role_1.txt +0 -0
  99. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/json_templates/lambda_role_2.txt +0 -0
  100. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/leaderboard.py +0 -0
  101. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/1.txt +0 -0
  102. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/1B.txt +0 -0
  103. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/2.txt +0 -0
  104. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/3.txt +0 -0
  105. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/4.txt +0 -0
  106. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/5.txt +0 -0
  107. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/6.txt +0 -0
  108. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/7.txt +0 -0
  109. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/8.txt +0 -0
  110. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/__init__.py +0 -0
  111. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/authorization.txt +0 -0
  112. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/eval_classification.txt +0 -0
  113. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/eval_regression.txt +0 -0
  114. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/lambda_function.txt +0 -0
  115. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/main/nst.txt +0 -0
  116. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/model.py +0 -0
  117. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/modeluser.py +0 -0
  118. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/placeholders/model.onnx +0 -0
  119. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/placeholders/preprocessor.zip +0 -0
  120. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/postprocessormodules.py +0 -0
  121. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/preprocessormodules.py +0 -0
  122. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/1.txt +0 -0
  123. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/1B.txt +0 -0
  124. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/2.txt +0 -0
  125. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/3.txt +0 -0
  126. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/4.txt +0 -0
  127. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/5.txt +0 -0
  128. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/6.txt +0 -0
  129. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/7.txt +0 -0
  130. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/8.txt +0 -0
  131. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/__init__.py +0 -0
  132. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/authorization.txt +0 -0
  133. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/eval_classification.txt +0 -0
  134. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/eval_lambda.txt +0 -0
  135. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/eval_regression.txt +0 -0
  136. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/lambda_function.txt +0 -0
  137. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/pyspark/nst.txt +0 -0
  138. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/python/my_preprocessor.py +0 -0
  139. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/readme.md +0 -0
  140. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/reproducibility.py +0 -0
  141. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/sam/Dockerfile.txt +0 -0
  142. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/sam/Dockerfile_PySpark.txt +0 -0
  143. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/sam/__init__.py +0 -0
  144. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/sam/buildspec.txt +0 -0
  145. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/sam/codebuild_policies.txt +0 -0
  146. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/sam/codebuild_trust_relationship.txt +0 -0
  147. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/sam/codepipeline_policies.txt +0 -0
  148. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/sam/codepipeline_trust_relationship.txt +0 -0
  149. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/sam/spark-class.txt +0 -0
  150. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/sam/template.txt +0 -0
  151. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/tools.py +0 -0
  152. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare/utils.py +0 -0
  153. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare.egg-info/SOURCES.txt +0 -0
  154. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare.egg-info/dependency_links.txt +0 -0
  155. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare.egg-info/requires.txt +0 -0
  156. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/aimodelshare.egg-info/top_level.txt +0 -0
  157. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/setup.cfg +0 -0
  158. {aimodelshare-0.1.4 → aimodelshare-0.1.5}/tests/__init__.py +0 -0
@@ -1,12 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aimodelshare
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Deploy locally saved machine learning models to a live rest API and web-dashboard. Share it with the world via modelshare.org
5
5
  Home-page: https://www.modelshare.org
6
6
  Author: Michael Parrott
7
7
  Author-email: mikedparrott@modelshare.org
8
- License: UNKNOWN
9
- Platform: UNKNOWN
10
8
  Classifier: Programming Language :: Python :: 3
11
9
  Classifier: License :: Other/Proprietary License
12
10
  Classifier: Operating System :: OS Independent
@@ -3,25 +3,36 @@ import pandas as pd
3
3
  import numpy as np
4
4
 
5
5
  # ml frameworks
6
-
7
6
  try:
8
7
  import sklearn
9
8
  from sklearn.model_selection import GridSearchCV, RandomizedSearchCV
10
9
  except:
11
- pass
10
+ print("Warning: Please install sklearn to enable sklearn features")
11
+
12
12
  try:
13
13
  import torch
14
14
  except:
15
- pass
15
+ print("Warning: Please install pytorch to enable pytorch features")
16
+
16
17
  try:
17
18
  import xgboost
18
19
  except:
19
- pass
20
+ print("Warning: Please install xgboost to enable xgboost features")
21
+
20
22
  try:
21
23
  import tensorflow as tf
22
24
  import keras
23
25
  except:
24
- pass
26
+ print("Warning: Please install tensorflow/keras to enable tensorflow/keras features")
27
+
28
+ try:
29
+ import pyspark
30
+ from pyspark.sql import SparkSession
31
+ from pyspark.ml import PipelineModel, Model
32
+ from pyspark.ml.tuning import CrossValidatorModel, TrainValidationSplitModel
33
+ from onnxmltools import convert_sparkml
34
+ except:
35
+ print("Warning: Please install pyspark to enable pyspark features")
25
36
 
26
37
 
27
38
  # onnx modules
@@ -1184,7 +1195,6 @@ def onnx_to_image(model):
1184
1195
  return pydot_graph
1185
1196
 
1186
1197
 
1187
-
1188
1198
  def inspect_model(apiurl, version=None, naming_convention = None, submission_type="competition"):
1189
1199
  if all(["username" in os.environ,
1190
1200
  "password" in os.environ]):
@@ -1582,9 +1592,9 @@ def model_from_string(model_type):
1582
1592
  def _get_pyspark_modules():
1583
1593
  try:
1584
1594
  if pyspark is None:
1585
- raise("Error: Please install pyspark to enable pyspark features")
1595
+ raise Exception("Error: Please install pyspark to enable pyspark features")
1586
1596
  except:
1587
- raise("Error: Please install pyspark to enable pyspark features")
1597
+ raise Exception("Error: Please install pyspark to enable pyspark features")
1588
1598
 
1589
1599
  pyspark_modules = ['ml', 'ml.feature', 'ml.classification', 'ml.clustering', 'ml.regression']
1590
1600
 
@@ -1603,9 +1613,9 @@ def _get_pyspark_modules():
1603
1613
  def pyspark_model_from_string(model_type):
1604
1614
  try:
1605
1615
  if pyspark is None:
1606
- raise("Error: Please install pyspark to enable pyspark features")
1616
+ raise Exception("Error: Please install pyspark to enable pyspark features")
1607
1617
  except:
1608
- raise("Error: Please install pyspark to enable pyspark features")
1618
+ raise Exception("Error: Please install pyspark to enable pyspark features")
1609
1619
 
1610
1620
  models_modules_dict = _get_pyspark_modules()
1611
1621
  module = models_modules_dict[model_type]
@@ -211,7 +211,8 @@ class create_prediction_api_class():
211
211
  ###
212
212
  api_key = str(shortuuid.uuid())
213
213
 
214
- t = Template(pkg_resources.read_text(main, 'eval_lambda.txt').replace("$apikey",api_key))
214
+ t = Template(pkg_resources.read_text(main, 'eval_lambda.txt').replace("$apikey",api_key).replace("$task_type",self.task_type))
215
+
215
216
  data = t.substitute(bucket_name = self.bucket_name, unique_model_id = self.unique_model_id, task_type = self.task_type)
216
217
  with open(os.path.join(self.temp_dir, 'main.py'), 'w') as file:
217
218
  file.write(data)
@@ -33,6 +33,20 @@ def handler(event, context):
33
33
  if value == "None":
34
34
  body[key]=None
35
35
 
36
+
37
+ if body.get("return_task_type","ALL") == "True" or body.get("return_task_type", "ALL") == "TRUE":
38
+ task_type="$task_type"
39
+ task_type_dict = {"statusCode": 200,
40
+ "headers": {
41
+ "Access-Control-Allow-Origin" : "*",
42
+ "Access-Control-Allow-Credentials": True,
43
+ "Allow" : "GET, OPTIONS, POST",
44
+ "Access-Control-Allow-Methods" : "GET, OPTIONS, POST",
45
+ "Access-Control-Allow-Headers" : "*"},
46
+ "body": json.dumps({"task_type":task_type})
47
+ }
48
+ return task_type_dict
49
+
36
50
  if body.get("exampledata", "ALL") == "True" or body.get("exampledata", "ALL") == "TRUE":
37
51
 
38
52
  exampledata=get_exampledata(example_data_filename = "exampledata.json")
@@ -50,6 +50,13 @@ class ModelPlayground:
50
50
 
51
51
  self.model_type = input_type
52
52
 
53
+ if task_type == None:
54
+ post_dict = {"return_task_type": "TRUE"}
55
+ headers = { 'Content-Type':'application/json', 'authorizationToken': os.environ.get("AWS_TOKEN"),}
56
+ playground_url_eval=playground_url[:-1]+"eval"
57
+ response = requests.post(playground_url_eval,headers=headers,data=json.dumps(post_dict))
58
+ task_type = json.loads(response.text)['task_type']
59
+
53
60
  if task_type == "classification":
54
61
  self.categorical = True
55
62
  elif task_type == "regression":
@@ -786,7 +793,7 @@ class ModelPlayground:
786
793
  eval_metric_filepath=eval_metric_filepath,
787
794
  email_list=email_list,
788
795
  public=public,
789
- public_private_split=public_private_split,
796
+ public_private_split=0, #set to 0 because its an experiment
790
797
  input_dict=exp_input_dict,
791
798
  print_output=False)
792
799
 
@@ -1,12 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aimodelshare
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Deploy locally saved machine learning models to a live rest API and web-dashboard. Share it with the world via modelshare.org
5
5
  Home-page: https://www.modelshare.org
6
6
  Author: Michael Parrott
7
7
  Author-email: mikedparrott@modelshare.org
8
- License: UNKNOWN
9
- Platform: UNKNOWN
10
8
  Classifier: Programming Language :: Python :: 3
11
9
  Classifier: License :: Other/Proprietary License
12
10
  Classifier: Operating System :: OS Independent
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
6
6
 
7
7
  setuptools.setup(
8
8
  name='aimodelshare', #TODO:update
9
- version='0.1.4', #TODO:update
9
+ version='0.1.5', #TODO:update
10
10
  author="Michael Parrott",
11
11
  author_email="mikedparrott@modelshare.org",
12
12
  description="Deploy locally saved machine learning models to a live rest API and web-dashboard. Share it with the world via modelshare.org",
@@ -0,0 +1,135 @@
1
+ from aimodelshare.aimsonnx import _get_layer_names
2
+ from aimodelshare.aimsonnx import _get_layer_names_pytorch
3
+ from aimodelshare.aimsonnx import _get_sklearn_modules
4
+ from aimodelshare.aimsonnx import model_from_string
5
+ from aimodelshare.aimsonnx import _get_pyspark_modules
6
+ from aimodelshare.aimsonnx import pyspark_model_from_string
7
+ from aimodelshare.aimsonnx import layer_mapping
8
+ from aimodelshare.aimsonnx import _sklearn_to_onnx
9
+ from aimodelshare.aimsonnx import _pyspark_to_onnx
10
+ from aimodelshare.aimsonnx import _keras_to_onnx
11
+ from aimodelshare.aimsonnx import _pytorch_to_onnx
12
+ from aimodelshare.aimsonnx import _misc_to_onnx
13
+ from sklearn.linear_model import LogisticRegression
14
+ from sklearn.neural_network import MLPClassifier
15
+ import onnx
16
+ from xgboost import XGBClassifier
17
+ from pyspark.ml.classification import RandomForestClassifier, MultilayerPerceptronClassifier
18
+ from keras.models import Sequential
19
+ from torch import nn
20
+ import torch
21
+ from tensorflow.keras.layers import Dense
22
+
23
+ def test_sklearn_to_onnx():
24
+
25
+ from sklearn.datasets import load_iris
26
+ data = load_iris()
27
+ X = data.data
28
+ y = data.target
29
+
30
+ model = LogisticRegression(C=10, penalty='l1', solver='liblinear')
31
+ model.fit(X, y)
32
+ onnx_model = _sklearn_to_onnx(model)
33
+ assert isinstance(onnx_model, onnx.ModelProto)
34
+
35
+ # model = MLPClassifier()
36
+ # model.fit(X, y)
37
+ # onnx_model = _sklearn_to_onnx(model)
38
+ # assert isinstance(onnx_model, onnx.ModelProto)
39
+
40
+
41
+ # def test_misc_to_onnx():
42
+ #
43
+ # model = XGBClassifier()
44
+ # onnx_model = _misc_to_onnx(model)
45
+ # assert isinstance(onnx_model, onnx.ModelProto)
46
+
47
+
48
+ # def test_pyspark_to_onnx():
49
+ #
50
+ # model =RandomForestClassifier(labelCol="indexedLabel", featuresCol="indexedFeatures", numTrees=10)
51
+ # onnx_model = _pyspark_to_onnx(model)
52
+ # assert isinstance(onnx_model, onnx.ModelProto)
53
+ #
54
+ # model = MultilayerPerceptronClassifier()
55
+ # onnx_model = _pyspark_to_onnx(model)
56
+ # assert isinstance(onnx_model, onnx.ModelProto)
57
+
58
+ def test_keras_to_onnx():
59
+
60
+ model = Sequential()
61
+ model.add(Dense(12, input_shape=(8,), activation='relu'))
62
+ model.add(Dense(8, activation='relu'))
63
+ model.add(Dense(1, activation='sigmoid'))
64
+ model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
65
+
66
+ onnx_model = _keras_to_onnx(model)
67
+ assert isinstance(onnx_model, onnx.ModelProto)
68
+
69
+
70
+ def test_pytorch_to_onnx():
71
+
72
+ model = nn.Sequential(nn.Linear(3, 3),
73
+ nn.ReLU(),
74
+ nn.Linear(3, 1),
75
+ nn.Sigmoid())
76
+
77
+ onnx_model = _pytorch_to_onnx(model, torch.randn(1, 3))
78
+ assert isinstance(onnx_model, onnx.ModelProto)
79
+
80
+
81
+ def test_get_layer_names():
82
+
83
+ layers = _get_layer_names()
84
+
85
+ assert isinstance(layers, tuple)
86
+
87
+
88
+ def test_get_layer_names_pytorch():
89
+
90
+ layers = _get_layer_names_pytorch()
91
+
92
+ assert isinstance(layers, tuple)
93
+
94
+
95
+ def test_get_sklearn_modules():
96
+
97
+ modules = _get_sklearn_modules()
98
+
99
+ assert isinstance(modules, dict)
100
+
101
+ def test_model_from_string():
102
+
103
+ model_class = model_from_string("RandomForestClassifier")
104
+
105
+ assert model_class.__name__ == "RandomForestClassifier"
106
+
107
+
108
+ def test_get_pyspark_modules():
109
+
110
+ modules = _get_pyspark_modules()
111
+
112
+ assert isinstance(modules, dict)
113
+
114
+
115
+ def test_pyspark_model_from_string():
116
+
117
+ model_class = pyspark_model_from_string("RandomForestClassifier")
118
+
119
+ assert model_class.__name__ == "RandomForestClassifier"
120
+
121
+
122
+ def test_layer_mapping():
123
+
124
+ layer_map = layer_mapping(direction="torch_to_keras")
125
+ assert isinstance(layer_map, dict)
126
+
127
+ layer_map = layer_mapping(direction="keras_to_torch")
128
+ assert isinstance(layer_map, dict)
129
+
130
+ layer_map = layer_mapping(direction="torch_to_keras", activation=True)
131
+ assert isinstance(layer_map, dict)
132
+
133
+ layer_map = layer_mapping(direction="keras_to_torch", activation=True)
134
+ assert isinstance(layer_map, dict)
135
+