log in

Advanced search

Message boards : Science : why python

Author Message
[SG-FC] oki
Send message
Joined: 5 Jan 13
Posts: 2
Credit: 2,188,531
RAC: 16
Message 2719 - Posted: 12 Dec 2013, 23:18:44 UTC


why are you using python for number-crunching?

Python is known to be 10 (to 100) times slower that other languages.

Wouldn't it be a good idea, to translate code into CCL or OCaml?
One time of translation vs. several 1000 times of execution.

Please excuse, if this question is already answered somewhere else...

Best regards

Send message
Joined: 31 Mar 13
Posts: 1
Credit: 23,532
RAC: 0
Message 2723 - Posted: 15 Dec 2013, 8:38:12 UTC - in response to Message 2719.

Great question, I would love to see an answer from the project team.

Here my take on it (as a python programmer, not affiliated with mindmodeling at all).

Python is a high level language which is:
1) Easy to learn
2) Easy to use and write code quickly (prototype)
3) Easy to read and modify later (develop)
Part of this is a language feature and part is in the available libraries.

Although translating the code to other languages can give orders of magnitude lower runtime (in some cases), the manpower to do so is not necessarily available. And the effort involved in doing so can in some cases be tremendous, especially if external libraries are utilized. When using 3-party libraries, you must either translate the library or find something similar in the new language (a drop in replacement is rare), this must then be extensively tested and optimized, something which is very difficult when you don't necessarily know how the code works.

Note that 3 party libraries fall into two categories, the first being "tools" for say matrix inversion, which is usually available in other languages as drop in replacements, but which still might provide some weird an unexpected deviation from other implementations. The second being more specialized libraries, which is often not available or implemented with vastly different philosophy and features. It would be interesting to know how much of each this project uses?

Remember that the researchers themselves are seldom trained programmers, programming is a tool which they must pick up an learn for themselves (universities varies here, and some are starting to introduce programming at an early stage of the Bachelor degree for all natural sciences). So the ease of use, sometimes out weights the computation time needed.

Profile Tom
Send message
Joined: 23 Jun 08
Posts: 490
Credit: 238,767
RAC: 0
Message 2727 - Posted: 18 Dec 2013, 19:27:44 UTC - in response to Message 2723.
Last modified: 19 Dec 2013, 15:29:37 UTC

You nailed it, Tullus!

It's also important to note that running massively parallel simulations of cognitive models is a paradigm shift for the field, in part because large-scale resources were (and are) difficult to come by for most researchers. These models were not developed with performance and optimization in mind, but rather, as Tullus pointed out, to leverage pre-existing libraries and knowledge. Furthermore, some models depend on cognitive architectures (e.g., ACT-R) written in a specific language and developed over decades, and the cost of porting such an architecture from its native language to another far outweighs any potential benefits. Still, some do exists (see http://jactr.org/).

A lot of our models are written in Lisp (using ACT-R), a language which since it's inception has been closely linked to the artificial intelligence research community. In our case, the Lisp models are dependent on "specialized libraries" in ACT-R. But we also have a good dose of models that leverage tools provided by a specific language, such as the statistical libraries provided by Matlab and R. Recently, the modeling and simulation community, as well as the A.I. community, have moved towards Python as one of its primary languages (again, for the reasons Tullus outlined).

Our system also supports compiled C applications, Matlab (run on local licensed computers), R, and Java, but ultimately it depends on the modeler's background (e.g. academic affiliation, advisor, etc.) and their specific needs that determine which language they program in. Our goal from the start was to minimize the barrier to entry as much as possible with the goal of supporting as many cognitive researchers and communities as possible.

Profile MichaelDDorsey
Send message
Joined: 15 Jan 18
Posts: 5
Credit: 0
RAC: 0
Message 4107 - Posted: 15 Jan 2018, 16:12:28 UTC
Last modified: 15 Jan 2018, 16:12:28 UTC

So what advantajes has the python?

Message boards : Science : why python

Main page · Your account · Message boards

Copyright © 2021 MindModeling.org