<?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 Jose Ramon Perez Agüera on Medium]]></title>
        <description><![CDATA[Stories by Jose Ramon Perez Agüera on Medium]]></description>
        <link>https://medium.com/@joseperezaguera?source=rss-2ac0c346e62e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*B1tt8ucPcueoe-xn.jpg</url>
            <title>Stories by Jose Ramon Perez Agüera on Medium</title>
            <link>https://medium.com/@joseperezaguera?source=rss-2ac0c346e62e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 08:02:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joseperezaguera/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[Some basic statistical techniques for Product Managers]]></title>
            <link>https://medium.com/@joseperezaguera/some-basic-statistical-techniques-for-product-managers-250a02586453?source=rss-2ac0c346e62e------2</link>
            <guid isPermaLink="false">https://medium.com/p/250a02586453</guid>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Jose Ramon Perez Agüera]]></dc:creator>
            <pubDate>Fri, 14 Jun 2019 17:11:03 GMT</pubDate>
            <atom:updated>2019-06-17T05:42:12.313Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hKHrl8irJkzfOiGmCB-EGQ.png" /></figure><h3>Introduction</h3><p>Data analysis is one of the main challenges that a Product Manager (PM) needs to face off. However it is very difficult to find PMs with enough analytical skills to solve even simple analytical problems. I’m not talking about KPIs and metrics definitions, since more of PMs feel comfortable defining the proper metrics to track the evolution of the features that are launched to production. My focus on this paper is rather on the basic statistical tools that PMs should have in their backpacks to avoid being fooled by the hidden devil who live behind the data.</p><p>The following sections describe the basic statistical tools that any PM should apply to make sure that the hypothesis are validated in a scientific way.</p><h3>Descriptive Statistics</h3><p>The first step when you start to dive deep into your data lake is getting a statistical description of your data sample. Of course, some basic intuitions can be extracted just launching an SQL query, but given that data samples are not very intuitive, in addition to the dangers of the confirmation bias, it is very worthwhile to display some very basic statistical analysis to double check that we won’t follow a wrong analytical path.</p><h3>Summary statistics</h3><p>Summary statistics<strong> </strong>are used to summarize a set of observations, in order to communicate the largest amount of information as simply as possible*. We will use the following metrics:</p><ol><li>Count of rows</li><li>Arithmetic mean</li><li>Standard deviation</li><li>The sample minimum (smallest observation)</li><li>The lower quartile or first quartile (25%)</li><li>The median (the middle value) (50%)</li><li>The upper quartile or third quartile (75%)</li><li>The sample maximum (largest observation)</li></ol><p>These metrics provide a clear understanding of the quality of your data, since allow you to go further the arithmetic mean. Arithmetic mean are quite useful to summarize your data, but at the same time is quite dangerous if it is used without the support of other additional measures like the standard deviation or the median. Remember, that the mean said that if I have two millions of euros and you have cero euros, each of us have one million of euros.</p><p>Quartiles, median, and standard deviation help us to check how trustable is the arithmetic mean and therefore, how stable is our data distribution in order to get conclusion or validate our hypothesis. High standard deviations regarding the arithmetic mean or a significant difference between the mean and the median can tell us that the mean is masking the real behaviour behind our data.</p><h4>Python recipe for Summary statistics</h4><p>Getting statistical summaries with Pandas (the python library for advanced data analysis) is very straightforward.</p><pre>import pandas as pd<br><br>df = pd.read_csv(&quot;your_file&quot;, sep=&quot;;&quot;, names = [&quot;column_1&quot;,&quot;column_2&quot;])</pre><pre>df.describe(&#39;column_to_describe&#39;)</pre><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*bS24HoYMpj89mrj0qKGesw.png" /></figure><h3>Line Plots</h3><p>Once you have a numerical summary of your data sample, the next step is moving forward with some very basic data visualization techniques. Lines plots are quite useful, specially when you are dealing with a temporal dimension. I will provide more detail in another tutorial about how to work with Time Series but just a basic line plot can help you a lot to understand how your data sample behave across the time.</p><h4>Python recipe for line plots</h4><p>Plotting your data with pandas is again quite simple</p><pre>import pandas as pd<br>import matplotlib.pyplot as plt<br><br>df = pd.read_csv(&quot;your_file&quot;, sep=&quot;;&quot;, names = [&quot;column_1&quot;,&quot;column_2&quot;])</pre><pre>df.plot(x=&#39;column_to_plot_x_axis&#39;, y=&#39;column_to_plot_y_axis&#39;, figsize=(18,4))<br>plt.show()</pre><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mRsFTosCesmneeFY83AdUQ.png" /></figure><h3>Shape of the distribution</h3><p>Plotting the probability distribution of your data sample is, by far, the simplest visualization technique to detect anomalies in your data.</p><p>When we are making decisions based on the arithmetic mean we assume that the data sample is a perfect normal distribution, which in practice is not very realistic. In the real world most of data distributions have outliers and local tendencies that need to be analysed to really understand what is going on with our data.</p><p>In a probability distribution plot y’s axis represent the probability (actually is a density function, but let’s keep it simple) of getting the values represented in the x’s axis, which provides a clear view of the central tendency of the distribution, which corresponds to the mean, but also provides a nice view of other significant values in the distribution which match with other less common but still significant events.</p><p>Below, we have an example where we can see that, further the mean of the distribution, we have a bunch of values that need to be analysed in a separated way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*zSThyWe5beKGDb0erYBpZQ.png" /></figure><h4>Python recipe for Probability Distribution</h4><p>Probability distribution can be plotted using pandas plot function just setting the <em>kind</em> parameter to<em> kde</em> (Kernel Density Estimation) which is a non-parametric way to estimate the probability density function.</p><pre>import pandas as pd<br>import matplotlib.pyplot as plt<br><br>df = pd.read_csv(&quot;your_file&quot;, sep=&quot;;&quot;, names = [&quot;column_1&quot;,&quot;column_2&quot;])<br>df.plot(y=&#39;column_to_plot&#39;, kind=&#39;kde&#39;, figsize=(18,4))<br>plt.show()</pre><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D0h9kkYXOQPmXrtxFnpEYA.png" /></figure><h3>Outliers analysis</h3><p>Outliers analysis is important for data cleaning and anomalies detection.</p><p>To properly detect and remove outliers we can use Box and Whisker plots and Z-score.</p><h4>Box and Whisker plots</h4><p>Box and Whiskers or Box plot provides a very nice visual representation of the numerical summary statistics, including those values that are good candidates to be labeled as outliers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hTUdX4iFcz2v7JNdNdvSrw.png" /><figcaption>source: <a href="https://blog.usejournal.com/descriptive-statistics-with-python-6c7acb1d3671">https://blog.usejournal.com/descriptive-statistics-with-python-6c7acb1d3671</a></figcaption></figure><h4>Python Recipe for Box and Whisker plots</h4><p>Box plots are also available in the wrapper that pandas implements around <a href="https://matplotlib.org/">matplotlib</a>.</p><pre>import pandas as pd<br><br>df = pd.read_csv(&quot;your_file&quot;, sep=&quot;;&quot;, names = [&quot;column_1&quot;,&quot;column_2&quot;])<br>df.boxplot(column=[&#39;column_to_plot&#39;])<br>plt.show()</pre><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*G_DngLAh7XxOoSNjg-u0Bw.png" /></figure><h4>Z score</h4><p>Outliers can be removed using z-score which is related with the number of standard deviations from the mean. Usually every value outside three standard deviations can be considered as an outlier.</p><h4>Python Recipe for Z score</h4><p>The following code reproduce an example to implement a function to remove outliers from a given list of columns in a dataframe.</p><pre>import pandas as pd<br>from scipy.stats import zscore<br><br>def remove_outliers(df, columns):<br>  for column in columns:<br>    df = df[(np.abs(zscore(df[column])) &lt; 3)]<br>  return df<br><br>df = pd.read_csv(&quot;your_file&quot;, sep=&quot;;&quot;, names = [&quot;column_1&quot;,&quot;column_2&quot;])<br>df = remove_outliers(df,[&#39;column_to_remove_outliers&#39;])</pre><h3>Measure of statistical dependence</h3><p>If more than one variable is measured than correlation coefficient can be calculated in order to understand the statistical relationship between the variables. Getting the correlation between two or more variables can help us to understand the interaction between the variables and it is the first step to carry out statistical inference and predict the future behaviour of the variables in the sample.</p><h4>Pearson correlation measure</h4><p>Pearson correlation is a common correlation measure that can be used to figure out how is the relationship between several variables. This measure goes from -1 to +1 where 0 means not correlation at all, positive numbers mean positive correlation and negative values show an inverse correlation between the variables. Correlations above 0.5 can very very useful for prediction tasks.</p><h4>Python Recipe for correlation</h4><p>The correlation measure is also included out-of-the-box in pandas.</p><pre>import pandas as pd<br><br>df = pd.read_csv(&quot;your_file&quot;, sep=&quot;;&quot;, names = [&quot;column_1&quot;,&quot;column_2&quot;])<br>df.corr()</pre><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*kzTFNDjZcqBF7lhAPHPHpQ.png" /></figure><h4>Regression plot</h4><p>Having a high correlation value is a very good starting point. However, drawing a scatter chart is also a good way to figure out how good the correlation is, since a high correlation could hide a trap because the nature of the outliers or the data distribution. You can get more information about this statistical behaviour at Anscombe’s quartet.</p><p>To avoid this problem you can plot the regression plot to make sure that your correlations looks OK further the number that you are getting from the correlation coefficient.</p><h4>Python recipe for regression plot</h4><pre>import pandas as pd<br>import seaborn as sns<br><br>df = pd.read_csv(&quot;your_file&quot;, sep=&quot;;&quot;, names = [&quot;column_1&quot;,&quot;column_2&quot;])<br>sns.regplot(x=&quot;column_1&quot;, y=&quot;column_2&quot;, data=df)</pre><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*34qkojP9ie8z82_7mRHZhg.png" /></figure><h3>Conclusion</h3><p>PMs need to deal with data in a daily basis, of course, a PM is not a data scientist or an statistician, however, given that PMs make data-driven decisions everyday it is very important to become fluent with some very basic statistical techniques in order to make rock-solid data-driven decisions and avoid being fooled by the complexity that exists behind every data sample.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=250a02586453" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Algunas claves y herramientas para crear una cultura organizativa basada en datos]]></title>
            <link>https://medium.com/@joseperezaguera/algunas-claves-y-herramientas-para-crear-una-cultura-organizativa-basada-en-datos-e9785a1498ac?source=rss-2ac0c346e62e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9785a1498ac</guid>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[ecommerce]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Jose Ramon Perez Agüera]]></dc:creator>
            <pubDate>Thu, 18 Apr 2019 13:01:53 GMT</pubDate>
            <atom:updated>2019-04-18T13:01:53.936Z</atom:updated>
            <content:encoded><![CDATA[<p>La creación de una cultura de toma de decisiones orientada a datos se puede ejecutar de muchas maneras y está claro que no hay una fórmula mágica que le sirva a todo el mundo. Sin embargo, existen determinadas buenas prácticas que deben estar presentes en cualquier proyecto que quiera poner la información cuantitativa en el pipeline de toma de decisiones. En este articulo voy a intentar proporcionar lo que para mi son los aspectos más importantes a tener en cuenta y mostraré las herramientas que estamos usando en <a href="http://mercadonatech.es/es/">Mercadona Tech</a> para conseguir que los datos formen parte de nuestro proceso de toma de decisiones de una manera coherente y científica.</p><h3>La democratización del dato</h3><p>Desde mi punto de vista el primer paso ineludible es proporcionar acceso a los datos a toda la organización y hacerlo de manera que sea un proceso totalmente self-service. No hay nada que aleje más a una organización de sus datos que la existencia de un departamento de Business Intelligence que funcione como la chacha de los datos para los demás departamentos. Los perfiles de Business Intelligence deben dedicar su tiempo a análisis complejos y profundos que vayan mucho más allá de sacarle los datos a algún manager con alguna hipótesis por validar y pocas ganas de remangarse y conseguir los datos por sí mismo.</p><p>En una organización basada en datos cualquier persona debe ser capaz de conseguir sus propios datos, analizarlos y sacar conclusiones a partir de ellos de manera autosuficiente. Esto significa naturalizar más allá de los departamentos más técnicos el manejo de bases de datos incluyendo un conocimiento avanzado de SQL, ya que es la única forma de acceder a los datos con la suficiente flexibilidad como para no necesitar de nadie más a la hora de realizar un análisis.</p><p>En Mercadona Tech conseguimos esto centralizando la consulta de los datos a través de <a href="https://metabase.com/">Metabase</a>, donde vamos conectando todos los repositorios y fuentes de datos que vamos creando.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T5MRR0JBN-A5fIRm_AYELQ.png" /></figure><p>Otra herramienta que probamos en el pasado fue <a href="https://superset.incubator.apache.org/">Superset</a>, pero en nuestro caso Metabase nos ha parecido algo más amigable y fácil de usar de cara ser utilizada por perfiles menos técnicos</p><h3>Las fuentes de datos</h3><p>En un entorno donde se generan grandes cantidades de datos las fuentes de datos también son múltiples. Este escenario, que puede resultar caótico, es necesario ya que significa que la recogida y el almacenamiento de datos es un proceso ágil con un coste bajo desde un punto de vista técnico. Si para crear una tabla con datos agregados necesitas la intervención de un ingeniero estás lejos de poder decir que tu cultura de trabajo está orientada a datos. En Mercadona Tech, cualquiera puede tirar una consulta SQL a través de Metabase, bajar un CSV y cargarlo en <a href="https://cloud.google.com/bigquery/">Big Query</a> via Google Storage sin la intervención de un ingeniero. Esta flexibilidad es clave para que surja de manera orgánica esa cultura de datos.</p><p>Desde Metabase podemos acceder a réplicas de las bases de datos de producción con toda la información en bruto, manteniendo criterios de anonimización para respetar la privacidad de los datos de los clientes, también tenemos acceso a nuestras instancias de <a href="https://cloud.google.com/bigquery/">Big Query</a> donde guardamos datos en bruto pero también datos agregados y data sets utilizados para algunas tareas de aprendizaje automático.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MswwAtnQaa4Yc4C8F4q15Q.png" /></figure><p>Incluso podemos generar dashboards sobre información contenida en Google Spreadsheet, lo que da mucha potencia a la hora de tener asegurarse que toda la información que manejamos está disponible desde el mismo sitio.</p><h3>La capacidades analíticas</h3><p>La tercera derivada se define a través de las capacidades analíticas de los equipos. Hace poco encontré en Linkedin esta imagen que me pareció muy ilustrativa:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*X-Ri9bbOsJRXKCEQasJEbQ.jpeg" /></figure><p>La mayoría de los análisis que se encuentran en muchas empresas son hojas excel con sumas, restas, multiplicaciones y divisiones, lo cual limita mucho la capacidad para hacer análisis mínimamente complejos. Hoy en día y gracias a la disponibilidad de multitud de librerías y frameworks que implementan métodos de análisis avanzados podemos acceder a herramientas estadísticas y matemáticas complejas con una curva de aprendizaje bastante más suave que hace 10 años.</p><p>En nuestro caso usamos <a href="https://colab.research.google.com/">Colaboratory</a> de Google, que desde mi punto de vista es una pasada, ya que permite crear y compartir notebooks de <a href="https://jupyter.org/">Jupyter</a> como si de un documento más de Google Drive se tratase. El uso de <a href="https://pandas.pydata.org/">pandas</a>, <a href="https://scikit-learn.org/stable/">scikit-learn</a>, <a href="https://www.numpy.org/">numpy</a> o <a href="https://facebook.github.io/prophet/">Prophet</a>, nos permite ir más allá de los clásicos análisis de excel, tanto en escalabilidad, debido a que podemos trabajar con un volumen de datos mayor, como en complejidad. Por ejemplo Prophet nos está permitiendo realizar forecast para ventas y para nuestra cadena de suministro de manera muy sencilla y sin necesidad de contar con grandes conocimientos técnicos o estadísticos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CEUVHCfymgA_Jx5zRRY5KA.png" /></figure><p>Utilizar Python en estos entornos no es más complejo que utilizar excel y sin embargo si es mucho más potente, yo suelo bromear diciendo que estas herramientas son un excel con esteroides al alcance de cualquiera, no solo de ingenieros y otros perfiles técnicos similares.</p><h3>Conclusiones</h3><p>Nuestro enfoque está siendo muy iterativo y aún tenemos mucho que mejorar para conseguir una organización donde los datos formen parte realmente de nuestro día a día pero sin duda las herramientas que he mencionado más arriba nos están ayudando mucho a mejorar en este sentido.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9785a1498ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to solve cartonization for e-commerce groceries using Machine Learning]]></title>
            <link>https://medium.com/@joseperezaguera/how-to-solve-cartonization-for-e-commerce-groceries-using-machine-learning-843551f80f8a?source=rss-2ac0c346e62e------2</link>
            <guid isPermaLink="false">https://medium.com/p/843551f80f8a</guid>
            <category><![CDATA[logistics-for-ecommerce]]></category>
            <category><![CDATA[e-commerce-business]]></category>
            <category><![CDATA[logistics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[logisticstech]]></category>
            <dc:creator><![CDATA[Jose Ramon Perez Agüera]]></dc:creator>
            <pubDate>Thu, 18 Apr 2019 00:49:13 GMT</pubDate>
            <atom:updated>2019-04-18T00:56:45.928Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hxkaikNb21i1osJU7kEP6Q.png" /></figure><p>Logistics is the heart of e-commerce. Most of the problems that you need to solve when you are working on creating an e-commerce business end-to-end are related with being able to prepare orders and deliver the purchase at customer’s home.</p><p>One of those problems is cartonization, which means to be able to know in advance how many crates will be needed to prepare and pack the customer’s order. This problem is even more important for us, in <a href="http://mercadonatech.es/en/">Mercadona Tech</a>, since one order has in average from 40 to 50 products and from 60 to 70 items.</p><p>At the beginning of the project with started to use a very basic heuristic, since we didn’t have enough data to learn how to carry out this task in a more efficient way, but after several months gathering data we realized that we had enough information to move forward with a better approach applying some very basic Machine Learning techniques.</p><p>As I mentioned above, cartonization is the process of evaluating the items included in an order to determine the number and size of each shipping carton needed. The weight, height, length and width of each item is used along with basic mathematics to determine the best way to pack each carton. In our case, we reduced cartonization to getting the number of crates that will be needed during the picking process for every order.</p><p>Given that we needed to predict the number of crates, the problem was modeled as a <a href="https://en.wikipedia.org/wiki/Regression_analysis"><strong>regression problem</strong></a>, since we wanted to predict a continuous value.</p><h4>Correlation Analysis</h4><p>The easiest way to find high quality features is using <a href="https://en.wikipedia.org/wiki/Feature_selection#Correlation_feature_selection">Correlation Feature Selection</a> (CFS) where a good feature highly correlated with the label that we want to predict and yet uncorrelated to each other feature of the model. When we have several features CFS allow us to find the best set of features that minimize our Loss function.</p><p>For this exercise, we studied how correlates the total volume of the orders with the number of crates prepared by the pickers in the warehouse.</p><p>Input Variables (<strong>Feature</strong>):</p><ul><li>total_volume: The total volume of each order which is the sum of the volume of all the products included in the order.</li></ul><p>Output Variable (<strong>Label</strong>):</p><ul><li>Number of crates: number of crates prepared by the pickers in the warehouse given an order during the last 6 months.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*hCdxwEfhijJapDC2IEhutQ.png" /></figure><p>Correlation analysis with Pandas is very straithgforward, once we had the dataframe ready we run a basic correlation analysis getting a correlation heatmap:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GsBG0yC3lctwW1K_Ck93Aw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*3hj4reHZWFLtmts8ATRTMA.png" /></figure><p>… and the correlation values</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*YRDCxg92-UWudbV7ef3zbQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*2Ii8S6NbeP-8Hc0HjkmZXw.png" /></figure><p>Having a correlation value of 0.93 was a very good starting point. However, drawing a scatter chart was also a good way to figure out how good the correlation was, since a high correlation could hide a trap because the nature of the outliers or the data distribution.</p><p>Taking this issue in mind, we analysed how our to variables correlates when graphed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TqWY9N6Os6KCBpCCJdbmaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*MUjbsBsq5_TgThOrdc-pCA.png" /></figure><p>Well, everything looks great actually, a few outliers could be removed but we had tones of data points keeping a consistent behaviour, which confirms that the total order volume was a good predictor of the number of crates.</p><h4>Prepare Features</h4><p>Once we had found a good predictor was time to prepared the data to be ingested by the learning algorithms. Fist step was to extract a dataframe with the selected features and an array with the corresponding labels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*gaKAU-BfXfx_wFQU372fDA.png" /></figure><h4>Training, Test and Validation Sets</h4><p>Splitting the dataset was the next step. We created three partitions of the data set:</p><ul><li><strong>Training set</strong> — a subset to train a model.</li><li><strong>Test set</strong> — a subset to test the model.</li><li><strong>Validation set </strong>— a subset to validate the Test set results and reduce your chances of overfitting</li></ul><p>Getting this task done with scikit-learn was very easy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ixl_qZGms_2WJVwOfKqSew.png" /></figure><h4>Features scaling</h4><p><a href="https://en.wikipedia.org/wiki/Feature_scaling">Feature scaling is a method used to standardize the range of independent variables or features of data</a>. Most of ML algorithms are very sensitive to feature scaling, especially <a href="https://en.wikipedia.org/wiki/Stochastic_gradient_descent">Stochastic Gradient Descent</a>, so we needed to apply some normalization methods. Without normalization, our training could blow up with NaNs if the gradient update was too large.</p><p>In every model you create is always highly recommended to scale the data and figure out what is the impact of scaling your features in the model performance.</p><p>There are several feature scaling techniques, where min-max normalization is the simplest one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*LjLXE0YQFDklgvDiv4KUGw.png" /></figure><p>Scikit-learn allows you to do this in a ver easy way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*wksZVN9_2XDiuELgMfYF_w.png" /></figure><h4>Learning Algorithm: Stochastic Gradient Descent Regressor</h4><p>Finally we were ready to run our learning algorithm. We applied a <strong>Linear Model</strong> to predict the number of crates given an order. <strong>Linear models</strong> describe a continuous response variable as a function of one or more predictor variables. They can help us to understand and predict the behavior of complex systems or analyze experimental data. <strong>Linear regression</strong> is a statistical method used to create a <strong>linear model</strong>.</p><p>Linear Regression general formula</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/246/1*ltlE2MX_BGjdK3k4MYG-xg.png" /></figure><p>where</p><ul><li><em>y</em> is the value we are trying to predict</li><li><em>m</em> is the slope of the line</li><li><em>x</em> is the value of the input feature</li><li><em>b</em> is the y-intercept</li></ul><p>Linear Regression formula for Machine Learning</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/262/1*GoEedupntdLSYC8pWCjJcw.png" /></figure><p>where</p><ul><li><em>y’</em> is the value we are trying to predict. <strong>Number of crates.</strong></li><li><em>b</em> is the bias (the <em>y-intercept</em>), sometimes referred to as <em>w_0</em></li><li><em>w_1</em> is the weight of the feature 1. Weight is the same concept as the “slope” <em>m</em> in the traditional equation of a line</li><li><em>x_1</em> is a feature, a known input. <strong>Total Volume of the order</strong></li></ul><p>Running linear regressors using SGD with scikit-learn was very easy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w5tMDUwCwLa1EIJOUdZPHQ.png" /></figure><h4>Benchmarking</h4><p>We already had an algorithm up and running for cartonization, based on the order volume, so we made the decision to use this formula as a kind of naive predictor of the number of crates to set up a benchmark:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*rBWXkSfhxFgV3BakZptplQ.png" /></figure><h4>Evaluation</h4><p>Once we got the model trained and the benchmark, we needed to evaluate the performance of our learning algorithm to compare the results with the heuristic that we were using as a benchmark. The metric selected were <a href="https://en.wikipedia.org/wiki/Mean_absolute_error">Mean Absolute Error</a> (MAE), <a href="https://en.wikipedia.org/wiki/Root-mean-square_deviation">Root Mean Squared Error</a> (RMSE) and <a href="https://en.wikipedia.org/wiki/Mean_squared_error">Mean Squared Error</a> (MSE).</p><p>Running this evaluation metrics using scikit learn was quite simple:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bH72FtJuY-78b3MWKcuWWA.png" /></figure><p>The evaluation metrics for the <strong>benchmark</strong> algorithm return the following results:</p><ul><li>Mean Absolute Error:<strong> 2.44 crates.</strong></li><li>Root Mean Squared Error: <strong>2.82 crates</strong></li><li>Mean Squared Error: <strong>7.96</strong></li></ul><p>Plotting the prediction and actual data we get the following plot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*ISWAtobUf4nWwQ0prZExNA.png" /></figure><p>So, now we knew where the bar was and therefore, we were able to figure out if our ML based approach would be worthwhile or not.</p><p>For the <strong>linear regressor</strong> we got the following results:</p><ul><li>Mean Absolute Error: <strong>1.16 crates</strong>.</li><li>Root Mean Squared Error: <strong>1.66 crates</strong></li><li>Mean Squared Error: <strong>2.76</strong></li></ul><p>We also can also plot how well match real values with the prediction</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qtyO8V83MsVGmMHCbzBmug.png" /></figure><p>Plotting the prediction and actual data we get the following plot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*VaqbqwEEauBFjDEq-Nv48Q.png" /></figure><p>Results looks great!, since the error was much lower using the ML approach compare with the benchmark, which means that we were able to reduce the error of getting more crates than needed to prepare a given order.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=843551f80f8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[¿Por qué no hay SEO en Mercadona Online?]]></title>
            <link>https://medium.com/@joseperezaguera/por-qu%C3%A9-no-hay-seo-en-mercadona-online-128f5f3a863c?source=rss-2ac0c346e62e------2</link>
            <guid isPermaLink="false">https://medium.com/p/128f5f3a863c</guid>
            <category><![CDATA[definición-de-producto]]></category>
            <category><![CDATA[mvp]]></category>
            <category><![CDATA[ecommerce]]></category>
            <category><![CDATA[mercadona]]></category>
            <category><![CDATA[product-manager]]></category>
            <dc:creator><![CDATA[Jose Ramon Perez Agüera]]></dc:creator>
            <pubDate>Wed, 07 Nov 2018 15:24:18 GMT</pubDate>
            <atom:updated>2018-11-07T18:51:54.701Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y0yeHSd4-bydbRUqIs1PHQ.png" /></figure><p>Tras nuestra salida a producción una de las principales críticas a nuestro trabajo giró en torno al hecho de que habíamos ignorado cualquier tipo de funcionalidad relacionada con el posicionamiento en buscadores. Ahora, una vez calmadas las aguas y habiendo digerido todas las lindezas que nos dijeron por este hecho voy a intentar explicar la reflexiones detrás de esta decisión, ya que creo que es un buen ejemplo de la dificultad de definir un MVP cuando construimos un producto desde cero, teniendo siempre en mente los principios de la metodología Lean.</p><p>Como dijo un sabio, no se puede entrar en un proyecto con una lista ordenada de las funcionalidades a implementar, hay que entender el negocio, el contexto, el timing y tener muy clara la visión concreta del producto que se quiere poner en la calle y sobre todo, siempre, poner al usuario (el jefe) en el centro de todas las decisiones. Así pues en lugar de tirar de <em>“las 15 funcionalidades que tu ecommerce debe tener”</em> nos hicimos las siguientes preguntas</p><p><strong>¿Tiene Mercadona un problema de reconocimiento de marca?</strong></p><p>Mercadona tiene una cuota de mercado del 24%. El 90% de los usuarios que compraron alimentación durante el último año en España compraron al menos una vez en Mercadona. En la parte de online, Mercadona tiene un 46% de cuota de mercado, teniendo en cuenta que el mercado de alimentación online en España es un 1% del total de mercado de alimentación. Además Mercadona tiene actualmente 1627 tiendas en España basadas en un modelo de tienda de proximidad, por lo que se encuentra muy presente en el día a día de los españoles y está posicionada en el top-of-mind de los usuarios en lo que a alimentación se refiere en nuestro país. A partir de estos datos llegamos a la siguiente conclusión:</p><blockquote>Aunque se podía mejorar, el reconocimiento de marca no era el problema principal que teníamos que resolver en nuestro MVP.</blockquote><p><strong>¿Cuál es el solapamiento del surtido de Mercadona con el de su competencia?</strong></p><p>Mercadona sigue un modelo de surtido corto, con alrededor de 7000 referencias en su catálogo, lo cual difiere de modelos como Carrefour que se basan en un surtido largo con en torno a 30K referencias en su catálogo. Por otro lado el 60% del surtido de Mercadona es propio, por lo que no hay una competencia directa con el surtido de la competencia ni una necesidad de posicionamiento tan grande. Esto es distinto, por ejemplo, al caso que nos podemos encontrar en otro tipo de e-commerce como Amazon, Carrefour, Día, etc, donde sí existe una competencia directa para llamar la atención del usuario sobre los mismos productos utilizando distintos canales. Nuestro hummus o nuestro guacamole solo lo vendemos nosotros, y todos sabemos que si pruebas el guacamole de Mercadona ya no quieres otro ;-)</p><blockquote>En función de estas consideraciones decidimos que aunque la parte de posicionamiento podía tener cierto valor tampoco era el principal problema que había que resolver y más teniendo en cuenta que Mercadona es capaz de generar cierta viralidad con muchos de sus productos de manera orgánica.</blockquote><p><strong>¿Tiene Mercadona online un problema de adquisición de clientes?</strong></p><p>En este caso analizamos el flujo de clientes. Mercadona online con su canal antiguo de e-commerce tiene un 46% de cuota de Mercado con 650K usuarios registrados. El flujo de usuario nuevos es bueno ya que el 18% de los usuarios registrados lo hicieron en el último año.</p><p>Por supuesto siempre se puede mejorar la estrategia de adquisición pero tampoco vimos que con estos datos hubiera un problema grave en ese sentido. Además en este punto pensamos que nos podíamos apalancar de salida en el crecimiento de Mercadona offline, ya que el año pasado con una cuota del 24%, creció un 1.2%. Para que os hagáis una idea el segundo en la lista que es Carrefour, tiene una cuota del 8.5% y creció un 0.8%. Es decir Mercadona no solo es líder del mercado sino que además es el player que más crece YoY.</p><p>Con este escenario parecía bastante claro que este tampoco era el problema principal que teníamos que resolver.</p><blockquote>Tened en cuenta que definir un MVP normalmente no va de añadir funcionalidad sino de quitarla, es fácil pensar en todas las funcionalidades que uno quiere en su producto, lo difícil es quedarte con aquellas que maximizan la consecución de tus objetivos.</blockquote><p><strong>¿Tiene Mercadona online un problema de recurrencia?</strong></p><p>Cuando analizamos la recurrencia encontramos los datos siguientes. El 50% de los usuarios activos del canal antiguo de Mercadona online se registraron antes de 2013. El ratio de pedidos por usuario para una ventana de 12 semanas era de 1.3 pedidos lo cual es bastante poco. Para los usuarios registrados a los largo del último año este ratio caía hasta el 0.7 lo cual implica un rebote muy alto por parte de los nuevos usuarios. El gap de usuarios activos entre 2013 y 2016 era enorme, ya que el 68% de los usuarios activos o eran anteriores al 2013, fundamentalmente power users de la marca, o eran del 2017, es decir gente que llega prueba y no vuelve. El 32% de usuarios restantes se repartía entre 2014 y 2016 lo que es una caída de usuarios importante para un periodo de tres años.</p><p>Nuestra conclusión fue que el problema más importante que debíamos resolver era la recurrencia, no porque no hubiera margen de mejora en las otras áreas, sino porque era la mejor decisión en términos de esfuerzo-beneficio y sobre todo porque era donde más se estaba resintiendo el modelo online de Mercadona.</p><blockquote>Cómo bien había dicho nuestro presidente, nuestra experiencia de compra online era una mierda.</blockquote><p>A partir de aquí nos centramos en 5 áreas de trabajo:</p><ul><li><strong>Buscador</strong> para permitir que el usuario encuentre los productos que quiere comprar de la manera más rápida y cómoda posible.</li><li><strong>Sistema de Recomendación personalizado</strong> para el cálculo del carrito más probable dado un usuario, lo que llamamos <em>Mis Habituales</em>, un algoritmo que aprende de tus compras anteriores. Una especie de repetir compra con esteroides.</li><li><strong>Frictionless Checkout:</strong> Poniendo especial foco en pedir únicamente la información necesaria y aportar claridad en puntos de especial fricción, como el momento de pago, la dirección de entrega o la selección de tramos de envío. (El ratio de conversion actual de nuestro flujo de checkout es del 69%)</li><li><strong>Compra en Grid/Listado:</strong> Este punto fue muy importante y nos dimos cuenta durante la fase de research ya que, de inicio, si hubiéramos ido con la <em>Laundry List</em> del e-commerce, nos lo hubiéramos comido de lleno. Aunque en el modelo tradicional de e-commerce tipo Amazon la <em>product detail page</em> es de lejos el elemento más importante de cara a la conversión, cuando se tiene un tamaño grande de carrito (130 euros de media, 45 productos únicos, 65 unidades, productos que se compran de forma recurrente) la compra vía grid/o listado, ya sea en el buscador o en las categorías, cobra una gran importancia. Para que os hagáis una idea en la nueva Web de Mercadona Online el 93% de los productos que se añaden al carrito, tanto en búsquedas, como en categorías, como en home, como en <em>Mis Habituales</em> son añadidos desde el grid y solo el 7% se añaden desde la <em>product page</em>. Una inversión de esfuerzo en una <em>product page</em> compleja (muy importante también en términos de posicionamiento SEO) con ingredientes, recetas y demás historias hubiera sido, por tanto, un esfuerzo grande para un beneficio muy pequeño.</li><li><strong>Velocidad de carga:</strong> Este factor aunque muy técnico tiene un impacto enorme en la conversión y más en un tipo de compra como la nuestra donde la mera creación del carrito es un trabajo costoso y pesado para el usuario. Esta tarea consume muchos recursos de ingeniería pero creo que sin duda es de las mejores inversiones que se pueden hacer en un e-commerce.</li></ul><blockquote>La priorización de todas estas áreas de cara a resolver el problema de la experiencia de compra y por lo tanto de la recurrencia, junto con que mientras se creaba el producto se estaba formando el equipo de Mercadona Tech hizo que toda la parte de Marketing online y en particular la de SEO fuera despriorizada, que no ignorada.</blockquote><p>Soy partidario de resolver un problema a la vez, creo que es la clave para aportar foco a los equipos, priorizar adecuadamente y aplicar técnicas de time boxing para hacer justo lo que se necesita, ni más ni menos, algo clave cuando estás trabajando en un MVP.</p><p>La principal dificultad de este enfoque de <em>resolver un problema cada vez</em> es precisamente detectar dónde está el problema más importante y con más impacto que hay que resolver, de ahí el análisis cuyo resumen he presentado en forma de preguntas al principio de este artículo.</p><p>Otras de las preguntas con las que nos crucificaron en su momento y que de vez en cuando algún iluminado nos sigue haciendo en forma de crítica obsesiva y pertinaz fue ¿por qué no utilizar un framework ya hecho como base?. Existen muchas opciones, tanto de código abierto, Magento, Prestashop, como de pago ATG, SAP Hybris, etc.</p><p>Para nosotros hacer software es como hacerse un traje, si tienes dinero y tiempo te lo haces a medida, sino compras uno genérico y lo adaptas, te arreglas las mangas, el tiro y das el pego. Esto tiene una serie de trade offs que impactan fundamentalmente en la calidad del producto final, la cual siempre será mayor con una solución a medida, siempre y cuando se tenga un equipo técnico competente. Para nosotros la toma de decisiones en este punto se basa en el siguiente esquema:</p><p>Existen tres variables que se deben manejar al definir y construir un producto:</p><ul><li>Calidad</li><li>Time to market</li><li>Funcionalidad</li></ul><p>La calidad nunca se compromete, y el time to market en ocasiones no es negociable, por lo que todo el juego se centra en elegir correctamente la funcionalidad y aquí la capacidad de definir bien cuál es el MVP es la clave.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=128f5f3a863c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>