<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pablo Casas on Medium]]></title>
        <description><![CDATA[Stories by Pablo Casas on Medium]]></description>
        <link>https://medium.com/@pcasas.biz?source=rss-e9ceb8bfaf6e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nwwXcmcXxE1KWvGHQB_ptA.jpeg</url>
            <title>Stories by Pablo Casas on Medium</title>
            <link>https://medium.com/@pcasas.biz?source=rss-e9ceb8bfaf6e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 15:30:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pcasas.biz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Entonces, ¿Cuál es la diferencia entre: Ciencia de Datos, Machine Learning, IA, Deep Learning y……]]></title>
            <link>https://medium.com/@pcasas.biz/entonces-cu%C3%A1l-es-la-diferencia-entre-ciencia-de-datos-machine-learning-ia-deep-learning-y-c74f43583006?source=rss-e9ceb8bfaf6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c74f43583006</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Pablo Casas]]></dc:creator>
            <pubDate>Thu, 09 Apr 2020 16:30:41 GMT</pubDate>
            <atom:updated>2020-04-09T16:30:41.015Z</atom:updated>
            <content:encoded><![CDATA[<h3><a href="https://escueladedatosvivos.ai/blog/204703/diferencia-ciencia-de-datos-machine-learning-ia-deep-learning-big-data">Entonces, ¿Cuál es la diferencia entre: Ciencia de Datos, Machine Learning, IA, Deep Learning y… Big Data? 🤯</a></h3><p>Por empezar, hará cuestión de 10 años, lo que hoy se conoce como Ciencia de Datos, se llamaba Data Mining.</p><p>Hoy día en las noticias, se suele utilizar el término IA para <strong>todo</strong>. Esta disciplina existe hace mucho pero no tomo tanto auge hasta que surgió <strong>Deep Learning</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*SjNkCCErCm30lwih.gif" /></figure><p>A mi me gusta hacer la distinción por el tipo de problema que resuelven, y las librerías que se usan. Algo muy concreto. Pero antes, una tabla de conversión rápida:</p><ul><li><strong>Data Science = Machine Learning.</strong></li><li><strong>IA = Deep Learning</strong></li></ul><p>Una distinción semántica es cuando uno dice: “Modelos de Machine Learning”, y no “Modelos de Ciencia de Datos”.</p><p>Veremos la clasificación de acuerdo a:</p><ul><li><strong>✅Los problemas que resuelven</strong></li><li><strong>✅Las librerías que se usan</strong></li><li><strong>✅Los nombres de los algoritmos</strong></li></ul><p>A modo de bonus track, mencionaremos <em>Big Data</em>.</p><p><em>Post publicado originalmente en: </em><a href="https://escueladedatosvivos.ai/blog/204703/diferencia-ciencia-de-datos-machine-learning-ia-deep-learning-big-data"><em>https://escueladedatosvivos.ai/blog</em></a></p><h3>Parte 1: Clasificación de acuerdo a los problemas que resuelven:</h3><p>Si hablamos de:</p><ul><li>Procesamiento de texto “avanzado” (NLP)</li><li>Análisis y creación de imágenes/video</li><li>Análisis de secuencias en general</li><li>Procesamiento de sonido</li></ul><p>Entonces esto se logra, en general, con técnicas provenientes de Deep Learning/IA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*bQiUUTevgxU_tKNN" /></figure><p>Últimamente cuando se quiere hacer referencia a los típicos proyectos de análisis predictivo, se habla de <strong>“Machine learning clásico”. Esta rama es válida para la mayoría de los problemas que podemos encontrar en el mundo laboral, </strong>si bien hay miles de ejemplos, citaré algunos:</p><ul><li>Retención y fuga de clientes (attrition y churn)</li><li>¿Quién tiene probabilidad de comprar un producto?</li><li>Predicción de cantidad de usuarios en un sitio web</li><li>Segmentación automática de clientes, o pacientes en el mundo médico.</li><li>Probabilidad de internación en un hospital</li></ul><p>¿Se les ocurre algún otro “clásico”? Déjenlo en los comentarios.</p><h3>Breve historia sobre Deep Learning 🤖</h3><p>Para dar más contexto, haremos esta introducción.</p><p>Como comente, la mayoría de los problemas que tenemos se resuelven con ML “clásico”, aunque la palabra IA sea tan popular, no fue hasta que vino el desarrollo de deep learning que la IA tomo un impulso grande.</p><p>Hasta hace unos años las redes neuronales (por ejemplo: perceptron), no daban mejores resultados que algoritmos como el random forest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Mjc9Ka1ZSrn7OQV2.gif" /></figure><p><em>Imagen: Google trends. Se puede ver como predomina IA sobre el resto. Además de la correlación entre los otros términos.</em></p><p>[Solo para nerds🤓]: A mi entender, <strong>deep learning</strong> como término masivo empezó surgir cuando un equipo de google renombro su <em>google brain</em> a <strong>tensorflow</strong> y lo hizo open-source. Pudiendo acceder a estructuras de datos que corrían directamente con la placa de video (la famosa GPU). Les recomiendo leer el paper: <a href="https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/45530.pdf">Deep Neural Networks for YouTube Recommendations</a>. Otro hito fue la solución ganadora en la competencia de ImageNet, la cual uso una red neuronal con muchas capas, es decir una red <strong>deep</strong>.</p><p>📨 Escuela de Datos Vivos en <a href="https://www.linkedin.com/company/escuela-de-datos-vivos/">Linkedin</a> y <a href="https://twitter.com/datos_vivos">Twitter</a>.</p><p>Parte 2: Clasificación de acuerdo a las librerías que se usan</p><p>Esto es muy concreto y sirve, por ejemplo para aquellos reclutadores que desean ajustar sus búsquedas rápidamente.</p><h3>Inteligencia Artificial / Deep Learning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HBjopXQGirIgqsQG.png" /></figure><p>Casi todos los proyectos usan Python, entre sus librerías/proyectos aparecen <a href="https://www.fast.ai/">fastai</a>, <a href="https://pytorch.org/">pytorch</a>, <a href="https://keras.io/">keras</a>, <a href="https://www.tensorflow.org/">tensorflow</a>, <a href="http://deeplearning.net/software/theano/index.html">theano</a>.</p><p><strong>R</strong> también tiene una participación ya que gracias a <strong>RStudio</strong>, se portaron desde python los desarrollos de <a href="https://keras.rstudio.com/">keras</a> y <a href="https://tensorflow.rstudio.com/">tensorflow</a>.</p><h3>Ciencia de Datos / Machine Learning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZSAH6OXPhfcUP0nd.png" /></figure><p>En Python:</p><p>Los conocidos <a href="https://numpy.org/">numpy</a> y <a href="https://pandas.pydata.org/">pandas</a>, (obviamente también se usan en IA/DL). Y el clásico <a href="https://scikit-learn.org/">sklearn</a>.</p><p>En R:<br><a href="http://caret.r-forge.r-project.org/">caret</a>, <a href="https://mlr.mlr-org.com/">mlr</a>, <a href="https://rviews.rstudio.com/2019/06/19/a-gentle-intro-to-tidymodels/">tidymodels</a>, <a href="https://www.tidyverse.org/">tidyverse</a>.</p><p>Hay muchas mas librerías, pero a diferencia de Python, no se encuentran encapsuladas en una sola (como es el caso de sklearn).</p><p>Menciono también a <a href="https://www.h2o.ai/">H20.ai</a> que también permite crear modelos en ambos lenguajes.</p><p><em>Siempre recuerdo esta imagen cuando menciono tecnologías:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0mAM2MQtUJmyZC3E.jpeg" /></figure><h3>Parte 3: Clasificación de acuerdo al tipo de modelo</h3><h3>Inteligencia Artificial / Deep Learning</h3><p>Evidentemente, en IA/DL se usan <strong>redes neuronales artificiales</strong>. Y de acuerdo a su arquitectura, podemos realizar distintos proyectos.<br>No entraremos en detalle por el momento.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/0*UWZ5YfyxyjR_mW0D.gif" /></figure><h3>Ciencia de Datos / Machine Learning</h3><p>Solo listaré los que considero mas populares, y los separo por lo que resuelven:</p><ul><li><strong>Modelos predictivos</strong>: regresión lineal/logística, random forest, xgboost, lightGBM, árboles de decisión, series de tiempo, support vector machine (SVM), <em>y otros</em>.</li><li>En <strong>clustering</strong>: k-means, clustering jerárquico, HDBSCAN.</li><li>En <strong>reducción de dimensionalidad</strong>: PCA, UMAP, t-SNE.</li></ul><p>Usar técnicas de Deep Learning para resolver problemas de Machine Learning (ó viceversa), puede ser un error.</p><h3>Bonus track: Big Data</h3><p>Suele estar relacionado a tecnologías que usan más los ingenieros de datos (Data Engineer), y es un mundo en si mismo.<br>Big data no es data science, y si hacemos hincapié en su diferencia, big data está más vinculado al manejo de grandes volúmenes de datos, pero no necesariamente para aplicarle modelos predictivos.</p><p>Por ejemplo, administrar bases de datos distribuidas con el paradigma map/reduce usando <a href="https://hadoop.apache.org/">hadoop</a>, <a href="https://www.mongodb.com/nosql-explained">nosql</a>, <a href="https://hive.apache.org/">hive</a>, <a href="https://aws.amazon.com/athena/">athena</a>, y otra vez… un <em>big</em> <em>etc</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DcLe-mzS90Owaona.png" /></figure><p>Vamos a mencionar <em>algunos pokemones mas</em>: En algunos -pocos- proyectos, puede necesitarse análisis y/o predicción en tiempo real o de grandes volúmenes. Una de las tecnologías que puede usarse es <a href="https://spark.apache.org/">spark</a>, que está escrito en <a href="https://www.scala-lang.org/">scala</a>, y además puede crear modelos predictivos nativos.</p><p><em>Gracias </em><a href="https://www.linkedin.com/in/lucas-crespo-85461356/"><em>Lucas Crespo</em></a><em> por esta big-lista!</em></p><p>De hecho, también se puede usar spark, escribiendo en python: <a href="https://databricks.com/glossary/pyspark">pyspark</a> o en R: <a href="https://spark.rstudio.com/">sparklyr</a>.</p><p>No, no me olvidé de SQL</p><p>SQL es, casi siempre, el primer paso para extraer los datos. Es un tipo de lenguaje que el <strong>data scientist</strong> no lo tendrá tan desarrollado como el <strong>data engineer</strong>, ya que solo lo usara para obtener los datos de entrada. Si los datos fuesen muchos, podría usarse spark.</p><h3>Resumen</h3><p>✅ IA = Deep Learning<br>✅ Data Science = Machine Learning<br>✅ Se diferencian por la tecnología y el tipo de problema que resuelven<br>✅ La tendencia es llamar a todo IA</p><p>Deje varias cosas afuera del post para simplificar, como la estadística , herramientas comerciales como SAS y SPSS. Me enfoque en hacer un mapa rápido. Hay zonas grises y las definiciones no son únicas.</p><p><em>¿Y qué acerca de los roles?</em> Data Scientist VS. ML Engineer VS. Data Analyst… bueno quizás sean temas de otro post 😁</p><p>Eso es todo por ahora!</p><p>Si tienen alguna consulta o quieren contribuir al post, pueden hacerlo en los comentarios 👩🏼‍💻</p><p>📬 <strong>Escuela de Datos Vivos</strong> en <a href="https://www.linkedin.com/company/escuela-de-datos-vivos/">Linkedin</a> y <a href="https://twitter.com/datos_vivos">Twitter</a>.</p><p>Curso <strong>gratuito</strong> <a href="https://escueladedatosvivos.ai/p/curso-desembarcando-en-r-2da-edicion-gratis">Desembarcando en R 2da Edición!</a> 💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c74f43583006" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lanzamiento! Libro Vivo de Ciencia de Datos  (open-source)]]></title>
            <link>https://medium.com/datos-y-ciencia/lanzamiento-libro-vivo-de-ciencia-de-datos-open-source-21ff7c849ca?source=rss-e9ceb8bfaf6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/21ff7c849ca</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[rstats]]></category>
            <category><![CDATA[r-programming]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Pablo Casas]]></dc:creator>
            <pubDate>Thu, 04 Apr 2019 17:03:11 GMT</pubDate>
            <atom:updated>2019-04-08T20:51:30.451Z</atom:updated>
            <content:encoded><![CDATA[<p>Finalmente disponible la versión en español del <em>Data Science Live Book</em>! El libro se abre sin barreras idiomáticas ante las personas de habla-hispana con ganas de aprender 👨‍🎓👩‍🎓.</p><p>Esta publicación es una edición revisada tanto en gramática como en aspectos técnicos de la versión en inglés. Pueden acceder a la versión on-line, completa en:</p><h3>👉 <a href="https://librovivodecienciadedatos.ai/">LibroVivoDeCienciaDeDatos.ai</a> 🚀</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/0*omqd2ksIyXzJEEJE.png" /></figure><p>El <em>Data Science Live Book</em>, junto con dos artículos de como auto-publicar un libro usando bookdown, fueron premiados por RStudio en el <a href="https://community.rstudio.com/t/announcing-winners-of-the-1st-bookdown-contest/16394">1st Bookdown Contest</a>.</p><h4>¿Por qué publicar en español si ya está en inglés?</h4><p>Recuerdo cuando comencé a estudiar Data Science, (o Data Mining, como se decía en aquel entonces), me costaba bastante más entender los conceptos técnicos al mismo tiempo que traducía, o bien buscaba las palabras en un diccionario.</p><p>Si bien para estar en este mundo de datos, hace falta leer en ingles, esta versión busca acercar la ciencia de datos a las personas que todavía no están cómodas leyendo en otro idioma.</p><p>Por suerte cada vez hay mas recursos en español para aprender. Espero que el libro motive a que se siga escribiendo en otros idiomas.</p><h4>Libro open-source</h4><p>La versión en español sigue siendo open-source, acá su repositorio en <a href="https://github.com/pablo14/libro-vivo-ciencia-datos">Github</a> por si quieren hacer sugerencias o detectan bugs que escribi silenciosamente.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*WNuyQIf6gYz6k1Kh.gif" /></figure><p><em>Licencia: Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)</em></p><h4>¿Va a salir una versión en papel impreso?</h4><p>Si, durante las próximas semanas, como la versión en inglés.</p><h4>¿Cómo descargo el libro?</h4><p>Si les gusta y quieren apoyar el proyecto (ademas de ayudar a cubrir algunos gastos de publicación), lo pueden descargar bajo la filosofía de <em>“name a fair price”</em> (escriba un precio justo), con un piso de US$ 5:</p><p>Página de <a href="https://librovivodecienciadedatos.ai/descargar-libro.html"><strong>descarga del libro</strong></a> 📥.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/0*s0kvv8njcEsjkbL2.gif" /></figure><p>Gracias por leer, y espero que el libro les sea útil! 🚀</p><p>Quedense en contacto en <a href="https://twitter.com/pabloc_ds">Twitter</a> y <a href="https://www.linkedin.com/in/pcasas/">Linkedin</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21ff7c849ca" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datos-y-ciencia/lanzamiento-libro-vivo-de-ciencia-de-datos-open-source-21ff7c849ca">Lanzamiento! Libro Vivo de Ciencia de Datos 📗 (open-source)</a> was originally published in <a href="https://medium.com/datos-y-ciencia">Ciencia y Datos</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Feature Selection using Genetic Algorithms in R]]></title>
            <link>https://medium.com/data-science/feature-selection-using-genetic-algorithms-in-r-3d9252f1aa66?source=rss-e9ceb8bfaf6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d9252f1aa66</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[genetic-algorithm]]></category>
            <category><![CDATA[r]]></category>
            <dc:creator><![CDATA[Pablo Casas]]></dc:creator>
            <pubDate>Mon, 21 Jan 2019 19:20:11 GMT</pubDate>
            <atom:updated>2019-04-08T13:09:49.253Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a post about feature selection using genetic algorithms in R, in which we will do a quick review about:</p><ul><li>What are genetic algorithms?</li><li>GA in ML?</li><li>What does a solution look like?</li><li>GA process and its operators</li><li>The fitness function</li><li>Genetics Algorithms in R!</li><li>Try it yourself</li><li>Relating concepts</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*V22K8UExlLuaegeevJRhdQ.gif" /><figcaption><em>Animation source: “Flexible Muscle-Based Locomotion for Bipedal Creatures” — Thomas Geijtenbeek</em></figcaption></figure><p>[Find me on <a href="https://twitter.com/pabloc_ds">Twitter</a> and <a href="https://www.linkedin.com/in/pcasas/">Linkedin]</a></p><h3>The intuition behind</h3><p>Imagine a black box which can help us to decide over an <strong>unlimited number of possibilities</strong>, with a criterion such that we can find an acceptable solution (both in time and quality) to a problem that we formulate.</p><h3>What are genetic algorithms?</h3><p>Genetic Algorithms (GA) are a mathematical model inspired by the famous Charles Darwin’s idea of <em>natural selection</em>.</p><p>The natural selection preserves only the fittest individuals, over the different generations.</p><p>Imagine a population of 100 rabbits in 1900, if we look the population today, we are going to others rabbits more fast and skillful to find food than their ancestors.</p><h3>GA in ML</h3><p>In <strong>machine learning</strong>, one of the uses of genetic algorithms is to pick up the right number of variables in order to create a predictive model.</p><p>To pick up the right subset of variables is a problem of <strong>combinatory and optimization</strong>.</p><p>The advantage of this technique over others is, it allows the best solution to emerge from the best of prior solutions. An evolutionary algorithm which improves the selection over time.</p><p>The idea of GA is to combine the different solutions <strong>generation after generation</strong> to extract the best <em>genes</em> (variables) from each one. That way it creates new and more fitted individuals.</p><p>We can find other uses of GA such as hyper-tunning parameter, find the maximum (or min) of a function or the search for a correct neural network arquitecture (Neuroevolution), or among others…</p><h3>GA in feature selection</h3><p>Every possible solution of the GA, which are the selected variables (a <em>single</em> 🐇), are <strong>considered as a whole</strong>, it will not rank variables individually against the target.</p><p>And this is important because we already know that <a href="https://livebook.datascienceheroes.com/selecting-best-variables.html#variables-work-in-groups">variables work in group</a>.</p><h3>What does a solution look like?</h3><p>Keeping it simple for the example, imagine we have a total of 6 variables,</p><p>One solution can be picking up 3 variables, let’s say: var2, var4 and var5.</p><p>Another solution can be: var1 and var5.</p><p>These solutions are the so-called <strong>individuals</strong> or <strong>chromosomes</strong> in a population. They are possible solutions to our problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/0*Tn1cW4ckKhj4E43X.png" /></figure><p><em>Credit image: Vijini Mallawaarachchi</em></p><p>From the image, the solution 3 can be expressed as a one-hot vector: c(1,0,1,0,1,1). Each 1 indicates the solution containg that variable. In this case: var1, var3, var5, var6.</p><p>While the solution 4 is: c(1,1,0,1,1,0).</p><p>Each position in the vector is a <strong>gene</strong>.</p><h3>GA process and its operators</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/0*EYS7myyA8SpfrPFn.png" /></figure><p>The underlying idea of a GA is to generate some random possible solutions (called population), which represent different variables, to then combine the best solutions in an iterative process.</p><p>This combination follows the basic GA operations, which are: selection, mutation and cross-over.</p><ul><li><strong>Selection</strong>: Pick up the most fitted individuals in a generation (i.e.: the solutions providing the highest ROC).</li><li><strong>Cross-over</strong>: Create 2 new individuals, based on the genes of two solutions. These children will appear to the next generation.</li><li><strong>Mutation</strong>: Change a gene randomly in the individual (i.e.: flip a 0 to 1)</li></ul><p>The idea is for each generation, we will find better individuals, like a fast rabbit.</p><p>I recommend the <a href="https://towardsdatascience.com/introduction-to-genetic-algorithms-including-example-code-e396e98d8bf3">post of Vijini Mallawaarachchi</a> about how a genetic algorithm works.</p><p>These basic operations allow the algorithm to change the possible solutions by combining them in a way that maximizes the objective.</p><h3>The fitness function</h3><p>This objective maximization is, for example, to keep with the solution that maximizes the area under the ROC curve. This is defined in the <em>fitness function</em>.</p><p>The fitness function takes a possible solution (or chromosome, if you want to sound more sophisticated), and <em>somehow</em> evaluates the effectiveness of the selection.</p><p>Normally, the fitness function takes the one-hot vector c(1,1,0,0,0,0), creates, for example, a random forest model with var1 and var2, and returns the fitness value (ROC).</p><p>The fitness value in this code calculates is: ROC value / number of variables. By doing this the algorithm penalizes the solutions with a large number of variables. Similar to the idea of <a href="https://en.wikipedia.org/wiki/Akaike_information_criterion">Akaike information criterion</a>, or AIC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/0*W96KMZxTLjrckdVN.png" /></figure><h3>Genetics Algorithms in R! 🐛</h3><p>My intention is to provide you with a clean code so you can understand what’s behind, while at the same time, try new approaches like modifying the fitness function. This is a crucial point.</p><p>To use on your own data set, make sure data_x (data frame) and data_y (factor) are compatible with the custom_fitness function.</p><p>The main library is GA, developed by Luca Scrucca. See <a href="https://cran.r-project.org/web/packages/GA/vignettes/GA.html">here</a> the vignette with examples.</p><p>📣 <strong>Important</strong>: The following code is incomplete. <a href="https://github.com/pablo14/genetic-algorithm-feature-selection"><strong>Clone the repository</strong></a> to run the example.</p><pre># data_x: input data frame<br># data_y: target variable (factor)</pre><pre># GA parameters<br>param_nBits=ncol(data_x)<br>col_names=colnames(data_x)</pre><pre># Executing the GA <br>ga_GA_1 = ga(fitness = function(vars) custom_fitness(vars = vars, <br>                                                     data_x =  data_x, <br>                                                     data_y = data_y, <br>                                                     p_sampling = 0.7), # custom fitness function<br>             type = &quot;binary&quot;, # optimization data type<br>             crossover=gabin_uCrossover,  # cross-over method<br>             elitism = 3, # best N indiv. to pass to next iteration<br>             pmutation = 0.03, # mutation rate prob<br>             popSize = 50, # the number of indivduals/solutions<br>             nBits = param_nBits, # total number of variables<br>             names=col_names, # variable name<br>             run=5, # max iter without improvement (stopping criteria)<br>             maxiter = 50, # total runs or generations<br>             monitor=plot, # plot the result at each iteration<br>             keepBest = TRUE, # keep the best solution at the end<br>             parallel = T, # allow parallel procesing<br>             seed=84211 # for reproducibility purposes<br>)</pre><pre># Checking the results<br>summary(ga_GA_1)</pre><pre>── Genetic Algorithm ─────────────────── </pre><pre>GA settings: <br>Type                  =  binary <br>Population size       =  50 <br>Number of generations =  50 <br>Elitism               =  3 <br>Crossover probability =  0.8 <br>Mutation probability  =  0.03 </pre><pre>GA results: <br>Iterations             = 17 <br>Fitness function value = 0.2477393 <br>Solution = <br>     radius_mean texture_mean perimeter_mean area_mean smoothness_mean compactness_mean<br>[1,]           0            1              0         0               0                1<br>     concavity_mean concave points_mean symmetry_mean fractal_dimension_mean  ... <br>[1,]              0                   0             0                      0      <br>     symmetry_worst fractal_dimension_worst<br>[1,]              0                       0</pre><pre># Following line will return the variable names of the final and best solution<br>best_vars_ga=col_names[ga_GA_1@solution[1,]==1]</pre><pre># Checking the variables of the best solution...<br>best_vars_ga</pre><pre>[1] &quot;texture_mean&quot;     &quot;compactness_mean&quot; &quot;area_worst&quot;       &quot;concavity_worst&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/0*YRr0G3YKreYNnxe_.gif" /></figure><ul><li>Blue dot: Population fitness average</li><li>Green dot: Best fitness value</li></ul><p>Note: Don’t expect the result that fast 😅</p><p>Now we calculate the accuracy based on the best selection!</p><pre>get_accuracy_metric(data_tr_sample = data_x, target = data_y, best_vars_ga)</pre><pre>[1] 0.9508279</pre><p>The accuracy is around 95,08%, while the ROC value is closed to 0,95 (ROC=fitness value * number of variables, check the fitness function).</p><h3>Analyzing the results</h3><p>I don’t like to analyze the accuracy without the cutpoint (<a href="https://livebook.datascienceheroes.com/model-performance.html#scoring_data">Scoring Data</a>), but it’s useful to compare with the results of this <a href="https://www.kaggle.com/kanncaa1/feature-selection-and-data-visualization">Kaggle post</a>.</p><p>He got a similar accuracy result using recursive feature elimination, or RFE, based on 5 variables, while our solution stays with 4.</p><h3>Try it yourself</h3><p>Try a new fitness function, some solutions still provide a large number of variables, you can try squaring the number of variables.</p><p>Another thing to try is the algorithm to get the ROC value, or even to change the metric.</p><p>Some configurations last a lot of time. Balance classes before modeling and play with the p_sampling parameter. Sampling techniques can have a big impact on models. Check the <a href="https://blog.datascienceheroes.com/sample-size-and-class-balance-on-model-performance/">Sample size and class balance on model performance</a> post for more info.</p><p>How about changing the rate of mutation or elitism? Or trying other cross-over methods?</p><p>Increase the popSize to test more possible solutions at the same time (at a time cost).</p><p>Feel free to share any insights or ideas to improve the selection.</p><p><a href="https://github.com/pablo14/genetic-algorithm-feature-selection"><strong>Clone the repository</strong></a> to run the example.</p><h3>Relating concepts</h3><p>There is a parallelism between GA and Deep Learning, the concept of iteration and improvement over time is similar.</p><p>I added the p_sampling parameter to speed up things. And it usually accomplishes its goal. Similar to the <em>batch</em> concept used in Deep Learning. Another parallel is between the GA parameter run and the <em>early stopping</em> criteria in the neural network training.</p><p>But the biggest similarity is both techniques come from <strong>observing the nature</strong>. In both cases, humans observed how neural networks and genetics work, and create a simplified mathematical model that imitate their behavior. Nature has millions of years of evolution, why not try to imitate it? 🌱</p><p>—</p><p>I tried to be brief about GA, but if you have any specific question on this vast topic, please leave it in the comments 🙋 🙋‍♂</p><p><em>And, if I didn’t motivate you the enough to study GA, check this project which is based on Neuroevolution:</em></p><p>—</p><p>Thanks for reading 🚀</p><p>Find me on <a href="https://twitter.com/pabloc_ds">Twitter</a> and <a href="https://www.linkedin.com/in/pcasas/">Linkedin</a>.<br> <a href="https://blog.datascienceheroes.com/">More blog posts</a>.</p><p>Want to learn more? 📗 <a href="http://livebook.datascienceheroes.com/">Data Science Live Book</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d9252f1aa66" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/feature-selection-using-genetic-algorithms-in-r-3d9252f1aa66">Feature Selection using Genetic Algorithms in R</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create a sequential model in Keras for R]]></title>
            <link>https://medium.com/data-science/how-to-create-a-sequential-model-in-keras-for-r-1437aaf778e2?source=rss-e9ceb8bfaf6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1437aaf778e2</guid>
            <category><![CDATA[rstats]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[keras]]></category>
            <dc:creator><![CDATA[Pablo Casas]]></dc:creator>
            <pubDate>Tue, 25 Sep 2018 18:48:17 GMT</pubDate>
            <atom:updated>2018-09-25T18:48:17.756Z</atom:updated>
            <content:encoded><![CDATA[<p>tl;dr: This tutorial will introduce the Deep Learning classification task with Keras. We will particularly focus on the shape of the arrays, which is one of the most common pitfalls.</p><p>The topics we’ll cover are:</p><ul><li>How to do one-hot encoding</li><li>Choosing the input and output shape/dimensions in the layers</li><li>How to train the model</li><li>How to evaluate the model (training vs. test)</li></ul><p>You can find the complete code of <a href="https://github.com/pablo14/Keras-R-tutorials/blob/master/keras_sequential_model.R">this tutorial on Github</a> 👇</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JND_ryB2DGSKhUTk.gif" /></figure><h3>Creating the data</h3><p>The input data will be 10000 rows and three columns coming from the uniform distribution.</p><h3>Creating the data</h3><p>The input data will be 10000 rows and three columns coming from the uniform distribution.</p><p>The model will recognize that the sum of the three numbers is above a threshold of 1.5, otherwise it will be 0.</p><pre># Input: 10000 rows and 3 columns of uniform distribution<br>x_data=matrix(data=runif(30000), nrow=10000, ncol=3)</pre><pre># Output<br>y_data=ifelse(rowSums(x_data) &gt; 1.5, 1, 0)</pre><pre>head(x_data)</pre><pre>##            [,1]      [,2]      [,3]<br>## [1,] 0.49224109 0.6096538 0.7855929<br>## [2,] 0.56710301 0.8707570 0.3428543<br>## [3,] 0.08246592 0.7504529 0.6979251<br>## [4,] 0.79197829 0.6330420 0.7307403<br>## [5,] 0.65170373 0.9052915 0.1395298<br>## [6,] 0.23479406 0.2611791 0.2780037</pre><pre>head(y_data)</pre><pre>## [1] 1 1 1 1 1 0</pre><h3>Installing / Loading Keras</h3><pre># install.packages(&quot;keras&quot;)<br>library(keras)<br>library(tidyverse)</pre><h3>One-hot encoding in Keras</h3><p>One of the key points in Deep Learning is to understand the dimensions of the vector, matrices and/or arrays that the model needs. I found that these are the types supported by Keras.</p><p>In Python’s words, it is the shape of the array.</p><p>To do a binary classification task, we are going to create a one-hot vector. It works the same way for more than 2 classes.</p><p>For instance:</p><ul><li>The value 1 will be the vector [0,1]</li><li>The value 0 will be the vector [1,0]</li></ul><p>Keras provides the to_categorical function to achieve this goal.</p><pre>y_data_oneh=to_categorical(y_data, num_classes = 2)</pre><pre>head(y_data_oneh)</pre><pre>##      [,1] [,2]<br>## [1,]    0    1<br>## [2,]    0    1<br>## [3,]    0    1<br>## [4,]    0    1<br>## [5,]    0    1<br>## [6,]    1    0</pre><p>It’s easy to get categorical variables like: “yes/no”, “CatA,CatB,CatC”, etc. But to_categorical doesn&#39;t accept non-numeric values as input. We need to convert them first.</p><p>num_classes is necessary to create a vector length.</p><p>Alternatives to to_categorical:</p><ul><li>Package CatEncoders, <a href="https://cran.r-project.org/web/packages/CatEncoders/CatEncoders.pdf">OneHotEncoder</a> (same as Python scikit-learn).</li><li>Package caret, function <a href="https://amunategui.github.io/dummyVar-Walkthrough/">dummyVars</a>.</li></ul><p>Note: We don’t need to convert the <strong>input variables</strong> since they are numerical.</p><h3>Creating a sequential model in Keras</h3><p>The simplest model in Keras is the <strong>sequential</strong>, which is built by stacking layers sequentially.</p><p>In the next example, we are stacking three dense layers, and keras builds an implicit input layer with your data, using the input_shape parameter. So in total we’ll have an input layer and the output layer.</p><pre>model = keras_model_sequential() %&gt;%   <br>  layer_dense(units = 64, activation = &quot;relu&quot;, input_shape = ncol(x_data)) %&gt;%<br>  layer_dense(units = 64, activation = &quot;relu&quot;) %&gt;%<br>  layer_dense(units = ncol(y_data_oneh), activation = &quot;softmax&quot;)</pre><p>The most important parameters by now are:</p><ul><li>In the first layer the input_shape represents a vector with the value 3 (ncol(x_data)) indicating the number of input variables. In deep learning almost everything is vectors (or tensors).</li><li>The second layer doesn’t have an input_shape since Keras infers it from the previous layer.</li><li>The third layer_dense, which represents the final output, has 2 (ncol(y_data_oneh)) units representing the two possible outcomes.</li></ul><p>You can check the model and the shapes per layer:</p><pre>model</pre><pre>## Model<br>## ___________________________________________________________________________<br>## Layer (type)                     Output Shape                  Param #     <br>## ===========================================================================<br>## dense_28 (Dense)                 (None, 64)                    256         <br>## ___________________________________________________________________________<br>## dense_29 (Dense)                 (None, 64)                    4160        <br>## ___________________________________________________________________________<br>## dense_30 (Dense)                 (None, 2)                     130         <br>## ===========================================================================<br>## Total params: 4,546<br>## Trainable params: 4,546<br>## Non-trainable params: 0<br>## ___________________________________________________________________________</pre><p>Now it’s time to define the loss and optimizer functions, and the metric to optimize.</p><p>Although it says “accuracy”, keras recognizes the nature of the output (classification), and uses the categorical_accuracy on the backend.</p><pre>compile(model, loss = &quot;categorical_crossentropy&quot;, optimizer = optimizer_rmsprop(), metrics = &quot;accuracy&quot;)</pre><p>Let’s fit (train) the model:</p><pre>history = fit(model,  x_data, y_data_oneh, epochs = 20, batch_size = 128, validation_split = 0.2)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*WTwrb2LTuPlURDoCP3oHug.gif" /></figure><p>Done!</p><p>Plotting results:</p><pre>plot(history)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*fw2CCSvOCEZCavrdrxvStA.png" /><figcaption>Keras results in ggplot2</figcaption></figure><h3>Validating with unseen data</h3><p>Creating ‘unseen’ input test data (1000 rows, 3 columns):</p><pre>x_data_test=matrix(data=runif(3000), nrow=1000, ncol=3)<br>dim(x_data_test)</pre><pre>## [1] 1000    3</pre><p>Predicting new cases:</p><pre>y_data_pred=predict_classes(model, x_data_test)</pre><pre>glimpse(y_data_pred)</pre><pre>##  num [1:1000(1d)] 0 0 1 1 1 1 0 1 0 1 ...</pre><p>Please note that the dimension is 1000 rows and 2 columns. predict_classes automatically does the one-hot decoding.</p><p>On the contrary, predict returns the same dimension that was received when training (n-rows, n-classes to predict).</p><pre>y_data_pred_oneh=predict(model, x_data_test)</pre><pre>dim(y_data_pred_oneh)</pre><pre>## [1] 1000    2</pre><pre>head(y_data_pred_oneh)</pre><pre>##                     [,1]              [,2]<br>## [1,] 0.99207872152328491 0.007921278476715<br>## [2,] 1.00000000000000000 0.000000001157425<br>## [3,] 0.00000002739444227 1.000000000000000<br>## [4,] 0.41273152828216553 0.587268412113190<br>## [5,] 0.03470309823751450 0.965296924114227<br>## [6,] 0.00000000007147296 1.000000000000000</pre><p>In classification, it is always recommended to return the probabilities for each class, just like we did with predict (the row sum is 1). More info at: <a href="https://livebook.datascienceheroes.com/model-performance.html#scoring_data">DSLB - Scoring Data</a>.</p><h3>The softmax activation</h3><p>We got the probabilities thanks to the activation = &quot;softmax&quot; in the last layer.</p><p>The output of softmax ranges from 0 to 1 for each class, and the sum of all the classes is, naturally, 1.</p><h3>Evaluating the model (Training vs. Test)</h3><p>Creating the “real” y target to compare against the predicted:</p><pre>y_data_real=ifelse(rowSums(x_data_test) &gt; 1.5, 1, 0)<br>y_data_real_oneh=to_categorical(y_data_real)</pre><pre>## Training data<br>evaluate(model, x_data, y_data_oneh, verbose = 0)</pre><pre>## $loss<br>## [1] 0.03008356<br>## <br>## $acc<br>## [1] 0.9918</pre><pre>## Test data (we need the one-hot version)<br>evaluate(model, x_data_test, y_data_real_oneh, verbose = 0)</pre><pre>## $loss<br>## [1] 0.03146484<br>## <br>## $acc<br>## [1] 0.991</pre><p>The accuracy with the unseen data is almost perfect: Around 1 (and a loss near to 0, which is more important than the accuracy).</p><p>The neural network learned the pattern we defined at the beginning 🎉!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*DN6ac4WjjCBY8mLcrkeaiQ.gif" /></figure><h3>Some questions 🤔</h3><p><em>How many layers are needed?</em> We tried with 3, but how about 4? It will learn the same, but in more time. But in other scenarios the performance is increased. It depends on each case.</p><p><em>How many neurons per layer are needed?</em> The same reasoning as before. We should expect that maximum accuracy with the simplest network. One approach that tends to do a good standard fit is to start with a layer with (i.e.) 128 neurons. Then add a layer with 64 and the other with 16. The pattern is to reduce the number of neurons per layer.</p><h3>Try-it yourself 🙌</h3><p>Reading is just one tiny part of learning, try it yourself by, for example, changing the function we used (we tried the y &gt; 1.5 = 1) and put the network to learn it.</p><p>Learn by coding and expose your practice to errors 🙂</p><h3>Further reading</h3><ul><li><a href="https://keras.rstudio.com/articles/sequential_model.html">Guide to the Sequential Models</a> (from Rstudio)</li><li><a href="https://blog.rstudio.com/2018/09/12/getting-started-with-deep-learning-in-r">Getting started with deep learning in R</a> (from Rstudio)</li><li><a href="https://blog.datascienceheroes.com/sample-size-and-class-balance-on-model-performance">Sample size and class balance on model performance</a> (the underlying model was built with Keras)</li></ul><p><em>This post was originally published at: </em><a href="https://blog.datascienceheroes.com/how-to-create-a-sequential-model-in-keras-for-r/"><em>https://blog.datascienceheroes.com/how-to-create-a-sequential-model-in-keras-for-r/</em></a></p><p>Any questions? Leave them below 📩</p><p><strong>Thanks</strong> for reading! 🚀</p><p>📗 <a href="http://livebook.datascienceheroes.com/">Data Science Live Book</a> — An online book to learn machine learning</p><p><a href="https://blog.datascienceheroes.com/how-to-create-a-sequential-model-in-keras-for-r/blog.datascienceheroes.com">More data stories: Blog</a> | <a href="https://www.linkedin.com/in/pcasas/">Linkedin</a> | <a href="https://twitter.com/pabloc_ds">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1437aaf778e2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/how-to-create-a-sequential-model-in-keras-for-r-1437aaf778e2">How to create a sequential model in Keras for R</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tutorial instalación R y RStudio]]></title>
            <link>https://medium.com/datos-y-ciencia/tutorial-instalaci%C3%B3n-r-y-rstudio-563771a29289?source=rss-e9ceb8bfaf6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/563771a29289</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Pablo Casas]]></dc:creator>
            <pubDate>Sun, 15 Jul 2018 15:05:22 GMT</pubDate>
            <atom:updated>2020-05-06T16:18:09.062Z</atom:updated>
            <content:encoded><![CDATA[<h4>Este tutorial tiene como propósito hacer el set-up inicial para empezar a desarrollar modelos machine learning en el increíble lenguaje <strong>R</strong>.</h4><p>Este tutorial tiene como propósito hacer el set-up inicial para empezar a desarrollar modelos machine learning en el increíble lenguaje <strong>R</strong>.</p><p>Empecemos!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*S_TzbGxBQnSE-sj6.gif" /></figure><p>⚠️Si ya tienen R, pero es una versión anterior a la 3.6, instalen la última para evitar problemas. relacionado con este punto, escribí un post extenso: <a href="https://escueladedatosvivos.ai/blog/207351/consejos-spara-migrar-r-y-sobrevivir-en-el-tiempo">Consejos para migrar R y sobrevivir en el tiempo</a></p><h3>Instalando R!</h3><p>Pueden ir a la página principal: <a href="https://cran.r-project.org/">https://cran.r-proect.org</a>, o bien a los atajos debajo.</p><p>Los llevará a la última versión de <strong>R</strong>: 4.0.0 (mayo 2020):</p><h3>Windows</h3><p>Última versión de R acá: <a href="https://cran.r-project.org/bin/windows/base/">https://cran.r-project.org/bin/windows/base/</a></p><p>En algunos casos será necesario instalar Rtools, el que trae programas para compilar como el gcc. Si sos desarrollador/a probablemente ya lo tengas.</p><p>Rtools lo bajan de: <a href="https://cran.r-project.org/bin/windows/Rtools/Rtools34.exe">https://cran.r-project.org/bin/windows/Rtools/Rtools34.exe</a></p><p>Al instalar tengan la precaución de setear la opcion del PATH como figura en la imagen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/0*HElJ6WIqhe0n0smJ.png" /></figure><p>Mas información de Rtools acá: <a href="https://github.com/stan-dev/rstan/wiki/Install-Rtools-for-Windows">https://github.com/stan-dev/rstan/wiki/Install-Rtools-for-Windows</a></p><h3>MacOS</h3><p>Link a la página de descarga de la última versión: <a href="https://cran.r-project.org/bin/macosx/">https://cran.r-project.org/bin/macosx/</a></p><p>El link se llama:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/0*4N47a0oW0ngJK_EX" /></figure><h3>Linux</h3><p><a href="http://mirror.fcaglp.unlp.edu.ar/CRAN/">http://mirror.fcaglp.unlp.edu.ar/CRAN/</a> (elijan su distribución)</p><h3>Instalando RStudio</h3><p>Es el entorno de desarrollo de R.</p><p>Vamos a: <a href="https://www.rstudio.com/products/rstudio/download/#download">https://www.rstudio.com/products/rstudio/download/#download</a></p><p>Buscamos e instalamos la versión compatible con nuestro sistema operativo:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kGUFsyEALXm7F1R1.png" /></figure><h3>Instalando los paquetes (librerías) de R</h3><p>Esto es dependiente de lo que se necesite hacer, pero daré los que uso normalmente.</p><p><strong>Tengan en cuenta que si ya tenian R instalado, e instalan una version nueva, entonces necesitaran instalar todos los paquetes de nuevo.</strong></p><p>Abren RStudio, y si todo fue bien, tienen que ver algo como esto:</p><p>A continuación copian y pegan la siguiente línea de código para instalar los paquetes en la consola (donde esta el cursor), apretan enter y esperan unos minutos…</p><p>libs_para_instalar=c( &quot;tidyverse&quot;,&quot;Hmisc&quot;, &quot;funModeling&quot;,&quot;reshape2&quot; ,&quot;caret&quot;, &quot;data.table&quot;,&quot;lubridate&quot;, &quot;zoo&quot;, &quot;knitr&quot;,&quot;infotheo&quot;,&quot;RColorBrewer&quot;,&quot;minerva&quot;, &quot;roxygen2&quot;,&quot;Lock5Data&quot;, &quot;shiny&quot;, &quot;scales&quot;,&quot;corrplot&quot;,&quot;feather&quot;, &quot;gridExtra&quot;, &quot;xgboost&quot;, &quot;gbm&quot;, &quot;randomForest&quot;, &quot;devtools&quot;)</p><p>install.packages(libs_para_instalar)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WA4jSSDzXT5Oz7qD.gif" /></figure><p>Si les aparece el mensaje: <em>“Do you want to install from sources the package which needs compilation? (Yes/no/cancel)”</em> Escriban: Yes</p><p>Si les aparece que para instalar el paquete ‘X’ se necesita el paquete ‘Y’. Instalen ‘Y’ y luego repitan el proceso.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*vYspywSoFIvUzHRF.gif" /></figure><p><strong>Listo!</strong></p><h3>Verificando todos los paquetes instalados</h3><p>Ejecuten la siguiente línea, que comparará los paquetes instalados con los que figuraban en la lista libs_para_instalar:</p><p>libs_para_instalar[!(libs_para_instalar %in% installed.packages()[,&quot;Package&quot;])]</p><p>Si todo salió bien no deberían ver reportado ningún paquete:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/0*hPKjiiEsgVKhHVn-.png" /></figure><p>Nota: character(0) = todo salió ok</p><h3>Errores durante la instalación</h3><p><strong>Revisen que no haya ningún error en la instalación al terminar.</strong></p><p>Si lo hay, intenten reinstalar ese paquete solamente. Si no funciona -&gt; Google (los errores pueden ser variados, sobretodo si tienen windows).</p><p>Si siguen con el problema, pueden preguntarlo en español en: <strong>datosenR.org</strong></p><p>Si tuvieron un error en la instalación de un paquete, todos los paquetes siguientes en la lista no fueron instalados. Pueden probar el volver a correr el install.packages, solamente con los paquetes en cuestión.</p><p>Si ya tienen la distribución de R de Microsoft, MRAN (<a href="https://mran.microsoft.com/">https://mran.microsoft.com</a>); es muy problable que los paquetes que instalen no estén a la última versión que en CRAN.</p><p>¿Qué es CRAN? Es la red global de servidores oficiales de R donde están los paquetes y el programa R en cuestión. Cada vez que hacen install.packages los va a buscar ahí.</p><p>Les recomiendo que igualmente instalen R desde CRAN (como lo indicado anteriormente).</p><p>Como resolver el warning: <a href="https://stackoverflow.com/questions/25721884/how-should-i-deal-with-package-xxx-is-not-available-for-r-version-x-y-z-wa"><em>“package ‘xxx’ is not available (for R version x.y.z)?</em></a></p><h3>Haciendo algunas pruebas</h3><p>Copien y ejecuten esto en R, crearan unos gráficos y creando un modelo predictivo, así de fácil!</p><pre>library(randomForest) <br>library(tidyverse) <br>library(funModeling) <br>randomForest(mtcars, formula = wt ~ qsec)<br>select(mtcars, cyl, hp) %&gt;% arrange(cyl) %&gt;% top_n(5)<br>ggplot(mtcars, aes(cyl)) + geom_histogram()<br>plot_num(mtcars)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bkCY6pgrH7NSYodO.gif" /></figure><p>Fin 🎉</p><p>Si quieren practicar R, los/las invito al curso gratuito que publiqué <a href="https://escueladedatosvivos.ai/p/curso-desembarcando-en-r-2da-edicion-gratis"><strong>Desembarcando en R 2da Edición</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ry72jMWT9EGifLyfGgk1yQ.png" /></figure><p>Y también l@s invito a leer: <a href="https://librovivodecienciadedatos.ai/">https://librovivodecienciadedatos.ai</a> 📗</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/0*0_ab2tpoHa6mDfqg.png" /></figure><p><em>Happy coding!</em> 🚀</p><p><a href="https://twitter.com/pabloc_ds">Twitter</a> y <a href="https://www.linkedin.com/in/pcasas/">Linkedin</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=563771a29289" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datos-y-ciencia/tutorial-instalaci%C3%B3n-r-y-rstudio-563771a29289">Tutorial instalación R y RStudio</a> was originally published in <a href="https://medium.com/datos-y-ciencia">Ciencia y Datos</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“I hate math!” — Part 1]]></title>
            <link>https://medium.com/data-science/i-hate-math-part-1-4e793f5a8f72?source=rss-e9ceb8bfaf6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e793f5a8f72</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Pablo Casas]]></dc:creator>
            <pubDate>Wed, 02 May 2018 12:53:19 GMT</pubDate>
            <atom:updated>2018-10-04T14:28:01.656Z</atom:updated>
            <content:encoded><![CDATA[<h3>“I hate math!” — Education and Artificial Intelligence to find a meaning in what we do</h3><p>Well, what you hate is the way that math was taught to you.</p><p>That soup of equations, abstractions, and solutions to problems that we don’t know, It’s hard to enjoy the things we don’t feel part of.</p><p>But how about relating some math techniques from the world that surrounds us? Would it be possible to re-discover math? Would you give it a try?</p><p>So many questions! Let’s relax with a cute kitten:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*0nL9GWQVXZyWaxNIUlQFiw.png" /></figure><p>Lovely 😍!</p><p>There is a difference between solving hundreds of equations, solving what “<em>X is equal to</em>”… or, well, from learning about other mathematical concepts, like “derivatives” (<a href="https://en.wikipedia.org/wiki/Derivative">https://en.wikipedia.org/wiki/Derivative</a>).</p><p>Again, we solve dozens of different problems involving derivatives. We practice, we solve, and solve again and, after a while, we have forgotten the solutions to the first exercises.</p><p>For sure, there are people comfortable with solving such problems, developing new mathematical theorems, or solving Fermat’s last theorem (<a href="http://www.telegraph.co.uk/science/2016/03/20/why-its-so-impressive-that-fermats-last-theorum-has-been-solved/">http://www.telegraph.co.uk/science/2016/03/20/why-its-so-impressive-that-fermats-last-theorum-has-been-solved/</a>), which is a branch of mathematics dedicated to abstract math. Let’s name it as <em>pure mathematics</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*FhAoweNvJImzxBnwnhpXbQ.png" /></figure><p><a href="https://www.flickr.com/photos/95869671@N08/32264483720/in/photostream/">Enlarge image.</a> <br> Source: <a href="http://dominicwalliman.com/">http://dominicwalliman.com/</a></p><p>If you like math at this point, Eureka! If you don’t, then I invite you to keep reading… We’ll go to the <em>applied mathematics field</em>.</p><h3>My personal experience</h3><p>I was kind of reluctant about math when I studied it in the standard way in high school and college. Exercise guides were weighed in kilograms and students became adept ninjas at solving math problems while forgetting the purpose of all of it (other than to pass the exam) and without knowing the real usage of all of this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*wKTYF29r1HUFe4z6wmFe0Q.png" /></figure><h3>“Why am I learning this?” — That’s the question</h3><p>Everything started to change in college when I assisted in a seminar called “Artificial Intelligence and Robotics.” (What a cool name!)</p><p>Once there, I experienced what I wrote of before: The “meaning” came to life for me when the speaker was explaining artificial neural networks and said:</p><p>“The artificial neural network can learn…” 🙀 Wow!</p><p>They learn thanks to an algorithm called backpropagation…. by using derivatives!!!</p><p>So derivatives are useful for something other than passing exams! Let’s illustrate this point:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*LFIShAeSxm1xybE_dsb_iA.png" /></figure><blockquote><em>“We fear what we don’t understand.” — Many people.</em></blockquote><h3>Math in practice!</h3><p>This algorithm (backpropagation) is highly related to the “Gradient Descent” used nowadays in Deep Learning (Artificial Intelligence) under the TensorFlow framework.</p><p>DeepLearning — the fancy name for Neural Networks introduced by Google, (<a href="https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/45530.pdf">https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/45530.pdf</a>).</p><p>You don’t have to know how to do a derivative. However, understanding what is behind it can help you to:</p><p>a) Train your logical skills (like solving a Sudoku in hard level) <br> b) Develop new algorithms. <br> c) <em>Others</em></p><p>If you don’t, relax and just keep on the high level while using the procedure as a black-box — but with a <strong>deep understanding of what the inputs and outputs are</strong>.</p><p>—</p><p><em>Disclaimer</em>: I’m not a fanatic of derivatives; in fact, I don’t even remember how to derive today, only the “exponential function” because of the jokes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*yegaeL3dpIL4je_Z9PAnUg.png" /></figure><p>Source: <a href="https://www.reddit.com/r/Jokes/comments/4c0rs5/all_the_mathematical_functions_went_to_a_party">Reddit Jokes</a></p><p>—</p><p>Anyway, my personal experience <strong>is not</strong> relevant here. What matters at this point is:</p><p>📌 When we learn anything new (even more when it is abstract), it’s handy to <strong>find a meaning</strong> by researching using questions like: “what is it useful for,” “who is using it,” “is it similar to anything that I already know,” “what’s the intuition behind,” and so on…</p><p>📌 Another key point I found useful when learning math is to <strong>learn by coding</strong>!</p><p>📌 Look for examples — for sure there are plenty around us. Play and destroy the code by changing its parameters. Use the powerful technique of <strong>trial-and-error</strong>.</p><h3>Our impartial friend: Trial-and-error</h3><p>We try once and we end up with a big error. We try again and get a smaller error and, finally, our last try yields the smallest error!</p><p>This error is so small that it is considered that we have learned!</p><p>(This is an oversimplification but it is how deep learning learns 😉)</p><p>Didn’t you know it? Now you do. That is an example of learning by intuition, by using what is already known.</p><p>See a real example below. That is how deep learning learns (using R):</p><p>Source: <a href="https://keras.rstudio.com/articles/training_visualization.html">https://keras.rstudio.com/articles/training_visualization.html</a></p><p>In deep learning terminology:</p><ul><li>The loss can be seen as the error.</li><li>The accuracy is… the accuracy.</li><li>And each epoch is the time.</li></ul><p><em>Learn an intro about deep learning at:</em> <a href="https://medium.freecodecamp.org/want-to-know-how-deep-learning-works-heres-a-quick-guide-for-everyone-1aedeca88076">https://medium.freecodecamp.org/want-to-know-how-deep-learning-works-heres-a-quick-guide-for-everyone-1aedeca88076</a></p><h4>Reverse engineering: From artificial intelligence to “real life”</h4><p>When we study for an exam, we practice several times (epochs) with an exercise guide that we know has the results (blue line), so we learn how to solve those problems (making the accuracy going higher).</p><p>Now the teacher sets an exam in which we don’t know the results and she/he evaluates with the known answer (orange line).</p><h3>Final words</h3><p>When we learn, it’s handy to do so <strong>by association</strong> (just like we did in the last paragraphs).</p><p>Rather than being a “data warehouse of equations”, we as human beings are more suitable for interconnecting things, <strong>finding purpose</strong> in the knowledge we want to explore, and <strong>questioning</strong> what is presented in front of us.</p><p>Relate concepts, use your actual “real-life” knowledge, practice, and find meaning for what you do.</p><p>That’s the message of this post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*OUX4xJ8hGowVzsCtt1JHMA.png" /></figure><p><em>Oh.. still there? Check this out</em> 👇</p><p>I can’t guarantee that it will be easy to understand, but I invite you all to read the open-source book I just published, the “Data Science Live Book” 📗.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*XYWeV6EvkskhM2Pnm5XNWA.png" /></figure><p>That’s my best try for now in teaching data science from a practical and intuitive perspective.</p><p>The book is fully-accessible at: <a href="http://livebook.datascienceheroes.com/">http://livebook.datascienceheroes.com</a> 🚀</p><p>Thanks 🙂</p><p>—</p><p>Twitter: <a href="https://twitter.com/pabloc_ds">@pabloc_ds</a> 🐦 || <a href="https://blog.datascienceheroes.com/">Blog</a> ✍️.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e793f5a8f72" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/i-hate-math-part-1-4e793f5a8f72">“I hate math!” — Part 1</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Science Live Book (open source)]]></title>
            <link>https://medium.com/@pcasas.biz/data-science-live-book-open-source-ca48f3d5af15?source=rss-e9ceb8bfaf6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca48f3d5af15</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[ebooks]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Pablo Casas]]></dc:creator>
            <pubDate>Mon, 06 Nov 2017 20:41:20 GMT</pubDate>
            <atom:updated>2017-11-06T20:41:20.086Z</atom:updated>
            <content:encoded><![CDATA[<p>Well after some time, and +300 commits, this is the biggest release of the <strong>Data Science Live Book</strong>! (open source), after the first publication more than 1 year ago :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*AtGFLUtDyfWbNd5DvCKo5w.png" /></figure><p><strong>tl;dr</strong>: Hi there! I invite you to <a href="https://livebook.datascienceheroes.com/"><strong>read the book online</strong></a> and/or <a href="https://livebook.datascienceheroes.com/download-book.html"><strong>download here</strong></a>. Thanks and have a nice day :)</p><h4>not;tl;dr: An overview…</h4><p>It’s a book to learn data science, machine learning, data analysis with tons of examples and explanations around several topics like:<br> <br>- Exploratory data analysis<br>- Data preparation<br>- Selecting best variables<br>- Model performance</p><p>Most of the written R code can be used in real scenarios! I worked on the <em>funModeling</em> R package at the same time, so it is used many times in the book.</p><h4>How about some examples?</h4><p>It’s a playbook with full of data preparation receipts.</p><p>I.e. in the missing values chapter you’ll find how to input and convert these values into something useful for both, analysis and predictive modeling.</p><p>Other example, in the outliers chapter you’ll get to know to some methods that spot outliers based on different criteria; <em>funModeling</em> contains a function that can help to process all data at once…</p><p>Or more conceptually, we have a numeric variable and we need to convert it into categorical, or vice-versa, do we have to convert or just leave it as it comes?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*HS0ZcMwmpIYjp93KPPVFSQ.gif" /></figure><p>And so on and so on…</p><h4>Book’s philosophy</h4><p>The book has all of its chapters interrelated, so you can start by any of them. My apologies if the number of links distracts from the reading. I wanted it that way just to show how all the machine learning concepts are somehow related.</p><p>There is a lot of effort in justifying what the book states. Yet, this is not enough, the reader can replicate and improve the examples, and thus generate their own knowledge.</p><p>To develop a critical thinking, without taking any statement as the “truly truth”, it’s really important in this sea of books, courses, videos and any kind of technical material to learn. This book is just another view in the data science perspective.</p><h4>Hmmm… next releases?</h4><p>It could vary, but I have some ideas like how to put more information on the predictive model creation and validation, validating clustering models, dimension reduction techniques, “how to become a data scientist”, among others.</p><h4>Some metrics</h4><p>An screenshot from google analytics (Oct-25–2017) showing the top 4 most viewed chapters:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*5_LOte3JpWio6IR-jHYsnw.png" /></figure><p>I think “profiling” is the most viewed section just because is the first chapter after the index. But the number of entrances -which can be seen as the visitors- was beyond my expectations +18k (visiting around +47k pages).</p><p>Many thanks to those who have already read something ❤️!</p><h4>I put some random errors…</h4><p>… both technical and grammatical, the problem is <strong>I don’t know where!</strong> So if you want to raise your hand and shout: <em>”That’s not correct! I think the correct form is… {replace-with-your-detailed-answer-here}”</em>, I invite you to report on the github repository, or email me at pcasas.biz -at- gmail.com</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*-q1oEfWEJM-G9_JTwgPHBw.gif" /></figure><h4>Download the PDF, epub and Kindle version!</h4><p>If you learn anything new with this book, or it helped you somehow to saving time at your work, you can support the project by acquiring the portable version. (name your price starting at US$ 5)</p><p>There is no difference between the portable and web versions :)</p><p>After the purchase you’ll will receive an email to download it in the three formats.</p><p>📌 <a href="https://gumroad.com/l/tORBv">Download here!</a> 📘</p><p>Keep in touch: <a href="https://twitter.com/pabloc_ds">@pabloc_ds</a>.</p><p>~ Thanks for reading 🚀.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca48f3d5af15" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[¿Cómo me convierto en un Científico de Datos? Parte 1/2]]></title>
            <link>https://medium.com/datos-y-ciencia/como-me-convierto-en-un-cientifico-de-datos-parte-1-2-dc2a0ecbc4f4?source=rss-e9ceb8bfaf6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc2a0ecbc4f4</guid>
            <category><![CDATA[r]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[ciencia-de-datos]]></category>
            <dc:creator><![CDATA[Pablo Casas]]></dc:creator>
            <pubDate>Fri, 22 Sep 2017 00:06:20 GMT</pubDate>
            <atom:updated>2020-06-19T15:20:21.474Z</atom:updated>
            <content:encoded><![CDATA[<h3>¿Cómo me convierto en un Científico de Datos?</h3><p>Varias veces me preguntaron, como a otros colegas, ¿cómo se empieza a estudiar ciencia de datos? Quería enfocar en no dar solamente unos links a libros y algún consejo, sino hacer algo más integral.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p9KR-4C0MNkXjigim7disg.jpeg" /></figure><p>¡Ojalá este artículo les sirva de motivación si están arrancando en este mundo de datos!</p><h3>Quién sí— Quién no</h3><p>Una pregunta común hoy en día. Vamos a encarar la respuesta desde un punto de vista técnico y otro más filosófico.</p><p>Normalmente esperaríamos ver un listado de cursos, (los mejores), un listado de pocos libros (los más breves, y los más completos) y alguna recomendación personal sobre ingresar en competencias o escribir un blog post. ¿No?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*JmUWqrlvGsFAnuenU26_kQ.gif" /></figure><p>Eso lo cubriremos pero…</p><p>Sería difícil de definir el punto de inflexión entre definir si somos o no científicos de datos (CdD, de ahora en más). ¿Un año trabajando es suficiente para adquirir este título? ¿O bien dos?</p><p>¿Qué tal acerca de tener un Master en Ciencia de Datos, y ninguna experiencia laboral? O más bien el caso opuesto.</p><p>O esta situación: Haber trabajado en empresas creando modelo predictivos por 7 años, ¿somos en este caso un científico (o científica) de datos? ¿Somos Senior?</p><p>¿Y si en vez de trabajar en el mundo corporativo somos investigadores?</p><p>Quizás la maestría en ciencia de datos sea una cuestión del tiempo que invertimos exponiéndonos a problemas en donde la creatividad es puesta a prueba todo el tiempo.</p><p>Existe una alta subjetividad entre “ser o no” un CdD.</p><p>¿Cuál es la persona o institución con la autoridad para determinar quién puede o no llevar dicho título?</p><h3>Un paso más</h3><p>Ahora vamos a usar un poco de la filosofía de Confucio para establecer tres marcos de aprendizaje de Ciencia de Datos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*AjWXYWLpwitA2cpUb7mVuw.png" /></figure><blockquote>“Hay tres maneras de adquirir sabiduría. Primero por la reflexión que es la más noble. Segundo por la imitación, que es la más sencilla. Y tercero por la experiencia que es la más amarga.”</blockquote><p>Reescribiendo un poco para nuestro propósito:</p><p><em>“Hay tres maneras de convertirse en Científico de Datos. Primero por la lectura, que es la más simple. Segundo copiando-y-pegando código, tratando de hacer que nos ande el ejemplo y modificandolo. Y tercero, mediante la creación del propio código y flujos de análisis.”</em></p><p>Las tres maneras son distintos niveles de profundización, ¿cuál es el que se está buscando?</p><p>La enorme ventaja de aprender ciencia de datos (y otros tópicos de informática), es que se dispone de una<strong> enorme cantidad de recursos, gratuitos</strong> y/o open-source, accesibles mediante la voluntad nuestra de aprender. No es necesario gastar dinero.</p><h3>¿Hace falta aprender a programar?</h3><p>Acá hay un punto de inflexión importante. Para llegar al “tercer nivel” antes mencionado, es casi necesario programar. Sobretodo para crear soluciones complejas y óptimas.</p><p>Hay algunas preguntas básicas que podemos hacer para ir encontrando el camino:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*PBZTb1tV4jlAt8zn." /></figure><h4>Caso A: Aprender ciencia de datos sin programar.</h4><p>Hay programas o aplicaciones web de estadística y machine learning, en los que se puede evitar bastante la programación como lo sería en lenguajes como Julia, R y Python, mediante el uso de interfaces visuales.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*06aB5Zh4vTLdXax1Fo9dOA.gif" /></figure><p>Yo particularmente no las recomiendo porque los costos de los cursos suelen ser muy altos, y se puede aprender los mismos conceptos, por ejemplo como validar modelos, o el uso de modelos gratis en internet.</p><p>Este tipo de herramientas suelen estar en empresas grandes donde la burocracia a veces aleja al CdD del arte de crear soluciones más innovadoras.</p><p>Aprender ciencia de datos sin programar es posible, y el usar este conocimiento en entornos de investigación o laborales también. Se pueden seguir los ejercicios paso a paso que proponen, viendo y analizando los distintos resultados.</p><p>Por ejemplo, se puede comprender el concepto que desarrollar un modelo predictivo con todas las variables posibles, probablemente lleve a resultados menos precisos, que si se usan solo las variables que contienen información.</p><p>Las soluciones que proveen acceso visual a la creación de modelos predictivos, normalmente suelen tener menos parámetros para optimizar la solución. Pero quizás lo más importante, es que al momento de buscar soluciones a los errores que puedan aparecer, la comunidad es mucho más pequeña que la que pueda tener el open-source.</p><p>El software open-source democratiza el acceso a los últimos avances en algoritmos predictivos, descentralizando el acceso a los recursos para aprender.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*64cvc8kvIpXS5KPSGt8w8Q.gif" /><figcaption>Libertad! — Película: The Shawshank Redemption</figcaption></figure><p>Otro caso puede ser el aprender a no introducir variables que contengan información del futuro, afectando silenciosa y peligrosamente las predicción una vez puesto en producción.</p><p>Desarrollar este conocimiento puede ayudar al CdD a crear o validar los modelos con una segunda mirada no tan técnica.</p><p>Es importante leer y analizar críticamente las entradas y salidas a este tipo de procesos.</p><p><strong>Interfaces gráficas en R: Rattle</strong></p><p>Excluyendo las comerciales, la interfaz de Rattle para R (<a href="https://rattle.togaware.com/">https://rattle.togaware.com</a>) puede ser una de las pocas existentes junto a R commander (<a href="http://www.rcommander.com/">http://www.rcommander.com</a>). Esta más orientada a estadística y gráficos simples.</p><p>Enfocándonos en Rattle, este dispone de una gama importante de preparación de datos y conversión de variables, así como también soporte a los modelos predictivos y de clustering más conocidos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*_OtQClYlozczY8k1rPuSWg.png" /></figure><p>Brochure: <a href="https://rattle.togaware.com/RattleBrochure.pdf">https://rattle.togaware.com/RattleBrochure.pdf</a></p><p>Tutorial: <a href="https://eric.univ-lyon2.fr/%7Ericco/tanagra/fichiers/en_Tanagra_Rattle_Package_for_R.pdf">https://eric.univ-lyon2.fr/~ricco/tanagra/fichiers/en_Tanagra_Rattle_Package_for_R.pdf</a></p><p>Uno de los puntos que puede ayudar mucho es que todas las acciones o “clicks” quedan registrados en código de R en su log. Por lo cual se puede empezar a aprender R o bien, extraer las lineas de código de lo que va haciendo Rattle por detrás.</p><p>Rattle puede quedar corto una vez que se tiene más experticia en R, ya que es mas cómodo y mas performante programar todo directamente. Pero puede ser un buen punto de partida.</p><h4>Caso B: No programo, pero quiero aprender</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*hyqJzpqML8_OsEir6KCahw.gif" /></figure><p>Si se quiere aprender a programar en general, y también hacer Ciencia de Datos, quizás sea mas adecuado Python a R, ya que este lenguaje es de proposito mas general que R.</p><p>R está enfocado en analisis de datos, por lo cual es mas abarcativo en materia de machine learning. Cada herramienta tiene sus puntos fuertes y debiles.</p><p>Por ejemplo en Python es mucho mas fácil crear APIs que usen modelos predictivos, mientras que en R es mas facil encontrar una amplia variedad de algoritmos de machine learning.</p><p><em>Aclaración: No es el objetivo del articulo discutir uno vs el otro, es tan polémico como la comparación entre “el enfoque frecuentista vs el bayesiano”, temas tienden a infinito. Para mas información y debates googlear: “R vs Python”.</em></p><p>Se puede trabajar, investigar y/o jugar sabiendo solamente R, ó Python, ó ambos <em>(e incluso, ninguno de los dos…).</em></p><p>Volvamos a R. Con él se puede aprender a programar, no es igual que la programación de lenguajes como C++, Java, Ruby, pero servirá para aprender cuestiones genéricas de la programación.</p><p>Por lo que se pueden encontrar funciones que resuelven lo mismo que en SQL requeriría 50 líneas de código, en tan solo una sola.</p><p>En este caso se pueden aprender los conceptos de matrices, vectores, funciones, buenas prácticas de programación, entre otros.</p><p>Acá es importante preguntarse si realmente se desea profundizar en lo técnico, o solo existe una motivación económica, ya que pueden aparecer una gran cantidad de errores de programación básicos, tan solo para querer generar un gráfico! Puede fomentar que se abandone el aprendizaje.</p><h4>Caso C: Ya se programar en algún lenguaje</h4><p>El salto en este caso, es el más breve, ya que se conoce bastante de lo mencionado en el caso anterior.</p><p>Aquí el foco puede estar mas enfocado en conceptos de machine learning.</p><p>En este punto se puede comenzar por Rattle o bien por algunos de los links que describen a continuación.</p><h3>Programando en R!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*QHHPIbdEoG6iXqy1U_YUQg.gif" /></figure><p>Para el <strong>Caso B</strong> y <strong>C</strong>, se puede empezar bajando el entorno de desarrollo <a href="https://www.rstudio.com/products/rstudio/download/#download">Rstudio</a>, y por supuesto el <a href="https://cloud.r-project.org/">motor R</a>:</p><p>Hora de los libros de la 1er parte…</p><p>Libro: <strong>R for Data Science</strong> (open-source)</p><p><a href="http://r4ds.had.co.nz/">http://r4ds.had.co.nz/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*PIr-2fYT5Nrz5ReW." /></figure><p>Este libro contiene el manejo de estructuras de datos de R, explicando los tipos de datos, como transformarlos y los gráficos.</p><p>Para comenzar, los capítulos recomendados: Data visualisation, Data transformation y Factors.</p><p>Con respecto a los gráficos, la librería usada es ggplot2, puede ser un tanto compleja de aprender al principio, por eso la recomendación es, no intentar entender todos sus parámetros ni forma de escribir, sino más bien quedarse con los gráficos más básicos. Este libro en particular está escrito por el creador de ggplot2, Hadley Wickham, por lo cual la explicación es más detallada aún.</p><p>Otro excelente libro, open-source tambien: <strong>YaRrr! The Pirate’s Guide to R.</strong></p><p><a href="https://bookdown.org/ndphillips/YaRrr/">https://bookdown.org/ndphillips/YaRrr/</a></p><p>Autor: Nathaniel D. Phillips.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*ZkqrdQqB2-7GFOb-." /></figure><p>Esta muy bien explicado, con bromas y un lenguaje muy ameno. Cubre aspectos de manipulación de datos y de estadística inferencial. En palabras de su autor:</p><blockquote>“This book is meant to introduce you to the basic analytical tools in R, from basic coding and analyses, to data wrangling, plotting, and statistical inference.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*AtGFLUtDyfWbNd5DvCKo5w.png" /></figure><p>Invito a leer el libro que publique hace poco:</p><p>“<strong>Data Science Live Book</strong>”,</p><p>En él podrán ver problemas comunes y algunas soluciones, en todo lo referente a la preparación de datos para la creación de modelos predictivos.</p><p><em>Próximamente en español ;)</em></p><p><a href="https://librovivodecienciadedatos.ai/">https://librovivodecienciadedatos.ai/</a><a href="https://librovivodecienciadedatos.ai/">🚀</a> (en español!)</p><p>Además disponible en PDF ,<a href="https://www.amazon.com/dp/9874269049"> Kindle y papel en Amazon</a> 📗:</p><p><a href="https://livebook.datascienceheroes.com/download-book.html"><strong>Link a la pagina de descarga!</strong></a></p><h3>Como diría Confucio</h3><p>Haciendo una libre interpretación: “<em>Leer, copiar y luego crear</em>”. Las siguientes páginas tienen cientos de ejemplos del estilo copiar-pegar y ver los resultados:</p><p>Manejo de las estructuras de datos básicas de R, y funciones estadísticas explicando sus resultados. Esta página útil para los que están arrancando a programar también: <a href="http://www.r-tutor.com/r-introduction">http://www.r-tutor.com/r-introduction</a></p><p>Cientos de ejemplos breves, desde clustering hasta text mining con datos de twitter: <a href="http://www.rdatamining.com/">http://www.rdatamining.com</a></p><p>Para hacer operaciones de transformación y creación de campos, filtros, etc, uno de los paquetes más usados es <strong>dplyr</strong>:</p><p><a href="https://cran.r-project.org/web/packages/dplyr/vignettes/dplyr.html">Https://cran.r-project.org/web/packages/dplyr/vignettes/dplyr.html</a></p><p>Dentro de dplyr, se puede trabajar data frames (tablas), haciendo “joins”: <a href="https://cran.r-project.org/web/packages/dplyr/vignettes/two-table.html">https://cran.r-project.org/web/packages/dplyr/vignettes/two-table.html</a></p><p>Usar <strong>dplyr</strong> es importantísimo, ya que se suele pasar mucho tiempo del proyecto transformando y acomodando los datos para que sean útiles para su análisis.</p><h3>¿Algun curso?</h3><p>Cree una página con cursos y notas de blog, los/as invito a inscribirse como alumn@s :)</p><p><a href="https://escueladedatosvivos.ai/">https://escueladedatosvivos.ai/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MAVLJnUodQZj5OzSSR0cTA.png" /></figure><p>Algunos son pagos, otros gratuitos. Hacer un curso puede ser útil para tener una estructura de principio (carga de datos) a final (creación e implementación del modelo predictivo).</p><p>Sin embargo, no hay que quedarse solo con lo que ahí se aprende. Cuando se enseña el capacitador/docente suele hacer simplificaciones o abstracciones. Hay que practicar lo aprendido para fijar lo visto. Sino puede incurrir en una falsa seguridad para con uno mismo, de conocer algo.</p><p>Es como ocurre cuando se aprende cocina por youtube, una cosa es ver como se hace la torta, y otra es hacer la torta.</p><h3>Cerrando…</h3><p>Hasta el momento vimos libros que pueden proveernos una estructura para aprender tanto aspectos de programación en general, como orientado a ciencia de datos.</p><p>La 2da Parte está orientada a la <strong>comunidad y su soporte</strong> técnico detrás de los lenguajes de programación. Consejos y estrategias para <strong>aprender-haciendo, </strong>paquetes (librerías) que mas uso de R, <strong>competencias </strong>masivas de machine learning, <strong>publicaciones</strong> de análisis… y quizás algo mas ;)</p><p>Hasta la próxima :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*fU_qhd4Ctb4VeCCROKCIKQ.gif" /></figure><p>Me encuentran en:</p><p><a href="https://twitter.com/pabloc_ds">Twitter</a> — <a href="https://github.com/pablo14">Github</a> — <a href="http://blog.datascienceheroes.com/">Blog</a></p><p><a href="https://escueladedatosvivos.ai/">https://escueladedatosvivos.ai/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc2a0ecbc4f4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datos-y-ciencia/como-me-convierto-en-un-cientifico-de-datos-parte-1-2-dc2a0ecbc4f4">¿Cómo me convierto en un Científico de Datos? Parte 1/2</a> was originally published in <a href="https://medium.com/datos-y-ciencia">Ciencia y Datos</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>