stan-dev / pystan

PyStan, a Python interface to Stan, a platform for statistical modeling. Documentation: https://pystan.readthedocs.io
ISC License
342 stars 59 forks source link

docs: Avoid suggesting support for numpy types #325

Closed riddell-stan closed 3 years ago

riddell-stan commented 3 years ago

Remove the suggestion that the Data type accepts ndarrays. (These are still unofficially supported.)

This simplifies the type, making it easier to read. This may help users avoid assuming that arbitrary numpy types will be accepted as data.

PyStan barely depends on numpy. In the future, the dependency may be removed. (NumPy is a serious dependency, wheel is ~16MB.) In the meantime, users should be encouraged to interact with PyStan as if it the package did not know about the existence of numpy.

ahartikainen commented 3 years ago

Users should call .to_list for their data?

riddell-stan commented 3 years ago

I think that would be best. Stan is a C++ library, so it doesn't have any support for Python-specific types.

But they don't have to. No behavior is changed. .tolist still gets called on ndarrays.

I'm just trying to eliminate any mention of numpy from the Data type. My thinking is that people see "np.ndarray" and they think, "oh, I can use np.int64 instead of Python ints".

On Sat, 25 Sep 2021, at 09:04, Ari Hartikainen wrote:

Users should call .to_list for their data?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/stan-dev/pystan/pull/325#issuecomment-927118502, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJQUBVUSDTAOMTVKYNE4QU3UDXCGZANCNFSM5EXSF4RA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

riddell-stan commented 3 years ago

Even though #327 is merged, I still think this commit is worth merging as well. There are many ndarrays which are not going to work. An ndarray of strings, of float128s, of Python objects, etc. The new type leaves less room for misunderstanding.