¡Nunca vuelvas a tener un Jupyter Notebook inmantenible!

Rate this content
Bookmark

La visualización de datos es una parte fundamental de la Ciencia de Datos. La charla comenzará con una demostración práctica (utilizando pandas, scikit-learn y matplotlib) de cómo confiar solo en estadísticas resumidas y predicciones puede dejarte ciego ante la verdadera naturaleza de tus conjuntos de datos. Haré hincapié en que las visualizaciones son cruciales en cada paso del proceso de Ciencia de Datos y, por lo tanto, los Jupyter Notebooks definitivamente pertenecen a la Ciencia de Datos. Luego veremos cómo la mantenibilidad es un desafío real para los Jupyter Notebooks, especialmente cuando se intenta mantenerlos bajo control de versiones con git. Aunque existen numerosas herramientas de calidad de código para scripts de Python (flake8, black, mypy, etc.), la mayoría de ellas no funcionan en Jupyter Notebooks. Con este fin, presentaré nbQA, que permite ejecutar cualquier herramienta estándar de calidad de código de Python en un Jupyter Notebook. Por último, demostraré cómo usarlo dentro de un flujo de trabajo que permite a los profesionales mantener la interactividad de sus Jupyter Notebooks sin tener que sacrificar su mantenibilidad.

This talk has been presented at ML conf EU 2020, check out the latest edition of this Tech Conference.

FAQ

Visualizar los datos es crucial porque permite una mejor comprensión y análisis de los mismos, algo que no se puede lograr simplemente mirando estadísticas resumidas. Los Jupyter Notebooks son una herramienta excelente para esta visualización, ayudando a identificar características y patrones que no son evidentes solo con números.

Los desafíos incluyen dificultades con el control de versiones, ya que los cambios en los cuadernos producen grandes diferencias de imagen en formatos como git diff, y la falta de herramientas de calidad de código para ejecutar directamente en los cuadernos.

nbdime es una herramienta especializada que permite visualizar diferencias entre versiones de cuadernos Jupyter de manera más clara y entendible, mostrando incluso pequeños cambios en el código y en la salida de manera amigable.

NBQA es una herramienta que permite ejecutar linters y formateadores de código en Jupyter Notebooks convirtiéndolos temporalmente en scripts de Python, permitiendo así mantener y mejorar la calidad del código de manera eficiente.

Precommit permite configurar y ejecutar automáticamente herramientas de calidad de código antes de cada commit, asegurando que todos los cambios cumplan con los estándares establecidos y evitando que se introduzcan errores o malas prácticas en el repositorio.

Los Jupyter Notebooks facilitan la integración de código, visualización y texto en un solo lugar, lo que los hace ideales para exploración de datos, prototipado rápido y presentación de análisis de manera interactiva y reproducible.

Marco Gorelli
Marco Gorelli
26 min
02 Jul, 2021

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Los Jupyter Notebooks son importantes para la ciencia de datos, pero mantenerlos puede ser un desafío. La visualización de conjuntos de datos y el uso de herramientas de calidad de código como NBQA pueden ayudar a abordar estos desafíos. Herramientas como nbdime y Precommit pueden ayudar con el control de versiones y la calidad del código futuro. La configuración de NBQA y otras herramientas de calidad de código se puede hacer en el archivo PyProject.toml. NBQA se ha integrado en los flujos de trabajo de integración continua de varios proyectos. Se debe considerar mover el código de los notebooks a paquetes de Python según la necesidad de reproducibilidad y soluciones autocontenidas.

1. Introducción a Jupyter Notebooks

Short description:

Discutiremos la importancia de Jupyter Notebooks y los desafíos de mantenerlos. Luego, demostraré un flujo de trabajo para mantener tus Jupyter Notebooks mantenibles.

Hola, amigos. Hoy estamos aquí para hablar sobre Jupyter Notebooks y cómo mantenerlos mantenibles. Comenzaremos con un ejemplo motivador, en el cual presentaré el caso de por qué podrías estar interesado en usar Jupyter Notebooks en primer lugar. Luego, abordaré un par de desafíos que las personas suelen mencionar al intentar mantener sus Jupyter Notebooks mantenibles.

El primero tiene que ver con el control de versiones, y cualquiera que haya intentado ver la diferencia entre dos notebooks usando git diff sabrá de qué estoy hablando. No es fácil. El segundo tiene que ver con la integración continua y, más específicamente, la falta de herramientas de calidad de código disponibles para ejecutar en Jupyter Notebooks.

Entonces, finalmente, demostraré un flujo de trabajo para mantener tus Jupyter Notebooks mantenibles. Vamos directo a nuestro ejemplo motivador. He preparado un flujo de trabajo de ciencia de datos bastante estándar aquí, absolutamente estándar. Lo recorreremos en un segundo. Ahora, podrías preguntarte por qué te estoy mostrando un flujo de trabajo de ciencia de datos absolutamente estándar, y ten paciencia, puede haber un giro al final, puede. Así que vamos a recorrerlo.

2. Analyzing Summary Statistics

Short description:

Comenzamos leyendo cuatro archivos CSV utilizando Pandas read CSV. Imprimimos estadísticas resumidas para los cuatro conjuntos de datos, que muestran que son bastante similares.

Comenzamos leyendo cuatro archivos CSV utilizando Pandas read CSV, bastante estándar. Cada uno de ellos tiene dos columnas, x e y, bastante estándar. Luego, imprimiremos algunas estadísticas resumidas, por lo que imprimiremos la media de x, la media de y, la desviación estándar de x, la desviación estándar de y y la correlación entre x e y. Haremos esto para los cuatro conjuntos de data, aún bastante estándar.

Y luego, utilizando Scikit-learn, para cada uno de estos conjuntos de data ajustaremos un modelo de regresión lineal, también bastante estándar, e imprimiremos el error cuadrado medio, también absolutamente estándar.

Entonces, ¿dónde está el giro? Bueno, veamos qué sucede si ejecutamos esto usando Python. Correcto, mira eso. Si observamos lo que se ha impreso en la consola, veremos que la media de x es la misma para los cuatro conjuntos de data, pero también lo es la media de y, la desviación estándar de x, la desviación estándar de y, la correlación entre x e y, y el error cuadrado medio al ajustar un modelo de regresión lineal también es casi idéntico. Entonces, si observamos esto, podemos decir que los cuatro conjuntos de data deben ser bastante similares. Eso es lo que estas estadísticas resumidas nos están diciendo.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

(Más fácil) Visualización interactiva de datos en React
React Advanced Conference 2021React Advanced Conference 2021
27 min
(Más fácil) Visualización interactiva de datos en React
Top Content
This Talk is about interactive data visualization in React using the Plot library. Plot is a high-level library that simplifies the process of visualizing data by providing key concepts and defaults for layout decisions. It can be integrated with React using hooks like useRef and useEffect. Plot allows for customization and supports features like sorting and adding additional marks. The Talk also discusses accessibility concerns, SSR support, and compares Plot to other libraries like D3 and Vega-Lite.
TensorFlow.js 101: Aprendizaje automático en el navegador y más allá
ML conf EU 2020ML conf EU 2020
41 min
TensorFlow.js 101: Aprendizaje automático en el navegador y más allá
TensorFlow.js enables machine learning in the browser and beyond, with features like face mesh, body segmentation, and pose estimation. It offers JavaScript prototyping and transfer learning capabilities, as well as the ability to recognize custom objects using the Image Project feature. TensorFlow.js can be used with Cloud AutoML for training custom vision models and provides performance benefits in both JavaScript and Python development. It offers interactivity, reach, scale, and performance, and encourages community engagement and collaboration between the JavaScript and machine learning communities.
Uso de MediaPipe para Crear Aplicaciones de Aprendizaje Automático Multiplataforma con React
React Advanced Conference 2021React Advanced Conference 2021
21 min
Uso de MediaPipe para Crear Aplicaciones de Aprendizaje Automático Multiplataforma con React
Top Content
MediaPipe is a cross-platform framework that helps build perception pipelines using machine learning models. It offers ready-to-use solutions for various applications, such as selfie segmentation, face mesh, object detection, hand tracking, and more. MediaPipe can be integrated with React using NPM modules provided by the MediaPipe team. The demonstration showcases the implementation of face mesh and selfie segmentation solutions. MediaPipe enables the creation of amazing applications without needing to understand the underlying computer vision or machine learning processes.
Charlie Gerard's Career Advice: Be intentional about how you spend your time and effort
0 min
Charlie Gerard's Career Advice: Be intentional about how you spend your time and effort
Article
Charlie Gerard
Jan Tomes
2 authors
When it comes to career, Charlie has one trick: to focus. But that doesn’t mean that you shouldn’t try different things — currently a senior front-end developer at Netlify, she is also a sought-after speaker, mentor, and a machine learning trailblazer of the JavaScript universe. "Experiment with things, but build expertise in a specific area," she advises.

What led you to software engineering?My background is in digital marketing, so I started my career as a project manager in advertising agencies. After a couple of years of doing that, I realized that I wasn't learning and growing as much as I wanted to. I was interested in learning more about building websites, so I quit my job and signed up for an intensive coding boot camp called General Assembly. I absolutely loved it and started my career in tech from there.
 What is the most impactful thing you ever did to boost your career?I think it might be public speaking. Going on stage to share knowledge about things I learned while building my side projects gave me the opportunity to meet a lot of people in the industry, learn a ton from watching other people's talks and, for lack of better words, build a personal brand.
 What would be your three tips for engineers to level up their career?Practice your communication skills. I can't stress enough how important it is to be able to explain things in a way anyone can understand, but also communicate in a way that's inclusive and creates an environment where team members feel safe and welcome to contribute ideas, ask questions, and give feedback. In addition, build some expertise in a specific area. I'm a huge fan of learning and experimenting with lots of technologies but as you grow in your career, there comes a time where you need to pick an area to focus on to build more profound knowledge. This could be in a specific language like JavaScript or Python or in a practice like accessibility or web performance. It doesn't mean you shouldn't keep in touch with anything else that's going on in the industry, but it means that you focus on an area you want to have more expertise in. If you could be the "go-to" person for something, what would you want it to be? 
 And lastly, be intentional about how you spend your time and effort. Saying yes to everything isn't always helpful if it doesn't serve your goals. No matter the job, there are always projects and tasks that will help you reach your goals and some that won't. If you can, try to focus on the tasks that will grow the skills you want to grow or help you get the next job you'd like to have.
 What are you working on right now?Recently I've taken a pretty big break from side projects, but the next one I'd like to work on is a prototype of a tool that would allow hands-free coding using gaze detection. 
 Do you have some rituals that keep you focused and goal-oriented?Usually, when I come up with a side project idea I'm really excited about, that excitement is enough to keep me motivated. That's why I tend to avoid spending time on things I'm not genuinely interested in. Otherwise, breaking down projects into smaller chunks allows me to fit them better in my schedule. I make sure to take enough breaks, so I maintain a certain level of energy and motivation to finish what I have in mind.
 You wrote a book called Practical Machine Learning in JavaScript. What got you so excited about the connection between JavaScript and ML?The release of TensorFlow.js opened up the world of ML to frontend devs, and this is what really got me excited. I had machine learning on my list of things I wanted to learn for a few years, but I didn't start looking into it before because I knew I'd have to learn another language as well, like Python, for example. As soon as I realized it was now available in JS, that removed a big barrier and made it a lot more approachable. Considering that you can use JavaScript to build lots of different applications, including augmented reality, virtual reality, and IoT, and combine them with machine learning as well as some fun web APIs felt super exciting to me.


Where do you see the fields going together in the future, near or far? I'd love to see more AI-powered web applications in the future, especially as machine learning models get smaller and more performant. However, it seems like the adoption of ML in JS is still rather low. Considering the amount of content we post online, there could be great opportunities to build tools that assist you in writing blog posts or that can automatically edit podcasts and videos. There are lots of tasks we do that feel cumbersome that could be made a bit easier with the help of machine learning.
 You are a frequent conference speaker. You have your own blog and even a newsletter. What made you start with content creation?I realized that I love learning new things because I love teaching. I think that if I kept what I know to myself, it would be pretty boring. If I'm excited about something, I want to share the knowledge I gained, and I'd like other people to feel the same excitement I feel. That's definitely what motivated me to start creating content.
 How has content affected your career?I don't track any metrics on my blog or likes and follows on Twitter, so I don't know what created different opportunities. Creating content to share something you built improves the chances of people stumbling upon it and learning more about you and what you like to do, but this is not something that's guaranteed. I think over time, I accumulated enough projects, blog posts, and conference talks that some conferences now invite me, so I don't always apply anymore. I sometimes get invited on podcasts and asked if I want to create video content and things like that. Having a backlog of content helps people better understand who you are and quickly decide if you're the right person for an opportunity.What pieces of your work are you most proud of?It is probably that I've managed to develop a mindset where I set myself hard challenges on my side project, and I'm not scared to fail and push the boundaries of what I think is possible. I don't prefer a particular project, it's more around the creative thinking I've developed over the years that I believe has become a big strength of mine.***Follow Charlie on Twitter
TensorFlow.js 101: Aprendizaje automático en el navegador y más allá
JSNation Live 2021JSNation Live 2021
39 min
TensorFlow.js 101: Aprendizaje automático en el navegador y más allá
JavaScript with TensorFlow.js allows for machine learning in various environments, enabling the creation of applications like augmented reality and sentiment analysis. TensorFlow.js offers pre-trained models for object detection, body segmentation, and face landmark detection. It also allows for 3D rendering and the combination of machine learning with WebGL. The integration of WebRTC and WebXR enables teleportation and enhanced communication. TensorFlow.js supports transfer learning through Teachable Machine and Cloud AutoML, and provides flexibility and performance benefits in the browser and Node.js environments.
Una introducción al aprendizaje por transferencia en NLP y HuggingFace
ML conf EU 2020ML conf EU 2020
32 min
Una introducción al aprendizaje por transferencia en NLP y HuggingFace
Transfer learning in NLP allows for better performance with minimal data. BERT is commonly used for sequential transfer learning. Models like BERT can be adapted for downstream tasks such as text classification. Handling different types of inputs in NLP involves concatenating or duplicating the model. Hugging Face aims to tackle challenges in NLP through knowledge sharing and open sourcing code and libraries.

Workshops on related topic

Aprovechando LLMs para Construir Experiencias de IA Intuitivas con JavaScript
JSNation 2024JSNation 2024
108 min
Aprovechando LLMs para Construir Experiencias de IA Intuitivas con JavaScript
Featured Workshop
Roy Derks
Shivay Lamba
2 authors
Hoy en día, todos los desarrolladores están utilizando LLMs en diferentes formas y variantes, desde ChatGPT hasta asistentes de código como GitHub CoPilot. Siguiendo esto, muchos productos han introducido capacidades de IA integradas, y en este masterclass haremos que los LLMs sean comprensibles para los desarrolladores web. Y nos adentraremos en la codificación de tu propia aplicación impulsada por IA. No se necesita experiencia previa en trabajar con LLMs o aprendizaje automático. En su lugar, utilizaremos tecnologías web como JavaScript, React que ya conoces y amas, al mismo tiempo que aprendemos sobre algunas nuevas bibliotecas como OpenAI, Transformers.js
Construye un potente DataGrid en pocas horas con Ag Grid
React Summit US 2023React Summit US 2023
96 min
Construye un potente DataGrid en pocas horas con Ag Grid
Top Content
WorkshopFree
Mike Ryan
Mike Ryan
¿Tu aplicación React necesita mostrar eficientemente muchos (y muchos) datos en una cuadrícula? ¿Tus usuarios quieren poder buscar, ordenar, filtrar y editar datos? AG Grid es la mejor cuadrícula de JavaScript en el mundo y está llena de características, es altamente eficiente y extensible. En esta masterclass, aprenderás cómo empezar con AG Grid, cómo podemos habilitar la ordenación y el filtrado de datos en la cuadrícula, la representación de celdas y más. Saldrás de esta masterclass gratuita de 3 horas equipado con el conocimiento para implementar AG Grid en tu aplicación React.
Todos sabemos que crear nuestra propia solución de cuadrícula no es fácil, y seamos honestos, no es algo en lo que deberíamos estar trabajando. Estamos enfocados en construir un producto e impulsar la innovación. En esta masterclass, verás lo fácil que es empezar con AG Grid.
Prerrequisitos: React y JavaScript básicos
Nivel de la masterclass: Principiante
Construye una Potente Rejilla de Datos con AG Grid
React Summit 2024React Summit 2024
168 min
Construye una Potente Rejilla de Datos con AG Grid
WorkshopFree
Brian Love
Brian Love
¿Tu aplicación React necesita mostrar eficientemente una gran cantidad de datos en una rejilla? ¿Tus usuarios quieren poder buscar, ordenar, filtrar y editar datos? AG Grid es la mejor rejilla JavaScript del mundo y está repleta de funciones, altamente eficiente y extensible. En este masterclass, aprenderás cómo empezar con AG Grid, cómo habilitar la ordenación y filtrado de datos en la rejilla, la personalización y renderización de celdas, y más. Saldrás de este masterclass gratuito de 3 horas equipado con los conocimientos para implementar AG Grid en tu aplicación React.
¿Pueden los LLM aprender? Personalicemos un LLM para chatear con tus propios datos
C3 Dev Festival 2024C3 Dev Festival 2024
48 min
¿Pueden los LLM aprender? Personalicemos un LLM para chatear con tus propios datos
WorkshopFree
Andreia Ocanoaia
Andreia Ocanoaia
Sientes las limitaciones de los LLMs? Pueden ser creativos, pero a veces carecen de precisión o se basan en información desactualizada. En esta masterclass, desglosaremos el proceso de construir y desplegar fácilmente un sistema de Generación con Recuperación Mejorada. Este enfoque te permite aprovechar el poder de los LLMs con el beneficio adicional de precisión factual e información actualizada.
Deja que la IA sea tu Documentación
JSNation 2024JSNation 2024
69 min
Deja que la IA sea tu Documentación
Workshop
Jesse Hall
Jesse Hall
Únete a nuestro masterclass dinámico para crear un portal de documentación impulsado por IA. Aprende a integrar ChatGPT de OpenAI con Next.js 14, Tailwind CSS y tecnología de vanguardia para ofrecer soluciones de código e resúmenes instantáneos. Esta sesión práctica te equipará con el conocimiento para revolucionar la forma en que los usuarios interactúan con la documentación, convirtiendo las búsquedas tediosas en descubrimientos eficientes e inteligentes.
Aspectos destacados:
- Experiencia práctica en la creación de un sitio de documentación impulsado por IA.- Comprensión de la integración de la IA en las experiencias de usuario.- Habilidades prácticas con las últimas tecnologías de desarrollo web.- Estrategias para implementar y mantener recursos de documentación inteligente.
Tabla de contenidos:- Introducción a la IA en la documentación- Configuración del entorno- Construcción de la estructura de documentación- Integración de ChatGPT para documentación interactiva
Visualización de datos para desarrolladores web
JSNation Live 2021JSNation Live 2021
139 min
Visualización de datos para desarrolladores web
WorkshopFree
Anjana Vakil
Anjana Vakil
En este masterclass, a través de proyectos prácticos, aprenderemos cómo utilizar Observable, una plataforma de codificación reactiva basada en el navegador, para construir rápidamente visualizaciones interactivas e informativas en JavaScript. Después de completar este masterclass, tendrás las herramientas y técnicas básicas que necesitas para comenzar a utilizar la visualización de datos para comprender mejor tu código, tus proyectos y tus usuarios, y tomar mejores decisiones basadas en datos como desarrollador.