Complexity of David

Data Science, Machine Learning, Artificial Intelligence, Visualization, and Complex Systems.

Plotting More Than One Data Series in One-Liner

plot of mulitple data series in R

I already covered several ways to plot multiple data series in the same R plot, either using plot, points and lines or using ggplot and using facets. What I didn’t show was probably the easiest (and I mean easiest), way to plot all data series in one plot. Using matplot!

matplot is part of the graphics library and therefore is installed during your normal R installation. It does not need any further installation and you can use it with the usual plot parameters.

Assuming that you have a data frame df with N columns and M observations and that you want to plot all columns against the first column that will provide the x points.

matplot(df[,1], df[, 2:ncol(df)], pch=19)

The above command will plot multiple data series in R in the same plot without further problems and producing the above picture.

The only condition to plot data series with the above command is that the data frame needs to be wide format (and usually it is).

If your data is in the narrow format you need to pivot the data to wide layout before you can plot multiple data series. In R, the conversion between wide and narrow layouts of the data can be accomplished using the tidyr package.

Processing Community Day @Lisboa

Processing Community Day @ Lisboa 2019

Em janeiro de 2019 decorre mundialmente o PCD (https://day.processing.org). A fundação Processing agrega o maior número mundial de designers e artistas interessados em programação para a expressividade individual e é responsável pelo desenvolvimento open source das linguagens Processing (https://processing.org), P5*js (https://p5js.org), entre outras, para programação visual e artística.

O moto do processing community day é a celebração da arte, o design, da programação e da diversidade.

Este ano o PCD vai ter uma edição em Lisboa, na Biblioteca Municipal de Marvila.

No dia 18 de janeiro, pretende-se que este seja um ponto de encontro de designers, artistas e interessados, e uma exposição dos trabalhos desenvolvidos pelo os alunos da disciplina de Sistemas de Design Digital do 2º ano da Licenciatura em Design Gráfico da ESAD.CR e dos alunos de Laboratório de Projecto I do 3º ano da Licenciatura em Design Multimedia da ESAD.CR.

PROGRAMA

11:00 Sessão de abertura
11:15 Catarina Maçãs 
      (Lab. Design Computacional e Visualização (CISUC))
11:45 Tiago Martins 
      (Lab. Design Computacional e Visualização (CISUC))
12:15 Sessão de perguntas e respostas
13:00 Pausa para almoço
15:30 Inauguração da exposição
16:00 Catarina Sampaio 
      (Faculdade de Belas Artes da Universidade de Lisboa)
16:30 Marta Verde (Creative Coder (ES))
17:00 Sessão de perguntas e respostas
18:00 Encerramento

O evento conta com o design gráfico dos meus alunos:

Estão todos convidados a aparecer no dia 18 de Janeiro na Biblioteca Municipal de Marvila em Lisboa.

From Bézier 2 Turtle Graphics, All Is Smooth

— When everyone thinks Severless computing, someone is thinks about the pitfalls of it. Serverless Computing: One Step Forward, Two Steps Back

— One of the topics I teach to my Design students is turtle graphics. They find it intuitive and is a great approach for a starter programming course. You can find different implementations of Turtle graphics online (including my Utils for P5js), but Turtetoy aggregates creations on a portfolio like environment.

— Another online portfolio website for art generated by code is ShaderGif. The structure is slightly different from Turtletoy, but … horses for courses.

— Bézier curves are mind bending curves, until you dig in and understand their inner works. Secrets of smooth Bézier curves takes the plunge.

— And if you need pageviews, this Minimal Google Analytics Snippet might be enough and short.

When Is Art Not Art in the Science Zoo?

Sails Art Harmonograph

Take 1 - A Comparative Study of Computational Aesthetics — When is art not art? Or when can a machine make art?

A machine can classify, but always in reference to other things. Humans can classify, but they have been trained before on what makes something beautiful of not.

beautiful doesn’t mean meaningful, sometimes.

Take 2 - Why are tech companies making custom typefaces? — An interesting read, with an historical perspective (I love timelines :-) ).

Take 3 - Bio-inspired computing: Algorithms review, deep analysis, and the scope of applications — Genetic Bee Colony (GBC) Algorithm, Fish Swarm Algorithm (FSA), Cat Swarm Optimization (CSO), Whale Optimization Algorithm (WOA), Artificial Algae Algorithm (AAA), Elephant Search Algorithm (ESA), Chicken Swarm Optimization Algorithm (CSOA), Moth flame optimization (MFO), and Grey Wolf Optimization (GWO) algorithm? You have to love this science ZOO. And you MUST read it.

Working With Data and Python

Working with data, in any form, is the XXI century toolkit for any computation based job. And although I’m a fan of R for much of my data analysis work, python comes as a close second. And if you favor python then, there are a some aspects to consider:

  • Using pandasA Gentle Visual Intro to Data Analysis in Python Using Pandas
  • numpy — a workhorse of data manipulation. If you have data that needs linear algebra, you’ll use numpy—even if numpy is a dependency of other package (e.g. pandas uses numpy). Check the quick start of numpy if your starting out. Also, interacting with C,C++, or fortran routines is a must.
  • If you need to use Tensorflow, python has you covered.
  • Working with Jupyter Notebooks — Everybody seems to love them. I use them for EDA (exploratory data analysis) and prototyping small ideas, but not for long complicated sessions. The burden of knowing the state of computation makes it daunting for long sessions. This comes in part from the fact that you can re-run code cells in out of page flow order. This means that you have to consider if the output you are getting is affected by code ran in another cell. But if you can’t code in a code editor, then coding in a browser might work for you. The most interesting thing in Jupyter are the different kernels. They allow you to experiment with other languages in an unified interface.
  • Scikit way — Another ML library that runs on top of numpy. See a trend here?
  • All this data is nice and all that, but you need to visualize it or it won’t be of much help. For this Matplotlib is king. Almost every package will ask you to import matplotlib.pyplot as plt so you can plot your data with python. It has come a long way and is a mature plotting solution.

Markdown Is the De Facto Language for Writing in the XXI Century

I’ve talked before about how much I use Markdown for my day to day writing • Heck, markdown powered this blog for a long time, even while running on Wordpress • but now I decided to tell you how I use Markdown in different scenarios, and what the tools are

Taking notes in Markdown

nvalt • the clone and improved version of Notational Velocity • I use to write everything I need in Markdown • A cloud folder stores all my MD files and make them accessible everywhere • Even when I’m not on my computer and don’t have nvalt around, I still can edit the files • No more need for messing around with proprietary formats

Blogging in Markdown

My blog runs on Hexo, a Node.js static content blogging platform • I write all posts in markdown • When I’m blogging I use any Markdown app installed on my computer or any simple code editor • I’m not fussy about it • It depends on the project I’m working on and the editor is the one open at the time of the writing • Hexo also has a plugin for editing post called hexo-admin • Pretty basic, but if you wan’t to use something simple and dedicated to your blogging experience, it works

Fast Markdown documents

When I need to write an exam, a letter, or even a journal paper I gravitate towards using Typora • A Markdown editor with default styles so nice that I created a couple of my own based on the defaults offered • This allows me to write something “academic” fast enough without thinking about extra shenanigans • It replaced writing in LaTeX for most of my document needs

Markdown Presentation

For years I’ve been a fan of Keynote but I started using Markdown for most of my work • I mainly use two tools • Marp for quick presentations that don’t require much thought and reveal-md for presentations that need more interaction and that I can release as a mini-website for my students to experiment with

The main reason to abandon keynote has to do with code snippets and code highlight • In keynote you can’t do it • You have to prepare your code somewhere else and hope that when copy and pasting everything is style properly • That or making screenshots • With Markdown you write the code inside a code section and the renderer will highlight it for you • Both Marp and Reveal-md take care of it

The reason I like reveal-md these days is that it allows an extra layer of presentation: Interaction •I can mix Markdown with HTML and Javascript and create some interesting interactions for my users • I always found it somewhat problematic that the interactive presentations I gave to students were flattened out when producing slides to take home

With reveal-md I export my presentations to a static website and I can either give them the zip file or upload the contents online to my server • In any case the copy they get is not crippled by the lack of features of the format • Reveal-MD is an helper project to work with Markdown files in RevealJS • It is must-have because it makes it so much easier to be productive • If I had to write the entirety of a presentation in HTML I wouldn’t be using it • Markdown gives me the freedom to write content first and then add the interaction needed via JavaScript making slides unique

Markdown in Data Science Notebooks

Jupyter Notebooks support Markdown cells and this makes the code much nicer to read • Everything is formatted correctly and you don’t need to hurt your eyes in pages trying to resemble fixe-space typewriters from the pre-computer days

Markdown Logs

My backup system uses rsync and a handful of locations && hard drives • To keep everything working correctly I tend to log events like backup start, backup end, error copying, among others • And from time to time I like to manually read the log to see if everything is correct • Instead of having a TXT file, I log everything in MD format and to read I see a converted format in HTML • Much easier to spot problems

Conclusion

Markdown is not perfect and somethings from other environments might be missing, but it becomes handy as soon as you adopt the semantic conventions of the language • You end using them even if not intending to render them * The terseness of Markdown makes it one of the most useful languages/conventions to know and use in the XXI century

Aesthetics With Deep Learning

Pantograph Rose

Understanding Aesthetics with Deep Learning ♣ This is an oldie but a important topic. Aesthetics. Can “machines” create beautiful objects? Can machines even tell us what is beautiful and what is not? Other work on the same topic is taking a comercial approach to this problem. eg Deep Learning for Classifying Hotel Aesthetics Photos. What is the role of beautiful photos in online hotel room booking (tldr: is not the price alone that matters).

Another aspect of this is that not everyone sees beauty in the same way ♣ Personalized Aesthetics: Recording the Visual Mind using Machine Learning.

And in Design: is it important to re-think the tools of the trade in the age of ML? ♣ Rethinking Design Tools in the Age of Machine Learning

And one unrelated topic—as such thing exists ♣
Motif and Hypergraph Correlation Clustering