Capítulo 7-1º | Chapter 7-1º
Una mirada al futuro: Gen | A look into the future: Gen
⇦ Ir al índice principal del libro | ⇦ Go to the main index of the book |
Contenidos
|
Contents
|
7.1.1.- Introducción |
7.1.1.- Introduction |
7.1.2.- Gen y Julia |
7.1.2.- Gen and Julia |
7.1.3.- Documentación disponible de Gen |
7.1.3.- Available Gen documentation |
7.1.4.- Available Julia documentation |
Autor / Author: Juan Antonio Lloret Egea |Miembro de la Alianza Europea para la IA / Member to the European AI Alliance |
https://orcid.org/0000-0002-6634-3351||© 2019. Licencia de uso y distribución / License for use and distribution: [ Los estados de la inteligencia artificial (IA) | The states of artificial intelligence (AI) ] creative commons CC BY-NC-ND |ISSN 2695-3803|| Escrito / Writed: 22/08/2019. Actualizado / Updated: 22/08/2019 |
7.1.1.- Introducción | Introduction
Vamos a permitirnos primero una corta reflexión sobre cuáles son los lenguajes de programación mejor posicionados (con referencia a las salidas laborales y salarios) en el año 2019. Obviamente es una opinión. Pero escuchando otras opiniones y comparándolas entre ellas, es indudable que posicionarse como Top 1 es una cuestión de pugna entre Python y Java. Aunque nuevos horizontes se abren camino de futuro...
[English]
We are going to allow ourselves first a short reflection on which are the best positioned programming languages (with reference to work outs and salaries) in the year 2019. Obviously it is an opinion. But listening to other opinions and comparing them to each other, it is clear that positioning yourself as Top 1 is a matter of conflict between Python and Java. Although new horizons make their way to the future...
Las lista que obtenemos es la siguiente | The list we get is as follows:
Fig. I A. C7.1.1-. Los 10 principales lenguajes de programación en 2019 / Top 10 Programming Languages In 2019. Crédito imag (edureka). URL: https://youtu.be/jAx3c3OMkmI
Pero siempre es aconsejable obtener un ranking desde otro punto de vista y más actualizado. Esa posibilidad la tenemos con IEEE Spectrum en su web de análisis: https://spectrum.ieee.org/static/interactive-the-top-programming-languages-2019
[English]
But it is always advisable to obtain a ranking from another point of view and more updated. We have this possibility with IEEE Spectrum in its analysis website: https://spectrum.ieee.org/static/interactive-the-top-programming-languages-2019
Fig. I A. C7.1.2. Language Ranking: IEEE Spectrum 06.09.2019. URL: https://spectrum.ieee.org/static/interactive-the-top-programming-languages-2019
7.1.2.- Gen y Julia | Gen and Julia
- Gen es un paquete para el lenguaje de programación Julia. GEN consta de múltiples lenguajes de modelado que se implementan como DSL en Julia y una biblioteca de Julia para la programación de inferencia. C7.1-1
Fig. I A. C7.1.3- Gen: un sistema de programación probabilística de uso general con inferencia programable / Gen: A General-Purpose Probabilistic Programming System with Programmable Inference. Crédito imag (ACM SIGPLAN). URL: https://youtu.be/Nm255oONOdw
Abstracto
Aunque la programación probabilística se usa ampliamente para algunas clases restringidas de modelos estadísticos, los sistemas existentes carecen de la flexibilidad y la eficiencia necesarias para el uso práctico con modelos más desafiantes que surgen en campos como la visión por computadora y la robótica. Este artículo presenta Gen, un sistema de programación probabilística de propósito general que logra flexibilidad de modelado y eficiencia de inferencia a través de varias construcciones de lenguaje novedosas: (i) la interfaz de función generativa para encapsular modelos probabilísticos; (ii) lenguajes de modelado interoperables que alcanzan diferentes compromisos de flexibilidad/eficiencia; (iii) combinadores que explotan patrones comunes de independencia condicional; y (iv) una biblioteca de inferencia que permite a los usuarios implementar algoritmos de inferencia eficientes en un alto nivel de abstracciónC7.1-2.
Demostramos que Gen supera a los sistemas de programación probabilística de vanguardia, a veces por múltiples órdenes de magnitud, en diversos problemas que incluyen el seguimiento de objetos, la estimación de la postura del cuerpo en 3D a partir de una imagen de profundidad e inferir la estructura de una serie de tiempoC7.1-2.
"Un equipo de investigadores del MIT está facilitando que los novatos se mojen los pies con inteligencia artificial, al tiempo que ayuda a los expertos a avanzar en el campo". Publicación efectuada por la oficina de prensa del MIT sobre Gen aquí.
[Primero, obtenga Julia (ver abajo)]. El paquete Gen se puede instalar con el administrador de paquetes Julia. Desde Julia REPL, escriba ]
para ingresar al modo REPL de paquete y luego ejecutar:
pkg> add https://github.com/probcomp/Gen
- "Gen is a package for the Julia programming language. GEN consists of multiple modeling languages that are implemented as DSL in Julia and a Julia library for inference programming". C7.1-1
Abstract
"Although probabilistic programming is widely used for some restricted classes of statistical models, existing systems lack the flexibility and efficiency needed for practical use with more challenging models arising in fields like computer vision and robotics. This paper introduces Gen, a general-purpose probabilistic programming system that achieves modeling flexibility and inference efficiency via several novel language constructs: (i) the generative function interface for encapsulating probabilistic models; (ii) interoperable modeling languages that strike different flexibility/efficiency trade-offs; (iii) combinators that exploit common patterns of conditional independence; and (iv) an inference library that empowers users to implement efficient inference algorithms at a high level of abstraction" C7.1-2.
"We show that Gen outperforms state-of-the-art probabilistic programming systems, sometimes by multiple orders of magnitude, on diverse problems including object tracking, estimating 3D body pose from a depth image, and inferring the structure of a time series". C7.1-2
"A team of MIT researchers is making it easier for novices to get their feet wet with artificial intelligence, while also helping experts advance the field". Publication made by the MIT press office on Gen here.
[First, obtain Julia (see below)]. The Gen package can be installed with the Julia package manager. From the Julia REPL, type ]
to enter the Pkg REPL mode and then run:
pkg> add https://github.com/probcomp/Gen
Fig. I A. C7.1.4- Aprenda Julia en un vídeo / Learn Julia in one video. Crédito imag (Derek Banas). URL: https://youtu.be/sE67bP2PnOo
- Julia es un lenguaje de programación muy atractivo para los científicos de datos, estadísticos y analistas financieros. Ofreciendo un lenguaje de programación fácil de aprender que ofrece un gran rendimiento. En su contra se encuentra su juventud, por lo que no se encuentran disponibles la cantidad de librerías que se puede encontrar actualmente en los lenguajes más populares como R, Python o Matlab". [...] A la vista de los resultados constrastados por gráfica se puede observar que Julia es uno de los lenguajes más rápidos, siendo incluso más rápido que C en ciertas situaciones. Este rendimiento no se puede conseguir con otros lenguajes de alto nivel como Matlab, Python o R. El rendimiento se consigue gracias a la utilización de un compilador JIT en lugar de un intérprete. Lo que significa que la primera ejecución del código es más lenta ya que el compilador ha de analizar y compilar el código. Pudiendo significar un desventaja en ciertas ocasiones respecto a otros lenguajes. Los usuarios de Julia indica que es tan fácil de usar como puede ser Python, R o Matlab. Estaban cansados de tener que cambiar entre Matlab, Lisp, Python, Ruby, Perl, Mathematica, R y C. Por lo que desean tener u único lenguaje de programación que fuese bueno para el cálculo científico, aprendizaje automático, minería de datos, álgebra lineal, computación paralela y computación distribuida. C7.1-3
La instalación de Julia es sencilla, ya sea utilizando binarios precompilados o compilando desde la fuente. Descargue e instale Julia siguiendo las instrucciones en https://julialang.org/downloads/ .
La forma más fácil de aprender y experimentar con Julia es iniciando una sesión interactiva (también conocida como bucle read-eval-print o "REPL") haciendo doble clic en el ejecutable de Julia o ejecutando julia
desde la línea de comandos:
$ julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.2.0 (2019-08-20) _/ |\__'_|_|_|\__'_| | |__/ | julia> 1 + 2 3 julia> ans 3
[English]
- Julia is a very attractive programming language for data scientists, statisticians and financial analysts. Offering an easy-to-learn programming language that offers great performance. Her youth is against her, so there is no available number of libraries that can be found currently in the most popular languages such as R, Python or Matlab [...] In view of the results contrasted by graph it can be seen that Julia is one of the fastest languages, being even faster than C in certain situations. This performance cannot be achieved with other high-level languages such as Matlab, Python or R. The performance is achieved thanks to the use of a JIT compiler instead of an interpreter. Which means that the first execution of the code is slower since the compiler has to analyze and compile the code. It can mean a disadvantage in certain occasions with respect to other languages. Julia users indicated that it is as easy to use as Python, R or Matlab. "They were tired of having to switch between Matlab, Lisp, Python, Ruby, Perl, Mathematica, R and C. So they want to have a only programming language that was good for scientific calculation, machine learning, data mining, linear algebra, parallel computing and distributed computing.C7.1-3
Julia's installation is simple, either using precompiled binaries or compiling from the source. Download and install Julia following the instructions at https://julialang.org/downloads/.
The easiest way to learn and experiment with Julia is to start an interactive session (also known as the read-eval-print or "REPL" loop) by double clicking on Julia's executable or running julia from the command line:
$ julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.2.0 (2019-08-20) _/ |\__'_|_|_|\__'_| | |__/ | julia> 1 + 2 3 julia> ans 3
Fig. I A. C7.1.5- Los datos de referencia mostrados se calcularon con Julia v1.0.0, SciLua v1.0.0-b12, Rust 1.27.0, Go 1.9, Java 1.8.0_17, Javascript V8 6.2.414.54, Matlab R2018a , Anaconda Python 3.6.3, R 3.5.0 y Octave 4.2.2. C y Fortran se compilan con gcc 7.3.1, tomando el mejor tiempo de todos los niveles de optimización (-O0 a -O3). C, Fortran, Go, Julia, Lua, Python y Octave usan OpenBLAS v0.2.20 para operaciones matriciales; Mathematica usa Intel (R) MKL. Las implementaciones de Python de matrix_statistics y matrix_multiply utilizan las funciones NumPy v1.14.0 y OpenBLAS v0.2.20; el resto son implementaciones puras de Python. / The benchmark data shown were computed with Julia v1.0.0, SciLua v1.0.0-b12, Rust 1.27.0, Go 1.9, Java 1.8.0_17, Javascript V8 6.2.414.54, Matlab R2018a, Anaconda Python 3.6.3, R 3.5.0, and Octave 4.2.2. C and Fortran are compiled with gcc 7.3.1, taking the best timing from all optimization levels (-O0 through -O3). C, Fortran, Go, Julia, Lua, Python, and Octave use OpenBLAS v0.2.20 for matrix operations; Mathematica uses Intel(R) MKL. The Python implementations of matrix_statistics and matrix_multiply use NumPy v1.14.0 and OpenBLAS v0.2.20 functions; the rest are pure Python implementations. Crédito imag (Julia Micro-Benchmarks). URL: https://julialang.org/benchmarks/
7.1.3.- Documentación disponible de Gen | Available Gen documentationC7.1-1
GenTF
(Plugin TensorFlow para el sistema de programación probabilística Gen / TensorFlow plugin for the Gen probabilistic programming system)
El paquete Julia GenTF permite que las funciones generativas Gen invoquen los cálculos de TensorFlow ejecutados en la GPU por el tiempo de ejecución de TensorFlow. Los usuarios construyen un cálculo de TensorFlow utilizando la API familiar de TensorFlow Python, y luego empaquetan el cálculo de TensorFlow en una función TFF, que es un tipo de función generativa proporcionada por GenTF. Las funciones generativas escritas en el lenguaje de modelado incorporado de Gen pueden llamar a la perfección las funciones TFF. GenTF integra la diferenciación automática de Gen con los gradientes de TensorFlow, lo que permite la diferenciación automática de los cálculos que combinan el código de Julia y TensorFlow.
[English]
The Julia package GenTF allows for Gen generative functions to invoke TensorFlow computations executed on the GPU by the TensorFlow runtime. Users construct a TensorFlow computation using the familiar TensorFlow Python API, and then package the TensorFlow computation in a TFFunction, which is a type of generative function provided by GenTF. Generative functions written in Gen's built-in modeling language can seamlessly call TFFunctions. GenTF integrates Gen's automatic differentiation with TensorFlow's gradients, allowing automatic differentiation of computations that combine Julia and TensorFlow code.
Tutoriales / Tutorials |
The tutorials below were generated from Jupyter notebooks, which are available as part of a Docker container, at Gen Quickstart. Some tutorials have not yet been rendered into HTML. https://github.com/probcomp/Gen Docker A docker image containing an installation of Gen, with tutorial Jupyter notebooks, is available here Introduction to Modeling in Gen This tutorial introduces the basics of modeling in Gen. It shows how to perform inference using generic inference algorithms. It does not explore custom inference programming. Scaling with Combinators and the Static Modeling Language This tutorial shows how generative function combinators and the static modeling language are used to achieve good asymptotic scaling time of inference algorithms. This tutorial shows how to implement a particle filter for tracking the location of an object from measurements of its relative bearing. A Bottom-up Introduction to Gen This tutorial describes the reasoning behind some of the basic concepts in Gen. This tutorial explains some of the mathematical details of MCMC in Gen. Docs Gen: A General-Purpose Probabilistic Programming System with Programmable Inference Reference |
Fig. I A. C7.1.6- Gen: un sistema de programación probabilistico de propósito general con inferencia programable / Gen: a General-Purpose Prob-abilistic Programming System with Programmable Inference
7.1.4.- Documentación disponible de Julia | Available Julia documentationC7-1-4
Tutoriales / Tutorials |
Get jupyter notebooks for the following youtube tutorials here or run them directly on JuliaBox. Video
Text
Fuents / Resources
Libros / Books
|
Fig. I A. C7.1.7- El lenguaje de Julia | The Julia Language
Bibliografía | Bibliography
[C7.1-1] GEN. [Recuperado (14/08/2019) de: https://probcomp.github.io/Gen/]
[C7.1-2] Marco F. Cusumano-Towner, Feras A. Saad, Alexander K. Lew,and Vikash K. Mansinghka. 2019. Gen: A General-Purpose Prob-abilistic Programming System with Programmable Inference. InProceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’19), June 22–26, 2019, Phoenix, AZ, USA.ACM, New York, NY, USA, 16 pages: [221-236]. [Recuperado (14/08/2019) de: https://doi.org/10.1145/3314221.3314642 ]
[C7.1-3] Rodríguez, D. (24/09/2018). ¿Conoces el lenguaje de programación Julia? Analytics Lane. [Recuperado (14/08/2019) de: https://www.analyticslane.com/2018/09/24/conoces-el-lenguaje-de-programacion-julia/ ]
[C7-1-4] Julia. [[Recuperado (14/08/2019) de: https://julialang.org/learning/]