probflow 2.4.0__tar.gz → 2.5.1__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.
Files changed (389) hide show
  1. probflow-2.5.1/.codecov.yml +7 -0
  2. probflow-2.5.1/.github/workflows/python-publish.yml +37 -0
  3. probflow-2.5.1/.github/workflows/tests.yml +71 -0
  4. probflow-2.5.1/.gitignore +109 -0
  5. probflow-2.5.1/.pre-commit-config.yaml +31 -0
  6. probflow-2.5.1/.readthedocs.yml +23 -0
  7. probflow-2.5.1/LICENSE +21 -0
  8. probflow-2.5.1/Makefile +46 -0
  9. probflow-2.5.1/PKG-INFO +203 -0
  10. probflow-2.5.1/README.md +172 -0
  11. probflow-2.5.1/docs/api/api.rst +80 -0
  12. probflow-2.5.1/docs/api/applications.rst +10 -0
  13. probflow-2.5.1/docs/api/callbacks.rst +10 -0
  14. probflow-2.5.1/docs/api/data.rst +10 -0
  15. probflow-2.5.1/docs/api/distributions.rst +10 -0
  16. probflow-2.5.1/docs/api/models.rst +10 -0
  17. probflow-2.5.1/docs/api/modules.rst +10 -0
  18. probflow-2.5.1/docs/api/parameters.rst +10 -0
  19. probflow-2.5.1/docs/api/utils.rst +127 -0
  20. probflow-2.5.1/docs/conf.py +208 -0
  21. probflow-2.5.1/docs/dev_guide/dev_guide.rst +111 -0
  22. probflow-2.5.1/docs/examples/ar.rst +97 -0
  23. probflow-2.5.1/docs/examples/batch_normalization.rst +64 -0
  24. probflow-2.5.1/docs/examples/correlation.rst +175 -0
  25. probflow-2.5.1/docs/examples/embedding.rst +50 -0
  26. probflow-2.5.1/docs/examples/examples.rst +32 -0
  27. probflow-2.5.1/docs/examples/fully_connected.rst +670 -0
  28. probflow-2.5.1/docs/examples/gan.rst +166 -0
  29. probflow-2.5.1/docs/examples/glm.rst +184 -0
  30. probflow-2.5.1/docs/examples/gmm.rst +149 -0
  31. probflow-2.5.1/docs/examples/img/correlation/correlation1.svg +1 -0
  32. probflow-2.5.1/docs/examples/img/correlation/correlation2.svg +1 -0
  33. probflow-2.5.1/docs/examples/img/correlation/correlation3.svg +1 -0
  34. probflow-2.5.1/docs/examples/img/correlation/correlation4.svg +1 -0
  35. probflow-2.5.1/docs/examples/img/correlation/correlation5.svg +1 -0
  36. probflow-2.5.1/docs/examples/img/correlation/correlation6.svg +1 -0
  37. probflow-2.5.1/docs/examples/img/correlation/covariance.svg +1 -0
  38. probflow-2.5.1/docs/examples/img/fully_connected/net_diagram.svg +1 -0
  39. probflow-2.5.1/docs/examples/img/fully_connected/output_17_0.svg +1 -0
  40. probflow-2.5.1/docs/examples/img/fully_connected/output_19_0.svg +1 -0
  41. probflow-2.5.1/docs/examples/img/fully_connected/output_31_0.svg +1 -0
  42. probflow-2.5.1/docs/examples/img/fully_connected/output_33_0.svg +1 -0
  43. probflow-2.5.1/docs/examples/img/fully_connected/output_35_0.svg +1 -0
  44. probflow-2.5.1/docs/examples/img/fully_connected/output_37_1.svg +1 -0
  45. probflow-2.5.1/docs/examples/img/fully_connected/output_5_0.svg +1 -0
  46. probflow-2.5.1/docs/examples/img/gmm/output_10_0.svg +1 -0
  47. probflow-2.5.1/docs/examples/img/gmm/output_12_0.svg +1 -0
  48. probflow-2.5.1/docs/examples/img/gmm/output_4_0.svg +1 -0
  49. probflow-2.5.1/docs/examples/img/heteroscedastic/output_10_0.svg +1 -0
  50. probflow-2.5.1/docs/examples/img/heteroscedastic/output_16_0.svg +1 -0
  51. probflow-2.5.1/docs/examples/img/heteroscedastic/output_18_0.svg +1 -0
  52. probflow-2.5.1/docs/examples/img/heteroscedastic/output_20_0.svg +1 -0
  53. probflow-2.5.1/docs/examples/img/heteroscedastic/output_4_0.svg +1 -0
  54. probflow-2.5.1/docs/examples/img/heteroscedastic/output_8_1.svg +1 -0
  55. probflow-2.5.1/docs/examples/img/linear_regression/output_10_0.svg +1 -0
  56. probflow-2.5.1/docs/examples/img/linear_regression/output_12_1.svg +1 -0
  57. probflow-2.5.1/docs/examples/img/linear_regression/output_14_0.svg +1 -0
  58. probflow-2.5.1/docs/examples/img/linear_regression/output_16_0.svg +1199 -0
  59. probflow-2.5.1/docs/examples/img/linear_regression/output_18_1.svg +1 -0
  60. probflow-2.5.1/docs/examples/img/linear_regression/output_20_0.svg +1 -0
  61. probflow-2.5.1/docs/examples/img/linear_regression/output_22_1.svg +1 -0
  62. probflow-2.5.1/docs/examples/img/linear_regression/output_24_0.svg +1 -0
  63. probflow-2.5.1/docs/examples/img/linear_regression/output_30_1.svg +1 -0
  64. probflow-2.5.1/docs/examples/img/linear_regression/output_38_1.svg +1 -0
  65. probflow-2.5.1/docs/examples/img/linear_regression/output_4_1.svg +1 -0
  66. probflow-2.5.1/docs/examples/img/logistic_regression/output_14_1.svg +4012 -0
  67. probflow-2.5.1/docs/examples/img/logistic_regression/output_18_0.svg +3422 -0
  68. probflow-2.5.1/docs/examples/img/logistic_regression/output_20_1.svg +7086 -0
  69. probflow-2.5.1/docs/examples/img/logistic_regression/output_24_2.svg +823 -0
  70. probflow-2.5.1/docs/examples/img/logistic_regression/output_4_0.svg +1919 -0
  71. probflow-2.5.1/docs/examples/img/multivariate_regression/predictive_0.svg +1014 -0
  72. probflow-2.5.1/docs/examples/img/multivariate_regression/predictive_1.svg +1041 -0
  73. probflow-2.5.1/docs/examples/img/multivariate_regression/predictive_2.svg +1012 -0
  74. probflow-2.5.1/docs/examples/img/multivariate_regression/predictive_3.svg +991 -0
  75. probflow-2.5.1/docs/examples/img/multivariate_regression/predictive_4.svg +1059 -0
  76. probflow-2.5.1/docs/examples/img/multivariate_regression/two_headed_net.svg +1 -0
  77. probflow-2.5.1/docs/examples/img/neural_linear/calibration.svg +1228 -0
  78. probflow-2.5.1/docs/examples/img/neural_linear/mae.svg +1123 -0
  79. probflow-2.5.1/docs/examples/img/normalizing_flows/output_2_0.svg +1 -0
  80. probflow-2.5.1/docs/examples/img/normalizing_flows/output_7_0.svg +1 -0
  81. probflow-2.5.1/docs/examples/img/normalizing_flows/output_8_1.svg +1 -0
  82. probflow-2.5.1/docs/examples/img/normalizing_flows/output_9_0.svg +1 -0
  83. probflow-2.5.1/docs/examples/img/poisson_regression/output_10_0.svg +1 -0
  84. probflow-2.5.1/docs/examples/img/poisson_regression/output_15_2.svg +1 -0
  85. probflow-2.5.1/docs/examples/img/poisson_regression/output_4_0.svg +1 -0
  86. probflow-2.5.1/docs/examples/img/stochastic_volatility/output_17_0.svg +1 -0
  87. probflow-2.5.1/docs/examples/img/stochastic_volatility/output_19_1.svg +1 -0
  88. probflow-2.5.1/docs/examples/img/stochastic_volatility/output_21_0.svg +1 -0
  89. probflow-2.5.1/docs/examples/img/stochastic_volatility/output_7_1.svg +1 -0
  90. probflow-2.5.1/docs/examples/img/stochastic_volatility/output_9_1.svg +1 -0
  91. probflow-2.5.1/docs/examples/img/time_to_event/model1.svg +1 -0
  92. probflow-2.5.1/docs/examples/img/time_to_event/model2.svg +1 -0
  93. probflow-2.5.1/docs/examples/img/time_to_event/model3.svg +1 -0
  94. probflow-2.5.1/docs/examples/img/time_to_event/output_19_2.svg +1 -0
  95. probflow-2.5.1/docs/examples/img/time_to_event/output_21_0.svg +1 -0
  96. probflow-2.5.1/docs/examples/img/time_to_event/output_23_2.svg +1 -0
  97. probflow-2.5.1/docs/examples/img/time_to_event/output_26_0.svg +1 -0
  98. probflow-2.5.1/docs/examples/img/time_to_event/output_34_2.svg +1 -0
  99. probflow-2.5.1/docs/examples/img/time_to_event/output_36_0.svg +1 -0
  100. probflow-2.5.1/docs/examples/img/time_to_event/output_41_0.svg +1 -0
  101. probflow-2.5.1/docs/examples/img/time_to_event/output_43_0.svg +1 -0
  102. probflow-2.5.1/docs/examples/img/time_to_event/output_4_0.svg +1 -0
  103. probflow-2.5.1/docs/examples/img/time_to_event/output_55_0.svg +1 -0
  104. probflow-2.5.1/docs/examples/img/time_to_event/output_57_0.svg +1 -0
  105. probflow-2.5.1/docs/examples/img/time_to_event/output_63_0.svg +1 -0
  106. probflow-2.5.1/docs/examples/img/time_to_event/output_6_0.svg +1 -0
  107. probflow-2.5.1/docs/examples/img/time_to_event/output_9_0.svg +1 -0
  108. probflow-2.5.1/docs/examples/lda.rst +126 -0
  109. probflow-2.5.1/docs/examples/linear_regression.rst +458 -0
  110. probflow-2.5.1/docs/examples/lme.rst +70 -0
  111. probflow-2.5.1/docs/examples/logistic_regression.rst +264 -0
  112. probflow-2.5.1/docs/examples/mixture_density.rst +49 -0
  113. probflow-2.5.1/docs/examples/multivariate_regression.rst +170 -0
  114. probflow-2.5.1/docs/examples/neural_linear.rst +362 -0
  115. probflow-2.5.1/docs/examples/nmf.rst +189 -0
  116. probflow-2.5.1/docs/examples/normalizing_flows.rst +181 -0
  117. probflow-2.5.1/docs/examples/ppca.rst +50 -0
  118. probflow-2.5.1/docs/examples/robust_heteroscedastic.rst +301 -0
  119. probflow-2.5.1/docs/examples/stochastic_volatility.rst +200 -0
  120. probflow-2.5.1/docs/examples/time_to_event.rst +543 -0
  121. probflow-2.5.1/docs/examples/variational_autoencoder.rst +65 -0
  122. probflow-2.5.1/docs/img/colab-badge.svg +1 -0
  123. probflow-2.5.1/docs/img/coverage.svg +1 -0
  124. probflow-2.5.1/docs/img/coverage_light.svg +1 -0
  125. probflow-2.5.1/docs/img/dual_headed_net.svg +1 -0
  126. probflow-2.5.1/docs/img/dual_headed_net_light.svg +1 -0
  127. probflow-2.5.1/docs/img/posteriors.svg +1 -0
  128. probflow-2.5.1/docs/img/posteriors_light.svg +1 -0
  129. probflow-2.5.1/docs/img/pred_dist.svg +1 -0
  130. probflow-2.5.1/docs/img/pred_dist_light.svg +1 -0
  131. probflow-2.5.1/docs/img/probflow_og_image.png +0 -0
  132. probflow-2.5.1/docs/img/regression_equation.svg +1 -0
  133. probflow-2.5.1/docs/index.rst +302 -0
  134. probflow-2.5.1/docs/macros.hrst +37 -0
  135. probflow-2.5.1/docs/todo.rst +28 -0
  136. probflow-2.5.1/docs/user_guide/applications.rst +6 -0
  137. probflow-2.5.1/docs/user_guide/backend.rst +62 -0
  138. probflow-2.5.1/docs/user_guide/callbacks.rst +469 -0
  139. probflow-2.5.1/docs/user_guide/datagenerators.rst +8 -0
  140. probflow-2.5.1/docs/user_guide/distributions.rst +195 -0
  141. probflow-2.5.1/docs/user_guide/evaluating.rst +35 -0
  142. probflow-2.5.1/docs/user_guide/fitting.rst +111 -0
  143. probflow-2.5.1/docs/user_guide/img/callbacks/elbo1.svg +884 -0
  144. probflow-2.5.1/docs/user_guide/img/callbacks/elbo2.svg +926 -0
  145. probflow-2.5.1/docs/user_guide/img/callbacks/kl1.svg +787 -0
  146. probflow-2.5.1/docs/user_guide/img/callbacks/kl2.svg +787 -0
  147. probflow-2.5.1/docs/user_guide/img/callbacks/lr1.svg +821 -0
  148. probflow-2.5.1/docs/user_guide/img/callbacks/lr2.svg +921 -0
  149. probflow-2.5.1/docs/user_guide/img/callbacks/mae1.svg +835 -0
  150. probflow-2.5.1/docs/user_guide/img/callbacks/mae2.svg +863 -0
  151. probflow-2.5.1/docs/user_guide/img/callbacks/param1.svg +942 -0
  152. probflow-2.5.1/docs/user_guide/img/callbacks/param2.svg +1077 -0
  153. probflow-2.5.1/docs/user_guide/img/distributions/normal_dist.svg +850 -0
  154. probflow-2.5.1/docs/user_guide/img/inference/line_fit.svg +1 -0
  155. probflow-2.5.1/docs/user_guide/img/inference/line_fit_params.svg +1 -0
  156. probflow-2.5.1/docs/user_guide/img/inference/prior_likelihood_posterior.svg +1 -0
  157. probflow-2.5.1/docs/user_guide/img/inference/regular_vs_probabilistic.svg +1 -0
  158. probflow-2.5.1/docs/user_guide/img/parameters/bayesian_update_1.svg +1023 -0
  159. probflow-2.5.1/docs/user_guide/img/parameters/bayesian_update_2.svg +1035 -0
  160. probflow-2.5.1/docs/user_guide/img/parameters/bayesian_update_3.svg +1115 -0
  161. probflow-2.5.1/docs/user_guide/img/parameters/bounded_1.svg +1 -0
  162. probflow-2.5.1/docs/user_guide/img/parameters/bounded_2.svg +1 -0
  163. probflow-2.5.1/docs/user_guide/img/parameters/mvn_1.svg +1 -0
  164. probflow-2.5.1/docs/user_guide/img/parameters/mvn_2.svg +1 -0
  165. probflow-2.5.1/docs/user_guide/img/parameters/positive.svg +1 -0
  166. probflow-2.5.1/docs/user_guide/img/parameters/posterior_plot_1.svg +1 -0
  167. probflow-2.5.1/docs/user_guide/img/parameters/posterior_plot_2.svg +1 -0
  168. probflow-2.5.1/docs/user_guide/img/parameters/posterior_plot_3.svg +1 -0
  169. probflow-2.5.1/docs/user_guide/img/parameters/posterior_plot_4.svg +1 -0
  170. probflow-2.5.1/docs/user_guide/img/parameters/prior_plot.svg +1 -0
  171. probflow-2.5.1/docs/user_guide/img/parameters/transform_1.svg +1 -0
  172. probflow-2.5.1/docs/user_guide/img/parameters/transform_2.svg +1 -0
  173. probflow-2.5.1/docs/user_guide/inference.rst +161 -0
  174. probflow-2.5.1/docs/user_guide/inspecting.rst +7 -0
  175. probflow-2.5.1/docs/user_guide/math.rst +119 -0
  176. probflow-2.5.1/docs/user_guide/models.rst +122 -0
  177. probflow-2.5.1/docs/user_guide/modules.rst +12 -0
  178. probflow-2.5.1/docs/user_guide/parameters.rst +778 -0
  179. probflow-2.5.1/docs/user_guide/predicting.rst +30 -0
  180. probflow-2.5.1/docs/user_guide/saving_and_loading.rst +73 -0
  181. probflow-2.5.1/docs/user_guide/user_guide.rst +42 -0
  182. probflow-2.5.1/pyproject.toml +87 -0
  183. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/__init__.py +8 -1
  184. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/applications/__init__.py +3 -4
  185. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/applications/dense_classifier.py +10 -5
  186. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/applications/dense_regression.py +8 -5
  187. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/applications/linear_regression.py +7 -2
  188. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/applications/logistic_regression.py +7 -2
  189. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/applications/poisson_regression.py +7 -2
  190. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/callbacks/__init__.py +0 -1
  191. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/callbacks/callback.py +11 -7
  192. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/callbacks/early_stopping.py +12 -5
  193. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/callbacks/kl_weight_scheduler.py +18 -15
  194. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/callbacks/learning_rate_scheduler.py +15 -12
  195. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/callbacks/monitor_elbo.py +22 -20
  196. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/callbacks/monitor_metric.py +31 -19
  197. probflow-2.5.1/src/probflow/callbacks/monitor_parameter.py +71 -0
  198. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/callbacks/time_out.py +16 -10
  199. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/data/__init__.py +1 -2
  200. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/data/array_data_generator.py +23 -19
  201. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/data/data_generator.py +20 -17
  202. probflow-2.5.1/src/probflow/data/make_generator.py +29 -0
  203. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/__init__.py +0 -1
  204. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/bernoulli.py +8 -3
  205. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/categorical.py +26 -11
  206. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/cauchy.py +7 -4
  207. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/deterministic.py +6 -3
  208. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/dirichlet.py +6 -3
  209. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/gamma.py +6 -3
  210. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/hidden_markov_model.py +13 -4
  211. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/inverse_gamma.py +6 -3
  212. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/mixture.py +19 -5
  213. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/multivariate_normal.py +6 -3
  214. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/normal.py +6 -3
  215. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/one_hot_categorical.py +8 -3
  216. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/poisson.py +6 -3
  217. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/distributions/student_t.py +12 -4
  218. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/models/__init__.py +2 -3
  219. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/models/categorical_model.py +14 -42
  220. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/models/continuous_model.py +169 -72
  221. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/models/discrete_model.py +34 -13
  222. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/models/model.py +204 -103
  223. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/modules/__init__.py +3 -4
  224. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/modules/batch_normalization.py +21 -13
  225. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/modules/dense.py +6 -5
  226. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/modules/dense_network.py +13 -7
  227. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/modules/embedding.py +10 -8
  228. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/modules/module.py +68 -56
  229. probflow-2.5.1/src/probflow/modules/sequential.py +33 -0
  230. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/parameters/__init__.py +19 -17
  231. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/parameters/bounded_parameter.py +20 -11
  232. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/parameters/categorical_parameter.py +14 -11
  233. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/parameters/centered_parameter.py +9 -10
  234. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/parameters/deterministic_parameter.py +13 -10
  235. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/parameters/dirichlet_parameter.py +14 -11
  236. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/parameters/multivariate_normal_parameter.py +6 -7
  237. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/parameters/parameter.py +102 -75
  238. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/parameters/positive_parameter.py +19 -10
  239. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/parameters/scale_parameter.py +19 -10
  240. probflow-2.5.1/src/probflow/utils/__init__.py +1 -0
  241. probflow-2.5.1/src/probflow/utils/base.py +338 -0
  242. probflow-2.5.1/src/probflow/utils/casting.py +100 -0
  243. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/utils/initializers.py +17 -11
  244. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/utils/io.py +13 -12
  245. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/utils/metrics.py +45 -51
  246. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/utils/ops.py +121 -86
  247. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/utils/plotting.py +82 -41
  248. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/utils/settings.py +91 -35
  249. probflow-2.5.1/src/probflow/utils/shape.py +31 -0
  250. {probflow-2.4.0 → probflow-2.5.1}/src/probflow/utils/torch_distributions.py +7 -7
  251. probflow-2.5.1/src/probflow/utils/typing.py +46 -0
  252. probflow-2.5.1/src/probflow/utils/validation.py +45 -0
  253. probflow-2.5.1/tests/conftest.py +38 -0
  254. probflow-2.5.1/tests/examples/test_example_correlation.py +63 -0
  255. probflow-2.5.1/tests/examples/test_example_fully_connected.py +122 -0
  256. probflow-2.5.1/tests/examples/test_example_gan.py +77 -0
  257. probflow-2.5.1/tests/examples/test_example_gmm.py +45 -0
  258. probflow-2.5.1/tests/examples/test_example_heteroscedastic.py +35 -0
  259. probflow-2.5.1/tests/examples/test_example_linear_regression.py +55 -0
  260. probflow-2.5.1/tests/examples/test_example_ppca.py +47 -0
  261. probflow-2.5.1/tests/performance/test_linear_regression.py +56 -0
  262. probflow-2.5.1/tests/stats/conftest.py +24 -0
  263. probflow-2.5.1/tests/stats/test_LinearRegression.py +44 -0
  264. probflow-2.5.1/tests/stats/test_LogisticRegression.py +47 -0
  265. probflow-2.5.1/tests/stats/test_distribution_fits.py +221 -0
  266. probflow-2.5.1/tests/unit/pytorch/applications/test_dense_classifier.py +75 -0
  267. probflow-2.5.1/tests/unit/pytorch/applications/test_dense_regression.py +164 -0
  268. probflow-2.5.1/tests/unit/pytorch/applications/test_linear_regression.py +164 -0
  269. probflow-2.5.1/tests/unit/pytorch/applications/test_logistic_regression.py +78 -0
  270. probflow-2.5.1/tests/unit/pytorch/applications/test_poisson_regression.py +57 -0
  271. probflow-2.5.1/tests/unit/pytorch/callbacks/get_model_and_data.py +29 -0
  272. probflow-2.5.1/tests/unit/pytorch/callbacks/test_callback.py +26 -0
  273. probflow-2.5.1/tests/unit/pytorch/callbacks/test_early_stopping.py +64 -0
  274. probflow-2.5.1/tests/unit/pytorch/callbacks/test_kl_weight_scheduler.py +33 -0
  275. probflow-2.5.1/tests/unit/pytorch/callbacks/test_learning_rate_scheduler.py +35 -0
  276. probflow-2.5.1/tests/unit/pytorch/callbacks/test_monitor_elbo.py +30 -0
  277. probflow-2.5.1/tests/unit/pytorch/callbacks/test_monitor_metric.py +51 -0
  278. probflow-2.5.1/tests/unit/pytorch/callbacks/test_monitor_parameter.py +23 -0
  279. probflow-2.5.1/tests/unit/pytorch/callbacks/test_time_out.py +17 -0
  280. probflow-2.5.1/tests/unit/pytorch/conftest.py +9 -0
  281. probflow-2.5.1/tests/unit/pytorch/distributions/test_bernoulli.py +54 -0
  282. probflow-2.5.1/tests/unit/pytorch/distributions/test_categorical.py +94 -0
  283. probflow-2.5.1/tests/unit/pytorch/distributions/test_cauchy.py +55 -0
  284. probflow-2.5.1/tests/unit/pytorch/distributions/test_deterministic.py +78 -0
  285. probflow-2.5.1/tests/unit/pytorch/distributions/test_dirichlet.py +86 -0
  286. probflow-2.5.1/tests/unit/pytorch/distributions/test_gamma.py +56 -0
  287. probflow-2.5.1/tests/unit/pytorch/distributions/test_inverse_gamma.py +59 -0
  288. probflow-2.5.1/tests/unit/pytorch/distributions/test_mixture.py +89 -0
  289. probflow-2.5.1/tests/unit/pytorch/distributions/test_multivariate_normal.py +52 -0
  290. probflow-2.5.1/tests/unit/pytorch/distributions/test_normal.py +59 -0
  291. probflow-2.5.1/tests/unit/pytorch/distributions/test_one_hot_categorical.py +96 -0
  292. probflow-2.5.1/tests/unit/pytorch/distributions/test_poisson.py +55 -0
  293. probflow-2.5.1/tests/unit/pytorch/distributions/test_student_t.py +59 -0
  294. probflow-2.5.1/tests/unit/pytorch/models/test_categorical_model.py +39 -0
  295. probflow-2.5.1/tests/unit/pytorch/models/test_continuous_model.py +330 -0
  296. probflow-2.5.1/tests/unit/pytorch/models/test_discrete_model.py +71 -0
  297. probflow-2.5.1/tests/unit/pytorch/models/test_model.py +1095 -0
  298. probflow-2.5.1/tests/unit/pytorch/modules/test_batch_normalization.py +85 -0
  299. probflow-2.5.1/tests/unit/pytorch/modules/test_dense_network.py +110 -0
  300. probflow-2.5.1/tests/unit/pytorch/parameters/test_bounded_parameter.py +37 -0
  301. probflow-2.5.1/tests/unit/pytorch/parameters/test_categorical_parameter.py +38 -0
  302. probflow-2.5.1/tests/unit/pytorch/parameters/test_centered_parameter.py +239 -0
  303. probflow-2.5.1/tests/unit/pytorch/parameters/test_deterministic_parameter.py +36 -0
  304. probflow-2.5.1/tests/unit/pytorch/parameters/test_dirichlet_parameter.py +41 -0
  305. probflow-2.5.1/tests/unit/pytorch/parameters/test_multivariate_normal_parameter.py +72 -0
  306. probflow-2.5.1/tests/unit/pytorch/parameters/test_parameter.py +385 -0
  307. probflow-2.5.1/tests/unit/pytorch/parameters/test_positive_parameter.py +31 -0
  308. probflow-2.5.1/tests/unit/pytorch/parameters/test_scale_parameter.py +29 -0
  309. probflow-2.5.1/tests/unit/pytorch/utils/test_initializers.py +73 -0
  310. probflow-2.5.1/tests/unit/pytorch/utils/test_io.py +76 -0
  311. probflow-2.5.1/tests/unit/pytorch/utils/test_ops.py +535 -0
  312. probflow-2.5.1/tests/unit/pytorch/utils/test_settings.py +20 -0
  313. probflow-2.5.1/tests/unit/tensorflow/applications/test_dense_classifier.py +75 -0
  314. probflow-2.5.1/tests/unit/tensorflow/applications/test_dense_regression.py +196 -0
  315. probflow-2.5.1/tests/unit/tensorflow/applications/test_linear_regression.py +164 -0
  316. probflow-2.5.1/tests/unit/tensorflow/applications/test_logistic_regression.py +78 -0
  317. probflow-2.5.1/tests/unit/tensorflow/applications/test_poisson_regression.py +57 -0
  318. probflow-2.5.1/tests/unit/tensorflow/callbacks/get_model_and_data.py +27 -0
  319. probflow-2.5.1/tests/unit/tensorflow/callbacks/test_callback.py +26 -0
  320. probflow-2.5.1/tests/unit/tensorflow/callbacks/test_early_stopping.py +64 -0
  321. probflow-2.5.1/tests/unit/tensorflow/callbacks/test_kl_weight_scheduler.py +33 -0
  322. probflow-2.5.1/tests/unit/tensorflow/callbacks/test_learning_rate_scheduler.py +33 -0
  323. probflow-2.5.1/tests/unit/tensorflow/callbacks/test_monitor_elbo.py +30 -0
  324. probflow-2.5.1/tests/unit/tensorflow/callbacks/test_monitor_metric.py +51 -0
  325. probflow-2.5.1/tests/unit/tensorflow/callbacks/test_monitor_parameter.py +41 -0
  326. probflow-2.5.1/tests/unit/tensorflow/callbacks/test_time_out.py +17 -0
  327. probflow-2.5.1/tests/unit/tensorflow/conftest.py +7 -0
  328. probflow-2.5.1/tests/unit/tensorflow/data/test_array_data_generator.py +137 -0
  329. probflow-2.5.1/tests/unit/tensorflow/data/test_data_generator.py +19 -0
  330. probflow-2.5.1/tests/unit/tensorflow/data/test_make_generator.py +21 -0
  331. probflow-2.5.1/tests/unit/tensorflow/distributions/test_bernoulli.py +55 -0
  332. probflow-2.5.1/tests/unit/tensorflow/distributions/test_categorical.py +95 -0
  333. probflow-2.5.1/tests/unit/tensorflow/distributions/test_cauchy.py +52 -0
  334. probflow-2.5.1/tests/unit/tensorflow/distributions/test_deterministic.py +62 -0
  335. probflow-2.5.1/tests/unit/tensorflow/distributions/test_dirichlet.py +80 -0
  336. probflow-2.5.1/tests/unit/tensorflow/distributions/test_gamma.py +51 -0
  337. probflow-2.5.1/tests/unit/tensorflow/distributions/test_hidden_markov_model.py +71 -0
  338. probflow-2.5.1/tests/unit/tensorflow/distributions/test_inverse_gamma.py +51 -0
  339. probflow-2.5.1/tests/unit/tensorflow/distributions/test_mixture.py +82 -0
  340. probflow-2.5.1/tests/unit/tensorflow/distributions/test_multivariate_normal.py +53 -0
  341. probflow-2.5.1/tests/unit/tensorflow/distributions/test_normal.py +56 -0
  342. probflow-2.5.1/tests/unit/tensorflow/distributions/test_one_hot_categorical.py +82 -0
  343. probflow-2.5.1/tests/unit/tensorflow/distributions/test_poisson.py +52 -0
  344. probflow-2.5.1/tests/unit/tensorflow/distributions/test_student_t.py +54 -0
  345. probflow-2.5.1/tests/unit/tensorflow/models/test_categorical_model.py +75 -0
  346. probflow-2.5.1/tests/unit/tensorflow/models/test_continuous_model.py +368 -0
  347. probflow-2.5.1/tests/unit/tensorflow/models/test_discrete_model.py +78 -0
  348. probflow-2.5.1/tests/unit/tensorflow/models/test_model.py +1081 -0
  349. probflow-2.5.1/tests/unit/tensorflow/modules/test_batch_normalization.py +88 -0
  350. probflow-2.5.1/tests/unit/tensorflow/modules/test_dense.py +94 -0
  351. probflow-2.5.1/tests/unit/tensorflow/modules/test_dense_network.py +113 -0
  352. probflow-2.5.1/tests/unit/tensorflow/modules/test_embedding.py +97 -0
  353. probflow-2.5.1/tests/unit/tensorflow/modules/test_module.py +324 -0
  354. probflow-2.5.1/tests/unit/tensorflow/modules/test_sequential.py +65 -0
  355. probflow-2.5.1/tests/unit/tensorflow/parameters/test_bounded_parameter.py +46 -0
  356. probflow-2.5.1/tests/unit/tensorflow/parameters/test_categorical_parameter.py +47 -0
  357. probflow-2.5.1/tests/unit/tensorflow/parameters/test_centered_parameter.py +237 -0
  358. probflow-2.5.1/tests/unit/tensorflow/parameters/test_deterministic_parameter.py +44 -0
  359. probflow-2.5.1/tests/unit/tensorflow/parameters/test_dirichlet_parameter.py +50 -0
  360. probflow-2.5.1/tests/unit/tensorflow/parameters/test_multivariate_normal_parameter.py +80 -0
  361. probflow-2.5.1/tests/unit/tensorflow/parameters/test_parameter.py +389 -0
  362. probflow-2.5.1/tests/unit/tensorflow/parameters/test_positive_parameter.py +41 -0
  363. probflow-2.5.1/tests/unit/tensorflow/parameters/test_scale_parameter.py +37 -0
  364. probflow-2.5.1/tests/unit/tensorflow/utils/test_casting.py +43 -0
  365. probflow-2.5.1/tests/unit/tensorflow/utils/test_initializers.py +66 -0
  366. probflow-2.5.1/tests/unit/tensorflow/utils/test_io.py +72 -0
  367. probflow-2.5.1/tests/unit/tensorflow/utils/test_metrics.py +207 -0
  368. probflow-2.5.1/tests/unit/tensorflow/utils/test_ops.py +484 -0
  369. probflow-2.5.1/tests/unit/tensorflow/utils/test_plotting.py +331 -0
  370. probflow-2.5.1/tests/unit/tensorflow/utils/test_settings.py +182 -0
  371. probflow-2.5.1/uv.lock +3303 -0
  372. probflow-2.4.0/PKG-INFO +0 -243
  373. probflow-2.4.0/README.rst +0 -223
  374. probflow-2.4.0/pyproject.toml +0 -8
  375. probflow-2.4.0/setup.cfg +0 -4
  376. probflow-2.4.0/setup.py +0 -64
  377. probflow-2.4.0/src/probflow/callbacks/monitor_parameter.py +0 -60
  378. probflow-2.4.0/src/probflow/data/make_generator.py +0 -25
  379. probflow-2.4.0/src/probflow/modules/sequential.py +0 -26
  380. probflow-2.4.0/src/probflow/utils/__init__.py +0 -0
  381. probflow-2.4.0/src/probflow/utils/base.py +0 -202
  382. probflow-2.4.0/src/probflow/utils/casting.py +0 -77
  383. probflow-2.4.0/src/probflow/utils/validation.py +0 -35
  384. probflow-2.4.0/src/probflow.egg-info/PKG-INFO +0 -243
  385. probflow-2.4.0/src/probflow.egg-info/SOURCES.txt +0 -77
  386. probflow-2.4.0/src/probflow.egg-info/dependency_links.txt +0 -1
  387. probflow-2.4.0/src/probflow.egg-info/not-zip-safe +0 -1
  388. probflow-2.4.0/src/probflow.egg-info/requires.txt +0 -35
  389. probflow-2.4.0/src/probflow.egg-info/top_level.txt +0 -1
@@ -0,0 +1,7 @@
1
+ comment: false
2
+ coverage:
3
+ range: "90...100"
4
+ status:
5
+ project:
6
+ default:
7
+ target: 99%
@@ -0,0 +1,37 @@
1
+ # This workflow will upload a Python Package using uv when a release is published
2
+ # For more information see: https://docs.astral.sh/uv/guides/publish/
3
+
4
+ name: Publish Python Package
5
+
6
+ on:
7
+ release:
8
+ types: [published]
9
+
10
+ jobs:
11
+ pypi-publish:
12
+
13
+ name: Upload release to PyPI
14
+ runs-on: ubuntu-latest
15
+
16
+ # Environment to restrict deployment permissions
17
+ environment:
18
+ name: pypi
19
+ url: https://pypi.org/p/probflow
20
+
21
+ # Permissions for Trusted Publishing (OIDC)
22
+ permissions:
23
+ id-token: write
24
+ contents: read
25
+
26
+ steps:
27
+ - name: Checkout repository
28
+ uses: actions/checkout@v4
29
+
30
+ - name: Set up uv
31
+ uses: astral-sh/setup-uv@v10.1.0
32
+
33
+ - name: Build distribution
34
+ run: uv build
35
+
36
+ - name: Publish package to PyPI
37
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,71 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
+
4
+ name: tests
5
+
6
+ on:
7
+ push:
8
+ branches: [ main ]
9
+ pull_request:
10
+ branches: [ main ]
11
+
12
+ permissions:
13
+ contents: read
14
+ code-quality: write
15
+
16
+ jobs:
17
+ # Lint code
18
+ lint:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - uses: actions/setup-python@v5
23
+ with:
24
+ python-version: '3.10'
25
+ - uses: pre-commit/action@v3.0.1
26
+
27
+ # Build docs
28
+ docs:
29
+ runs-on: ubuntu-latest
30
+ steps:
31
+ - name: Checkout repository
32
+ uses: actions/checkout@v4
33
+ - name: Set up uv
34
+ uses: astral-sh/setup-uv@v10.1.0
35
+ - name: Install dependencies
36
+ run: |
37
+ uv sync --extra docs
38
+ - name: Build docs
39
+ run: |
40
+ uv run sphinx-build -b html docs docs/_html
41
+
42
+ unit-test:
43
+
44
+ runs-on: ubuntu-latest
45
+ strategy:
46
+ matrix:
47
+ python-version: ['3.10', '3.11', '3.12', '3.13']
48
+ backend: [tensorflow, pytorch]
49
+ #os: [ubuntu-latest, macos-latest, windows-latest]
50
+
51
+ steps:
52
+ - name: Checkout repository
53
+ uses: actions/checkout@v4
54
+ - name: Set up uv
55
+ uses: astral-sh/setup-uv@v10.1.0
56
+ with:
57
+ python-version: ${{ matrix.python-version }}
58
+ - name: Install dependencies, ${{ matrix.backend }}, and probflow
59
+ run: |
60
+ uv sync --extra ${{ matrix.backend }}
61
+ - name: Run tests
62
+ run: |
63
+ uv run pytest tests/unit/${{ matrix.backend }} --cov=probflow --cov-report xml:coverage.xml
64
+ - name: Upload coverage report to CodeCov
65
+ uses: codecov/codecov-action@v5
66
+ with:
67
+ files: ./coverage.xml
68
+ token: ${{ secrets.CODECOV_TOKEN }}
69
+ - name: Ensure the package builds
70
+ run: |
71
+ uv build
@@ -0,0 +1,109 @@
1
+ # vim
2
+ *.swp
3
+ *.vim
4
+
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.py[cod]
8
+ *$py.class
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+ MANIFEST
31
+
32
+ # PyInstaller
33
+ # Usually these files are written by a python script from a template
34
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .coverage
46
+ .coverage.*
47
+ .cache
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+
63
+ # Flask stuff:
64
+ instance/
65
+ .webassets-cache
66
+
67
+ # Scrapy stuff:
68
+ .scrapy
69
+
70
+ # Sphinx documentation
71
+ docs/_build/
72
+
73
+ # PyBuilder
74
+ target/
75
+
76
+ # Jupyter Notebook
77
+ .ipynb_checkpoints
78
+
79
+ # pyenv
80
+ .python-version
81
+
82
+ # celery beat schedule file
83
+ celerybeat-schedule
84
+
85
+ # SageMath parsed files
86
+ *.sage.py
87
+
88
+ # Environments
89
+ .env
90
+ .venv
91
+ env/
92
+ venv/
93
+ ENV/
94
+ env.bak/
95
+ venv.bak/
96
+
97
+ # Spyder project settings
98
+ .spyderproject
99
+ .spyproject
100
+
101
+ # Rope project settings
102
+ .ropeproject
103
+
104
+ # mkdocs documentation
105
+ /site
106
+ docs/_html
107
+
108
+ # mypy
109
+ .mypy_cache/
@@ -0,0 +1,31 @@
1
+ default_language_version:
2
+ python: python3.12
3
+
4
+ repos:
5
+ - repo: https://github.com/astral-sh/ruff-pre-commit
6
+ rev: v0.16.5
7
+ hooks:
8
+ - id: ruff
9
+ args: [--fix]
10
+ - id: ruff-format
11
+
12
+ - repo: https://github.com/pre-commit/pre-commit-hooks
13
+ rev: v6.0.0
14
+ hooks:
15
+ - id: trailing-whitespace
16
+ exclude: ^docs/
17
+ - id: end-of-file-fixer
18
+ exclude: ^docs/
19
+ - id: check-yaml
20
+ - id: check-toml
21
+ - id: check-json
22
+ - id: check-merge-conflict
23
+ - id: check-added-large-files
24
+ args: [--maxkb=1000]
25
+
26
+ - repo: https://github.com/pre-commit/mirrors-mypy
27
+ rev: v2.3.1
28
+ hooks:
29
+ - id: mypy
30
+ args: [src/probflow]
31
+ pass_filenames: false
@@ -0,0 +1,23 @@
1
+ # .readthedocs.yml
2
+ # Read the Docs configuration file
3
+
4
+ # Required
5
+ version: 2
6
+
7
+ build:
8
+ os: ubuntu-22.04
9
+ tools:
10
+ python: "3.11"
11
+
12
+ # Build documentation in the docs/ directory with Sphinx
13
+ sphinx:
14
+ configuration: docs/conf.py
15
+ fail_on_warning: true
16
+
17
+ # Install the package (and its "docs" extra) from pyproject.toml
18
+ python:
19
+ install:
20
+ - method: pip
21
+ path: .
22
+ extra_requirements:
23
+ - docs
probflow-2.5.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Brendan Hasz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,46 @@
1
+
2
+ .PHONY: install test-unit test-stats test format docs bump-minor bump-patch package push-package clean
3
+
4
+ BACKEND ?= tensorflow
5
+ AVAILABLE_BACKENDS := tensorflow pytorch
6
+
7
+ # Install probflow package and requirements
8
+ install:
9
+ uv sync --extra $(BACKEND) --extra docs
10
+
11
+ # Run unit tests
12
+ test-unit: install
13
+ uv run pytest tests/unit/$(BACKEND)
14
+
15
+ # Run statistical checks
16
+ test-stats: install
17
+ uv run pytest tests/stats --backend=$(BACKEND)
18
+
19
+ # Run all tests, including statistical checks, for all backends
20
+ test:
21
+ @for backend in $(AVAILABLE_BACKENDS); do \
22
+ $(MAKE) test-unit BACKEND=$$backend; \
23
+ $(MAKE) test-stats BACKEND=$$backend; \
24
+ done
25
+
26
+ # Format, lint, and type check code
27
+ format:
28
+ uv run pre-commit run --all-files
29
+
30
+ # Build documentation
31
+ docs:
32
+ uv sync --extra docs
33
+ uv run sphinx-build -b html docs docs/_html
34
+
35
+ # Bump minor version number
36
+ bump-minor:
37
+ uv version --bump minor
38
+
39
+ # Bump patch version number
40
+ bump-patch:
41
+ uv version --bump patch
42
+
43
+ # Clean up build artifacts and caches
44
+ clean:
45
+ rm -rf .pytest_cache docs/_html build dist src/probflow.egg-info
46
+ find . -type d -name __pycache__ -exec rm -rf {} \+
@@ -0,0 +1,203 @@
1
+ Metadata-Version: 2.5
2
+ Name: probflow
3
+ Version: 2.5.1
4
+ Summary: A Python package for building Bayesian models with TensorFlow or PyTorch
5
+ Project-URL: Homepage, https://github.com/brendanhasz/probflow
6
+ Author-email: Brendan Hasz <winsto99@gmail.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.10
14
+ Requires-Dist: cloudpickle>=1.3
15
+ Requires-Dist: matplotlib>=3.1.0
16
+ Requires-Dist: numpy>=1.17.0
17
+ Requires-Dist: pandas>=0.25.0
18
+ Provides-Extra: docs
19
+ Requires-Dist: sphinx-rtd-theme>=0.5.0; extra == 'docs'
20
+ Requires-Dist: sphinx-tabs>=1.1.13; extra == 'docs'
21
+ Requires-Dist: sphinx>=3.1.2; extra == 'docs'
22
+ Requires-Dist: tensorflow-probability>=0.10.0; extra == 'docs'
23
+ Requires-Dist: tensorflow>=2.2.0; extra == 'docs'
24
+ Provides-Extra: pytorch
25
+ Requires-Dist: torch>=1.5.0; extra == 'pytorch'
26
+ Provides-Extra: tensorflow
27
+ Requires-Dist: tensorflow-probability>=0.10.0; extra == 'tensorflow'
28
+ Requires-Dist: tensorflow>=2.2.0; extra == 'tensorflow'
29
+ Requires-Dist: tf-keras; extra == 'tensorflow'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # ProbFlow
33
+
34
+ [![Version Badge](https://img.shields.io/pypi/v/probflow)](https://pypi.org/project/probflow/) [![Build Badge](https://github.com/brendanhasz/probflow/workflows/tests/badge.svg)](https://github.com/brendanhasz/probflow/actions?query=branch%3Amain) [![Docs Badge](https://readthedocs.org/projects/probflow/badge/)](http://probflow.readthedocs.io) [![Coverage Badge](https://codecov.io/gh/brendanhasz/probflow/branch/main/graph/badge.svg)](https://codecov.io/gh/brendanhasz/probflow)
35
+
36
+ ProbFlow is a Python package for building probabilistic Bayesian models with [TensorFlow 2.0](http://www.tensorflow.org/beta) or [PyTorch](http://pytorch.org), performing stochastic variational inference with those models, and evaluating the models' inferences. It provides both high-level modules for building Bayesian neural networks, as well as low-level parameters and distributions for constructing custom Bayesian models.
37
+
38
+ It's very much still a work in progress.
39
+
40
+ - **Git repository:** http://github.com/brendanhasz/probflow
41
+ - **Documentation:** http://probflow.readthedocs.io
42
+ - **Bug reports:** http://github.com/brendanhasz/probflow/issues
43
+
44
+
45
+ ## Getting Started
46
+
47
+ **ProbFlow** allows you to quickly and less painfully build, fit, and evaluate custom Bayesian models (or [ready-made](http://probflow.readthedocs.io/en/latest/api/applications.html) ones!) which run on top of either [TensorFlow 2.0](http://www.tensorflow.org/beta) and [TensorFlow Probability](http://www.tensorflow.org/probability) or [PyTorch](http://pytorch.org).
48
+
49
+ With ProbFlow, the core building blocks of a Bayesian model are parameters and probability distributions (and, of course, the input data). Parameters define how the independent variables (the features) predict the probability distribution of the dependent variables (the target).
50
+
51
+ For example, a simple Bayesian linear regression
52
+
53
+ $$y \sim \text{Normal}(wx + b, \sigma)$$
54
+
55
+ can be built by creating a ProbFlow Model. This is just a class which inherits `pf.Model` (or `pf.ContinuousModel` or `pf.CategoricalModel` depending on the target type). The `__init__` method sets up the parameters, and the `__call__` method performs a forward pass of the model, returning the predicted probability distribution of the target:
56
+
57
+ ```python
58
+ import probflow as pf
59
+ import tensorflow as tf
60
+
61
+
62
+ class LinearRegression(pf.ContinuousModel):
63
+ def __init__(self):
64
+ self.weight = pf.Parameter(name="weight")
65
+ self.bias = pf.Parameter(name="bias")
66
+ self.std = pf.ScaleParameter(name="sigma")
67
+
68
+ def __call__(self, x):
69
+ return pf.Normal(x * self.weight() + self.bias(), self.std())
70
+
71
+
72
+ model = LinearRegression()
73
+ ```
74
+
75
+ Then, the model can be fit using stochastic variational inference, in *one line*:
76
+
77
+ ```python
78
+ # x and y are Numpy arrays or pandas DataFrame/Series
79
+ model.fit(x, y)
80
+ ```
81
+
82
+ You can generate predictions for new data:
83
+
84
+ ```python
85
+ # x_test is a Numpy array or pandas DataFrame
86
+ >>> model.predict(x_test)
87
+ [0.983]
88
+ ```
89
+
90
+ Compute *probabilistic* predictions for new data, with 95% confidence intervals:
91
+
92
+ ```python
93
+ model.pred_dist_plot(x_test, ci=0.95)
94
+ ```
95
+
96
+ ![pred_dist_light](https://raw.githubusercontent.com/brendanhasz/probflow/main/docs/img/pred_dist_light.svg?sanitize=true)
97
+
98
+ Evaluate your model's performance using metrics:
99
+
100
+ ```python
101
+ >>> model.metric('mse', x_test, y_test)
102
+ 0.217
103
+ ```
104
+
105
+ Inspect the posterior distributions of your fit model's parameters, with 95% confidence intervals:
106
+
107
+ ```python
108
+ model.posterior_plot(ci=0.95)
109
+ ```
110
+
111
+ ![posteriors_light](https://raw.githubusercontent.com/brendanhasz/probflow/main/docs/img/posteriors_light.svg?sanitize=true)
112
+
113
+ Investigate how well your model is capturing uncertainty by examining how accurate its predictive intervals are:
114
+
115
+ ```python
116
+ >>> model.pred_dist_coverage(ci=0.95)
117
+ 0.903
118
+ ```
119
+
120
+ and diagnose *where* your model is having problems capturing uncertainty:
121
+
122
+ ```python
123
+ model.coverage_by(ci=0.95)
124
+ ```
125
+
126
+ ![coverage_light](https://raw.githubusercontent.com/brendanhasz/probflow/main/docs/img/coverage_light.svg?sanitize=true)
127
+
128
+ ProbFlow also provides more complex modules, such as those required for building Bayesian neural networks. Also, you can mix ProbFlow with TensorFlow (or PyTorch!) code. For example, even a somewhat complex multi-layer Bayesian neural network like this:
129
+
130
+ ![dual_headed_net_light](https://raw.githubusercontent.com/brendanhasz/probflow/main/docs/img/dual_headed_net_light.svg?sanitize=true)
131
+
132
+ Can be built and fit with ProbFlow in only a few lines:
133
+
134
+ ```python
135
+ class DensityNetwork(pf.ContinuousModel):
136
+ def __init__(self, units, head_units):
137
+ self.core = pf.DenseNetwork(units)
138
+ self.mean = pf.DenseNetwork(head_units)
139
+ self.std = pf.DenseNetwork(head_units)
140
+
141
+ def __call__(self, x):
142
+ z = tf.nn.relu(self.core(x))
143
+ return pf.Normal(self.mean(z), tf.exp(self.std(z)))
144
+
145
+
146
+ # Create the model
147
+ model = DensityNetwork([x.shape[1], 256, 128], [128, 64, 32, 1])
148
+
149
+ # Fit it!
150
+ model.fit(x, y)
151
+ ```
152
+
153
+ For convenience, ProbFlow also includes several [pre-built models](http://probflow.readthedocs.io/en/latest/api/applications.html) for standard tasks (such as linear regressions, logistic regressions, and multi-layer dense neural networks). For example, the above linear regression example could have been done with much less work by using ProbFlow's ready-made LinearRegression model:
154
+
155
+ ```python
156
+ model = pf.LinearRegression(x.shape[1])
157
+ model.fit(x, y)
158
+ ```
159
+
160
+ And a multi-layer Bayesian neural net can be made easily using ProbFlow's ready-made DenseRegression model:
161
+
162
+ ```python
163
+ model = pf.DenseRegression([x.shape[1], 128, 64, 1])
164
+ model.fit(x, y)
165
+ ```
166
+
167
+ Using parameters and distributions as simple building blocks, ProbFlow allows for the painless creation of more complicated Bayesian models like [generalized linear models](http://probflow.readthedocs.io/en/latest/examples/glm.html), [deep time-to-event models](http://probflow.readthedocs.io/en/latest/examples/time_to_event.html), [neural matrix factorization](http://probflow.readthedocs.io/en/latest/examples/nmf.html) models, and [Gaussian mixture models](http://probflow.readthedocs.io/en/latest/examples/gmm.html). You can even mix [probabilistic and non-probabilistic models](http://probflow.readthedocs.io/en/latest/examples/neural_linear.html)! Take a look at the [examples](http://probflow.readthedocs.io/en/latest/examples/examples.html) and the [user guide](http://probflow.readthedocs.io/en/latest/user_guide/user_guide.html) for more!
168
+
169
+
170
+ ## Installation
171
+
172
+ If you already have your desired backend installed (i.e. Tensorflow/TFP or PyTorch), then you can just do:
173
+
174
+ ```bash
175
+ pip install probflow
176
+ ```
177
+
178
+ Or, to install both ProbFlow and the CPU version of TensorFlow + TensorFlow Probability,
179
+
180
+ ```bash
181
+ pip install probflow[tensorflow]
182
+ ```
183
+
184
+ Or, to install ProbFlow and PyTorch,
185
+
186
+ ```bash
187
+ pip install probflow[pytorch]
188
+ ```
189
+
190
+
191
+ ## Support
192
+
193
+ Post bug reports, feature requests, and tutorial requests in [GitHub issues](http://github.com/brendanhasz/probflow/issues).
194
+
195
+
196
+ ## Contributing
197
+
198
+ [Pull requests](http://github.com/brendanhasz/probflow/pulls) are totally welcome! Any contribution would be appreciated, from things as minor as pointing out typos to things as major as writing new applications and distributions.
199
+
200
+
201
+ ## Why the name, ProbFlow?
202
+
203
+ Because it's a package for probabilistic modeling, and it was built on TensorFlow. ¯\\\_(ツ)_/¯