622,190 research outputs found
Pytrec_eval: An Extremely Fast Python Interface to trec_eval
We introduce pytrec_eval, a Python interface to the tree_eval information
retrieval evaluation toolkit. pytrec_eval exposes the reference implementations
of trec_eval within Python as a native extension. We show that pytrec_eval is
around one order of magnitude faster than invoking trec_eval as a sub process
from within Python. Compared to a native Python implementation of NDCG,
pytrec_eval is twice as fast for practically-sized rankings. Finally, we
demonstrate its effectiveness in an application where pytrec_eval is combined
with Pyndri and the OpenAI Gym where query expansion is learned using
Q-learning.Comment: SIGIR '18. The 41st International ACM SIGIR Conference on Research &
Development in Information Retrieva
Python for education: permutations
Python implementation of permutations is presented. Three classes are
introduced: Perm for permutations, Group for permutation groups, and PermError
to report any errors for both classes. The class Perm is based on Python
dictionaries and utilize cycle notation. The methods of calculation for the
perm order, parity, ranking and unranking are given. A random permutation
generation is also shown. The class Group is very simple and it is also based
on dictionaries. It is mainly the presentation of the permutation groups
interface with methods for the group order, subgroups (normalizer, centralizer,
center, stabilizer), orbits, and several tests. The corresponding Python code
is contained in the modules perms and groups.Comment: 26 pages, 1 figure, 2 table
Simplifying Parallelization of Scientific Codes by a Function-Centric Approach in Python
The purpose of this paper is to show how existing scientific software can be
parallelized using a separate thin layer of Python code where all parallel
communication is implemented. We provide specific examples on such layers of
code, and these examples may act as templates for parallelizing a wide set of
serial scientific codes. The use of Python for parallelization is motivated by
the fact that the language is well suited for reusing existing serial codes
programmed in other languages. The extreme flexibility of Python with regard to
handling functions makes it very easy to wrap up decomposed computational tasks
of a serial scientific application as Python functions. Many
parallelization-specific components can be implemented as generic Python
functions, which may take as input those functions that perform concrete
computational tasks. The overall programming effort needed by this
parallelization approach is rather limited, and the resulting parallel Python
scripts have a compact and clean structure. The usefulness of the
parallelization approach is exemplified by three different classes of
applications in natural and social sciences.Comment: 29 pages, submitted to Computational Science and Discover
Python bindings for the open source electromagnetic simulator Meep
Meep is a broadly used open source package for finite-difference time-domain electromagnetic simulations. Python bindings for Meep make it easier to use for researchers and open promising opportunities for integration with other packages in the Python ecosystem. As this project shows, implementing Python-Meep offers benefits for specific disciplines and for the wider research community
Modernizing PHCpack through phcpy
PHCpack is a large software package for solving systems of polynomial
equations. The executable phc is menu driven and file oriented. This paper
describes the development of phcpy, a Python interface to PHCpack. Instead of
navigating through menus, users of phcpy solve systems in the Python shell or
via scripts. Persistent objects replace intermediate files.Comment: Part of the Proceedings of the 6th European Conference on Python in
Science (EuroSciPy 2013), Pierre de Buyl and Nelle Varoquaux editors, (2014
NL4Py: Agent-Based Modeling in Python with Parallelizable NetLogo Workspaces
NL4Py is a NetLogo controller software for Python, for the rapid, parallel
execution of NetLogo models. NL4Py provides both headless (no graphical user
interface) and GUI NetLogo workspace control through Python. Spurred on by the
increasing availability of open-source computation and machine learning
libraries on the Python package index, there is an increasing demand for such
rapid, parallel execution of agent-based models through Python. NetLogo, being
the language of choice for a majority of agent-based modeling driven research
projects, requires an integration to Python for researchers looking to perform
statistical analyses of agent-based model output using these libraries.
Unfortunately, until the recent introduction of PyNetLogo, and now NL4Py, such
a controller was unavailable.
This article provides a detailed introduction into the usage of NL4Py and
explains its client-server software architecture, highlighting architectural
differences to PyNetLogo. A step-by-step demonstration of global sensitivity
analysis and parameter calibration of the Wolf Sheep Predation model is then
performed through NL4Py. Finally, NL4Py's performance is benchmarked against
PyNetLogo and its combination with IPyParallel, and shown to provide
significant savings in execution time over both configurations
- …
