On 24/02/2020 00:59, Brendan Barnwell wrote:
On 2020-02-23 16:32, Guido van Rossum wrote:
> Assuming that the reader is familiar with the example `Lottery ~
> Literacy + Wealth + Region` is *not* going to work. I have literally no
> idea from what field that is taken or what the purpose of the example
> is. Please don't expect that I can just Google it: I did, found
> https://www.statsmodels.org/stable/example_formulas.html, and I still
> have no idea what it's about.
Sorry, perhaps I should have given a bit more explanation. As I
said, "~" means "depends on". So in R, you do something like:
model = some_statistical_model_function(Lottery ~ Literacy + Wealth +
Region, some_data_table)
[snippety snip]
It's also worth noting that the tilde here isn't notation for any
of the work that the statistical model does. It's just a way of writing
a "formula" that relates the independent and dependent variables, but
you still have to pass that formula to some function that actually runs
the model.
All that said, given that we can already achieve the desired
precedence with parentheses, I'll reiterate that I don't think the tilde
is a real blocker to doing this kind of model specification with Python
expressions, so I don't think I'm in favor of this proposal as it is.
This seems a lot like trying to shoehorn something in so one can write
idiomatic R in Python. That on the whole sounds like a bad idea; a
friend of mine use to say he could write FORTRAN in any language but no
one else could read it. Wouldn't it be more pythonic (or more
accurately anything-other-than-R-ic) to use an interface that was more like
model = model_fn(prediction, seq_of_predictors, data_table)
--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/QJ4ITW6Y6UJWBB63SS2ENARGLRCBXVE5/
Code of Conduct: http://python.org/psf/codeofconduct/