<?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 Diegooctavioperez on Medium]]></title>
        <description><![CDATA[Stories by Diegooctavioperez on Medium]]></description>
        <link>https://medium.com/@diegooctavioperez21?source=rss-5cf7f99e899e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*N_usW6se9tu4WPwj</url>
            <title>Stories by Diegooctavioperez on Medium</title>
            <link>https://medium.com/@diegooctavioperez21?source=rss-5cf7f99e899e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 11:15:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@diegooctavioperez21/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[I coded a multi-layer neural network only using Numpy]]></title>
            <link>https://medium.com/@diegooctavioperez21/i-coded-a-multi-layer-neural-network-only-using-numpy-a84e42e3acf7?source=rss-5cf7f99e899e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a84e42e3acf7</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Diegooctavioperez]]></dc:creator>
            <pubDate>Sun, 01 Sep 2024 17:13:41 GMT</pubDate>
            <atom:updated>2024-09-29T16:27:25.179Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MTS-3TSLlQ-65Nb7lE2wMg.png" /></figure><p>I started reading the book <em>Deep Learning for Vision Systems by Mohamed Elgendy. After</em> comprehending the math behind it I decided to build a neural net from scratch to prove myself that I understood it, and like in most articles, I’ll explain the code in the same order the class is created</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4ba5888579c6ffe70c3378f165fbaa7f/href">https://medium.com/media/4ba5888579c6ffe70c3378f165fbaa7f/href</a></iframe><p>Our Network class should receive an array where each element represents a layer. It’s important to note that the first layer is our input layer and therefore doesn’t need an activation function, however, it’s important to make sure the number of nodes on your first layer matches with your X’s number of features. In this example, we receive an X with 2 features in each record.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d2f0662b1cfac43381b9943ea15fffb/href">https://medium.com/media/3d2f0662b1cfac43381b9943ea15fffb/href</a></iframe><p>These are the first methods of the class.</p><p>On the <strong>__init__</strong> method we are making sure that the layers&#39; information is passed when creating the class and then we’re building the net&#39;s weights(edges) and biases. I’ll expand on the <strong>initialize_weights</strong> method later.</p><p>The other methods are mathematical functions and their derivatives except for the last method, <strong>functionsMapping, </strong>which only asks for the function name and returns a dictionary with structured data containing both the normal function and its derivative; this will help us if we want to add different functions to our net in the future.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0223f9164be63015d80d106473e4403/href">https://medium.com/media/c0223f9164be63015d80d106473e4403/href</a></iframe><p>The <strong>initialize_weights </strong>method loops through all the layers in the net and for each one:</p><ul><li>Creates a weights matrix of random numbers from a normal distribution with (n,m) shape, where n is the number of nodes on the current layer[i] and m is the number of nodes in the next layer(i+1)</li><li>Multiplies the matrix to only get small numbers for efficiency</li><li>Creates a biases matrix of zeros with shape (n,1) where n is the amount of nodes in the current layer[i]</li><li>Adds both matrixes to their respective array</li><li>Does the same for all the other layers</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bec24077dd0270450850ac73b870602c/href">https://medium.com/media/bec24077dd0270450850ac73b870602c/href</a></iframe><p>The feedforwarding does a dot product between the weights matrix and the activation layers and uses the results as an argument of the function of the layer. Finally, the function returns the final state of all nodes in the net after computing all the dot products between all layers and their respective weights. The if else code in the functions is because the first layer is the input layer and it’s not computed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ZnIvgIq5wR3Ijj0l0vibg.png" /><figcaption>Reduction of what’s happening for each loop in the code. Multiplying the weights by the previous layer nodes and then adding the bias, finally introducing that to the functions (relu, sigmoid, etc.)</figcaption></figure><p>Then, we’ll create this method that would help to calculate the MSE (Mean Squared Error)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/84ed4eb8d4becde440937a624674079f/href">https://medium.com/media/84ed4eb8d4becde440937a624674079f/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*oqhKfHmwlSsSh2igwtUYaQ.png" /></figure><p>Now, the most important piece of neural nets: <strong>backpropagation</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/61afe420fe1c9ce69574e510c221d64f/href">https://medium.com/media/61afe420fe1c9ce69574e510c221d64f/href</a></iframe><p>This is the most complex part of a net, so please bear with me. First, we initialize 2 matrices with the same size as our weights and biases matrixes, then, we calculate the prediction vs the real Y, and finally, we loop through all layers starting from the last one and doing the following in each loop:</p><ul><li>Parse the activation layer’s values through the derivative of the layer’s activation function. The derivative value indicates how much the value would increase/decrease when changing a weight’s value</li><li>Make an element-wise multiplication of the derivative by the delta, so we can make a bigger change to the values that are the farthest from the prediction and the ones that would make more impact on the function. We can think of this as how each record is asking the net to adjust itself to be closer to its objective(y)</li><li>Then we average how all the records on the dataset want to change each weight and bias and that’s how we get weight and bias gradients</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b7012358aee9de6800731c5086e72935/href">https://medium.com/media/b7012358aee9de6800731c5086e72935/href</a></iframe><p>We put everything together and repeat the same process for the number of epochs.</p><p>This loop computes the feedforwarding with the current weights, then backpropagates to compute how much to change the weights and biases need, and then updates the weights by subtracting the product of the gradient by the learning rate to the weights matrix. The learning rate indicates how long you want the derivative step to be. How far from the point we calculated the slope (derivative) last time do you want to be this time?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a224150611c1fce890bf050f7776069/href">https://medium.com/media/9a224150611c1fce890bf050f7776069/href</a></iframe><p>Finally, we have the predict method which computes the feedforwarding with the current nodes, weights, and biases values.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d51c14940f748f28c970682fc7541e3/href">https://medium.com/media/9d51c14940f748f28c970682fc7541e3/href</a></iframe><p>We instance the class and train the network, so we can then predict the values and plot the loss function and we get this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aB-veTPkepWXS85DOxJxYQ.png" /><figcaption>The loss function is smooth because of the synthetic dataset</figcaption></figure><p>If you read through here, thanks a lot! Feel free to reach me for any questions and you can find the full code <a href="https://github.com/octaviodiego78/Deep-Learning/blob/main/Neural%20Nets/multilayer_neural_network.ipynb">here</a> :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a84e42e3acf7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Teaching a Neural Net how to play Monopoly — Pt. 1. Simulating the game]]></title>
            <link>https://medium.com/@diegooctavioperez21/teaching-a-neural-net-how-to-play-monopoly-pt-1-simulating-the-game-5eb2104b1f61?source=rss-5cf7f99e899e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5eb2104b1f61</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[board-games]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <dc:creator><![CDATA[Diegooctavioperez]]></dc:creator>
            <pubDate>Sun, 16 Jun 2024 22:31:26 GMT</pubDate>
            <atom:updated>2024-06-16T22:31:26.547Z</atom:updated>
            <content:encoded><![CDATA[<h3>Teaching a Neural Net how to play Monopoly — Pt. 1. Simulating the game</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mKJDkLC1YEwFmNHzF7JL5A.png" /></figure><p>Hey all! I’m back with another side project I wanted to make to practice classes and attributes on Python by simulating Monopoly, my favorite board game. I knew that if I wanted to train a neural net to play it, I needed a lot of data simulating the game&#39;s state on each player&#39;s turn, so I did it.</p><p>I will drive you through the code in the order it is executed, but if you want to see the order in which it was written, you can see the full code <a href="https://github.com/octaviodiego78/monopoly"><strong>here</strong></a>.</p><p>First, there’s a main function that runs 3000 times and whose only attribute is the number of players the game will have. This function:</p><pre>def main(n_players):<br><br>    #Creating players<br>    players = []<br><br>    for i in range(n_players):<br>        players.append(Player(i,[]))<br><br>    #Monopoly creating<br>    monopoly = Monopoly(players)<br>    <br>    <br>    while min([p.money for p in monopoly.players]) &gt; 0:<br><br>        monopoly.round(players)<br><br>    winner = monopoly.results.tail(n_players).groupby(&#39;player_number&#39;).max()[&#39;money&#39;].sort_values(ascending=False).index[0]<br>    return monopoly.results.loc[(monopoly.results[&#39;player_number&#39;] == winner) &amp; (monopoly.results[&quot;is_special_position&quot;] == False)]<br><br><br><br>if __name__ == &#39;__main__&#39;:<br>    df = pd.DataFrame(<br>            columns = [&quot;player_number&quot;,&quot;last_position&quot;,&quot;dice&quot;,&quot;current_position&quot;,&quot;jail&quot;,&quot;is_special_position&quot;,&quot;money&quot;,&quot;properties&quot;,&quot;networth&quot;<br>                       ,&quot;owned_properties_price&quot;,&quot;owned_properties_houses&quot;,&quot;rent_to_charge&quot;,&quot;percentage_of_owned_properties&quot;,&quot;railroads_owned&quot;<br>                       ,&quot;properties_available&quot;,&quot;buy&quot;,&quot;money2&quot;,&quot;properties2&quot;,&quot;networth2&quot;,&quot;owned_properties_price2&quot;,&quot;owned_properties_houses2&quot;<br>                       ,&quot;rent_to_charge2&quot;,&quot;percentage_of_owned_properties2&quot;,&quot;railroads_owned2&quot;,&quot;properties_available2&quot;])<br>    start = time.time()<br>    for _ in range(3000):<br>        df = pd.concat([df, main(3)], axis=0)<br>    print(time.time() - start)<br>    print(len(df))<br>    df.to_csv(&quot;results.csv&quot;)</pre><ul><li>Creates <strong><em>n</em></strong> <strong>Player</strong> objects, with the same attributes for all of them.</li></ul><pre>class Player():<br><br>    def __init__(self, playerNumber: int, properties: list[&quot;Property&quot;]) -&gt; None:<br>        self.playerNumber = playerNumber      <br>        self.properties = properties<br>        self.money = 2500  <br>        self.land_value = 0<br>        self.position = 0<br>        self.jail = False<br>        self.railroads = 0<br>        self.houses = 0<br>        self.rent_to_charge = 0</pre><ul><li>Creates a <strong>Monopoly</strong> object based on the <strong>Player</strong> objects. The init method of this class assigns the array of <strong>Players</strong> to a variable, creates a results variable that would later help us store the winner’s decision record, and converts all JSONs from the utils folder into <strong>Property</strong> objects</li></ul><pre>properties = [Property(**pm) for pm in getSquaresInfo()]</pre><pre>def getSquaresInfo():<br><br>    squaresInfo = [<br><br>        {&#39;squareId&#39;: 0, &#39;isSpecialSquare&#39;: True, &#39;owner&#39;: None, &#39;name&#39;: None, &#39;price&#39;: None, &#39;rent&#39;: None, &#39;rentWithHouses&#39;: None, &#39;costPerHouse&#39;: None, &#39;houses&#39;: 0}<br>        ,{&#39;squareId&#39;: 1, &#39;isSpecialSquare&#39;: False, &#39;owner&#39;: None, &#39;name&#39;: &#39;Mexico&#39;, &#39;price&#39;: 50.0, &#39;rent&#39;: 5.0, &#39;rentWithHouses&#39;: [13.0, 26.0, 39.0, 52.0, 65.0], &#39;costPerHouse&#39;: 10.0, &#39;houses&#39;: 0}<br>        ]</pre><pre>class Property():<br>    def __init__(self, **kwargs) -&gt; None:<br>        for k,v in kwargs.items():<br>            setattr(self, k, v)</pre><ul><li>Calls the <strong>Monopoly<em>.round()</em></strong> method until one player gets out of money</li><li>Gets a winner based on the maximum amount of money</li><li>Returns a df csv with the previous and actual state of the winner after a certain decision on each of their turns. This would help to train the NN by measuring the impact of their decision, a binary value.</li></ul><p>Now that we know what happens with the main function, it’s time to know what the .<strong><em>round()</em></strong> method does. Basically, the .<strong><em>round() </em></strong>method only loops the <strong><em>.turn()</em></strong> method <strong>n</strong>(players) times for each round, which does the following:</p><ol><li>Evaluates if the player is in jail, if it is, the turn is skipped and a record is added to the results df. Each turn of the player returns a df row that contains a Q table, a binary decision, and a Q+1 table. I’ll later show the table and what it means. Each turn could mutate the amount of money, amount of properties, houses of each property, rent, etc.</li><li>Rolls the dice and evaluates the new board position</li></ol><pre>dice = self.roll_dice()      <br>player.position = (player.position + dice) % 40</pre><p>3. Checks if the player has completed a round and gives them $200 if they have.</p><pre>if player.position &lt; lastPosition:<br>player.money +=  200</pre><p>4. Evaluates surprise conditions if they have fallen in a special square of the board</p><pre>  if self.properties[player.position].isSpecialSquare == True: #Special squares logic<br>    #Jail -------------------------------&gt;<br>    if player.position == 10:<br>        player.jail = True<br>    <br>    elif player.position == 30:<br>        player.jail = True<br>        player.position = 10<br>    <br>    #Chance Cards -----------------------&gt;<br>    if player.position in (2,7,17,22,33,36):<br>        player.money += random.choice(self.chanceCards)<br>    <br>    #Taxes ------------------------------&gt;<br>    if player.position == 4:<br>        player.money -= 200<br>    <br>    if player.position in (12,29):<br>        player.money -= 150<br>    <br>    if player.position == 38:<br>        player.money -= 100</pre><p>5. Checks if the player is in a railroad square, if they need to pay, or if they want to buy it.</p><pre>if player.position in (5,15,25,35): #If position is a railroad<br>                    <br>  if currentProperty.owner != player: #If the owner of the railroad is not the player<br>      if currentProperty.owner == None:  #if no one is the owner<br>          if player.money &gt; currentProperty.price and choice: <br>              currentProperty.owner = player<br>              player.money -= currentProperty.price<br>              player.railroads += 1<br>      else:<br>          rentToPay =  currentProperty.owner.railroads*50<br>          currentProperty.owner.money += rentToPay<br>          player.money -= rentToPay</pre><p>6. Checks if the player is on their own <strong>Property</strong> and wants to add a house to it.</p><pre>if currentProperty.owner == player: #Simulating the player decision to add a house or many  to the property    <br>#For properties with less than 5 house<br>#Only is your simulated descition to buy a house is True<br>#If you have enough money for houses<br>    propertyHouses = currentProperty.houses<br>    if (5 - propertyHouses) &gt; 0 and (player.money &gt; currentProperty.costPerHouse) and choice: <br><br>        <br>        currentProperty.houses += 1  #Update amount of houses on property<br>        player.money -= currentProperty.costPerHouse  #Pay for the houses<br>        currentProperty.rent = currentProperty.rentWithHouses[currentProperty.houses -1]   #Set rent to the price with n houses</pre><p>7. If no one is the owner, you can buy the property.</p><pre>if currentProperty.owner == None:  #buying the property<br>    if choice: <br>        player.money -=  currentProperty.price #Pay for the property <br>        currentProperty.owner = player #Update property owner<br>        player.properties.append(currentProperty) #Add property to player&#39;s properties</pre><p>8. Lastly, if the <strong>Property</strong> has an owner, you pay for the rent</p><pre>else: #Paying rent to the owner<br>    rentToPay = currentProperty.rent<br>    player.money -= rentToPay<br>    currentProperty.owner.money += rentToPay</pre><p>9. After each turn, a row is added to the final df, so that we can track:</p><pre>S(t) + A(t) = S(t+1)</pre><p>This means that for each turn I’m tracking the actual state of the game, their decision, and the state of the game after their decision, hoping this could be enough to train the neural net.</p><p>Stay tuned for part 2 and you can reach me by <a href="https://medium.com/@diegooctavioperez21">Medium</a>, <a href="https://github.com/octaviodiego78">Github</a>, or <a href="https://www.linkedin.com/in/operezurb/">Linkedin</a> if you have any suggestions/questions</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5eb2104b1f61" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[El privilegio de soñar]]></title>
            <link>https://medium.com/@diegooctavioperez21/el-privilegio-de-so%C3%B1ar-4e04fe3bf1b6?source=rss-5cf7f99e899e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e04fe3bf1b6</guid>
            <category><![CDATA[human-rights]]></category>
            <category><![CDATA[college]]></category>
            <category><![CDATA[mexico]]></category>
            <category><![CDATA[humanity]]></category>
            <category><![CDATA[youth]]></category>
            <dc:creator><![CDATA[Diegooctavioperez]]></dc:creator>
            <pubDate>Fri, 07 Jun 2024 00:57:36 GMT</pubDate>
            <atom:updated>2024-06-07T00:57:36.644Z</atom:updated>
            <content:encoded><![CDATA[<p>Desde el año 2015 <strong>283,936 </strong>personas han sido asesinadas en México más las <strong>95,900 </strong>que han sido desaparecidas desde 2006. Tan solo en 2022 se le arrebato la vida a <strong>32,223 </strong>personas; si usáramos la misma tasa de asesinatos por 100 mil habitantes, en el ITESO habría aproximadamente 3.75 personas asesinadas por semestre. ¿Pero, porque este dato no nos hace estar fúricos cada que nos levantamos? ¿Porque no nos levantamos cada día con miedo de ir a la universidad? Creo que la respuesta correcta es: porque no pasa, porque no asesinan a 7 estudiantes del ITESO por año, porque dentro de los fraccionamientos exclusivos de la ciudad donde vivimos hay una probabilidad muchísimo menor de ser asesinado, porque dentro de nuestro carro particular sientes más seguridad que la persona que camina a su casa de noche porque no tiene otra opción.</p><p>En México existe una sola realidad y existe otra realidad alternativa, menos roja, a la que nuestra clase social puede acceder. Una de las frases que más resonan en mí después del documental son “¿Qué hubiera pasado si los papas de Jorge o Javier fueran personas poderosas? Creo que esta pregunta pone en evidencia parte fundamental de lo que yo creo que es el problema principal de la falta de cambio ante esta imponente situación: las mayoría de las personas que viven de cerca estas situaciones de muerte y desapariciones son personas sin voz, personas que tienen que seguir su día sin importar la cantidad de muertos diarios, personas que tienen que salir a la calle al día siguiente de sufrir un asalto porque no tienen otra opción, sus circunstancias y nuestros privilegios los limitan de tener más opciones distintas a solo seguir con su vida. Como decía una de las entrevistadas “Yo me he negado a autoimponerme una especie de toque de queda…porque no podía hacer otra cosa, no hubiera podido trabajar”. Incluso, me atrevo a decir que las personas que están del otro lado del fusil del ejercito son en parte producto de condiciones precarias de un país como México, donde más de la mitad de sus habitantes viven debajo de los límites de pobreza. Para mí es difícil encontrar cierta manera de justificación de personas que asesinan a sangre fría ya que el crimen ha acariciado a familia cercana a mí, pero tampoco puedo cerrar los ojos a al hecho de que, para muchas personas con situaciones precarias, el narcotráfico puede ser su única manera de tener una voz en un país donde se descarta a los que no tienen poder.</p><p>Según estadísticas de la Encuesta Nacional de Seguridad Pública Urbana 2023 el 62% de la población siente que su ciudad es insegura, 51.4% manifestó evitar llevar cosas de valor por temor a sufrir algún delito, 44.6 % dijo ya no caminar por los alrededores de su vivienda después de las ocho de la noche y 43.6% reconoció haber hecho cambios en cuanto a permitir que sus hijos menores salgan de su vivienda debido a la inseguridad.</p><p>A pesar de eso el porcentaje de personas que percibieron el desempeño de las autoridades como muy o algo bueno fueron: 85.6% para la Marina, 82.5% para el ejército y 73.6% para la guardia Nacional. Para ser un país con 83 asesinatos en promedio por día, me sorprendieron los números de aprobación y creo que pueden ser debido a 2 cosas: poca memoria o la pérdida del tacto respecto a la magnitud de la violencia en nuestro país a causa de la fricción con la violencia en nuestro día a día.</p><p>No obstante, personalmente repruebo el actuar de los militares en hechos recientes como Ayotzinapa o el mismo caso de Jorge y Javier en el cual quiero ahondar. El hecho de que no haya habido un solo alto mando sentenciado por el asesinato de 2 estudiantes es la clara razón del porque los militares se sienten con la total libertad de falsificar una escena e incluso dejar los cuerpos un metro alejado de donde habían muerto, la misma razón por la que los elementos de la Guardia Nacional se sienten cómodos rompiendo la ley haciendo detenciones arbitrarias día a día.</p><p>Junto a esto, la ineficiencia de las autoridades para <em>sancionar y reparar las violaciones a los derechos humanos </em>es paralizante; un sistema judicial donde las acciones de las autoridades se juzguen de acuerdo con la ley parece muy lejano. A esto, si le sumamos el poder que expresidentes y el actual presidente le ha dado a las fuerzas armadas, hace difícil imaginar un México justo, donde todos se sientan seguros con las fuerzas armadas. Y parte de porque siguen pasando estas injusticias es porque no pasa nada, porque la mayoría de las personas no tiene voz, y las personas que la tienen no la usan más que para fines propios.</p><p>En el caso de Jorge y Javier, el Tec de Monterrey es un reflejo de este último grupo mencionado el cual vela por los intereses del poder y no de los estudiantes. Sin ahondar en temas económicos, actualmente el poder fluye en la misma dirección que el capital y no hay nada más definitivo en tu vida que el capital. Me atrevo a decir que: más que tu género, raza,</p><p>o nacionalidad, tu poder adquisitivo será lo que más definirá tu vida, y es por eso por lo que las grandes acumulaciones de capital moldean las formas en las que vivimos. Es por eso por lo que el Tec decidido <em>pensar en el futuro en vez de recordar el pasado</em>, porque no los convenia perder matriculas ni estudiantes extranjeros; ser leal al capital y ser ético es algo que normalmente no va de la mano, es por eso de gran importancia y creo yo parte fundamental del cambio, que el poder se combata con poder.</p><p>A lo que me refiero con esto y con lo que me gustaría concluir, es con un llamado al poder, y con poder me refiero a la gente que se siente segura en sus casas, a las personas que no han sufrido el asesinato de alguien cercano, a las personas que viajan sin miedo a su universidad, y sobre todo a las personas que tienen voz.</p><p>Creo que nuestra responsabilidad como personas que tienen voz es, mas que ser la voz de las personas que no la tienen, dar voz a esas personas. Me parece hasta un acto egoísta no usar los privilegios que tenemos para mejorar la vida de las personas que no tienen los mismos privilegios por el simple hecho de haber nacido en circunstancias diferentes a nosotros.</p><p>Sin importar de donde venga cualquier persona, cual sea su trabajo, cuanto gane, quienes sean sus papas, creo que el estado y nosotros como ciudadanos tenemos que ser responsables de asegurarnos que a ninguna persona de este país le sea arrebatado el privilegio de soñar.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e04fe3bf1b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I have a bunch of photos of my dog so I build a CNN to see when he appears in a video.]]></title>
            <link>https://medium.com/@diegooctavioperez21/i-have-a-bunch-of-photos-of-my-dog-so-i-build-a-cnn-to-see-when-he-appears-in-a-video-81c304085c33?source=rss-5cf7f99e899e------2</link>
            <guid isPermaLink="false">https://medium.com/p/81c304085c33</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[dogs]]></category>
            <dc:creator><![CDATA[Diegooctavioperez]]></dc:creator>
            <pubDate>Mon, 22 Jan 2024 05:37:04 GMT</pubDate>
            <atom:updated>2024-01-22T05:37:04.691Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome again to practicing my storytelling talking about projects I make. This time I made a <strong>Convolutional Neural Net</strong> for binary classification; I won’t talk a lot about the model since I’ll talk more about working with videos and images.</p><p>But, before starting I want to <strong>thank my friends for sending me photos of their pets</strong> to train my model. Shoutout to them!</p><p>Let’s start with the code. There’s a main function that receives the video and outputs a list of the seconds in which Lucas (my dog) appears and each one of the frames that led to that conclusion. The video I used for testing is Lucas running in a park.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*n5kjjDC1Xt4hQnvxNCnhvA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kfBg1JMy8xRkLXwKYfAwog.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uxk0DrsE9mRJMQk7HsiNWA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L5mwnqxiznViMJG410We-g.jpeg" /></figure><p>And, to show that this isn’t fake, here are some other frames where Lucas can’t be seen, therefore the probability is low.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*AFn7PmsWVR2c_9dAS-nudw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*ckP6kdvVVHhIWhOarD9vaw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*cUNdRZRIxGqyuzZZQJ4j6A.jpeg" /><figcaption>Frames and their probability of being from class 1</figcaption></figure><p>The main function receives a video, a trained model, and a threshold. First, the function reads the video. A video is a list of lists where each list is an image (256x256x3), which is also a list of lists because it has 3 color channels(BGR), so basically a video is formed of a bunch of lists. The code iterates through all the frames of the video, inputs the frame array to the model, and returns a probability which combined with the threshold is used to decide if Lucas is in the frame. Also, we calculate the second of the video by dividing the frame number by the frames per second and rounding it to the next integer. Each of the seconds is added to a list which then is mutated to a set to get distinct seconds in which Lucas was seen.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/84a4383076ddeb760282135f01f19a1d/href">https://medium.com/media/84a4383076ddeb760282135f01f19a1d/href</a></iframe><p>Finally, this is how I trained the model I used. I have two folders: 1 and 0, so I figured out something to get X and Y to match images and labels</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/041b7260eee3fd4878cb1421734f4e86/href">https://medium.com/media/041b7260eee3fd4878cb1421734f4e86/href</a></iframe><p>I did my train-test split before data augmentation because if I do data augmentation with the whole dataset, that would mean that the model has seen the test data in some way.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a6d8efc2f1fad207468ca13faa69c2f/href">https://medium.com/media/7a6d8efc2f1fad207468ca13faa69c2f/href</a></iframe><p>Finally, the modeling. I can&#39;t stress enough about being careful with the image size: I don’t recommend you train your model with 1024x1024 images: your PC will thank you, and I’m talking from my experience because my kernel got broken several times because of this. One other important tip: You have to make your 3d image into a 4d image to train the model and therefore to input the image before making a prediction when working with color images.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/73ee5b9a5da9afe24a57f0431bcada65/href">https://medium.com/media/73ee5b9a5da9afe24a57f0431bcada65/href</a></iframe><p>I got a .72 accuracy using a .65 threshold to consider the prediction as a class 1 prediction, however, I saw some limitations of the model when predicting frames in which Lucas is in a weird position or when I zoom into his face.</p><p>You can see the full code <a href="https://github.com/octaviodiego78/dogs_classification">here</a>. And if you read all this article, thanks for that!!</p><p><a href="https://github.com/octaviodiego78/dogs_classification">GitHub - octaviodiego78/dogs_classification: Using nn to identify my dog in a video</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81c304085c33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data modeling and fine-tuning with a few lines of code]]></title>
            <link>https://medium.com/@diegooctavioperez21/data-modeling-and-fine-tuning-with-a-few-lines-of-code-3cb7725f1eb7?source=rss-5cf7f99e899e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cb7725f1eb7</guid>
            <category><![CDATA[xgboost]]></category>
            <category><![CDATA[random-forest]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Diegooctavioperez]]></dc:creator>
            <pubDate>Wed, 20 Dec 2023 05:09:07 GMT</pubDate>
            <atom:updated>2023-12-20T05:09:07.932Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJxlDCpKAkwSY4SV1zCYLQ.jpeg" /></figure><p>I’m currently a data science student and for my modeling class. After learning the math behind them, we had to use 3 of all the models and fine-tune them using what we learned in class to make predictions for our final project. Because I also work full time I had to figure out a way to finish it in a couple of hours, so I decided to make a generic function that works for all models. But, as you might know, different models require different things for an optimal performance. So, I used a JSON for each model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3284ebc3fe846295852891c0a725394e/href">https://medium.com/media/3284ebc3fe846295852891c0a725394e/href</a></iframe><p>As seen above, each model has its JSON that is then added to a list. Each JSON has the model object, the scoring method, the hyperparameters grid, and other values that would help us to know how to deal with each model. If you want to compare all models at the same level, using the same scoring method is recommended.</p><p>Next, the modeling function:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f94a8e26ee2a603a9c322b166bd0bb01/href">https://medium.com/media/f94a8e26ee2a603a9c322b166bd0bb01/href</a></iframe><p>The function makes the following steps</p><ol><li>Train-test split</li><li>Scaling</li><li>Feature selection</li><li>Balancing</li><li>Grid Search</li></ol><p>Then, there&#39;s the code for the results</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/633719a065cc3a3e6228df313b8e2c3e/href">https://medium.com/media/633719a065cc3a3e6228df313b8e2c3e/href</a></iframe><p>And, the results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p4ZvBjtT15YjDJUy_IFy6Q.png" /></figure><p>The scores are displayed in a way we can see all the details of the model and even store the object to use it later. Because it was a classification problem for predicting heart diseases it’s important to have a good recall metric to minimize false negatives. To conclude, this is not close to the complete process of what making a model is. There was previous cleaning and there should be a lot of interpretation.</p><p>In this case, XGBoost was the best model and even tho is not as easily interpretable as a logistic regression it can be done.</p><p>You can see the complete project in this repo:</p><p><a href="https://github.com/octaviodiego78/data-modeling-proyect">GitHub - octaviodiego78/data-modeling-proyect</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cb7725f1eb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Estado actual de los derechos laborales en México]]></title>
            <link>https://medium.com/@diegooctavioperez21/estado-actual-de-los-derechos-laborales-en-m%C3%A9xico-c1f461e0a2b9?source=rss-5cf7f99e899e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1f461e0a2b9</guid>
            <category><![CDATA[labor-rights]]></category>
            <category><![CDATA[capitalism]]></category>
            <category><![CDATA[mexico]]></category>
            <category><![CDATA[human-rights]]></category>
            <dc:creator><![CDATA[Diegooctavioperez]]></dc:creator>
            <pubDate>Thu, 23 Nov 2023 06:59:50 GMT</pubDate>
            <atom:updated>2023-11-23T06:59:50.212Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GXtdnnd18mLjJX0F" /><figcaption>Photo by <a href="https://unsplash.com/@lanjohnson?utm_source=medium&amp;utm_medium=referral">Lan Johnson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Después de leer todos los artículos dentro del Pacto de los Derechos Económicos, Sociales y Culturales me di cuenta de lo sencillo que es encontrar lo que no se está haciendo y lo lejos que estamos de cumplir mínimamente con lo propuesto, sin embargo, creo que en los derechos donde más lejos estamos de la meta son los derechos laborales. Aunque la legislación es amplia e incluye derecho al trabajo, a condiciones dignas e incluso a la seguridad social, la realidad del país es otra. Es por eso por lo que este ensayo abordara el estado actual de los derechos laborales en el país y alternativas para mejorar la situación.</p><p>Según datos de la Secretaría de Hacienda y Crédito Publico, en 2020 el 37% de los mexicanos estaban afiliados al IMSS, 6% al ISSSTE, y solo 2% contaban con seguros privados. Uno de los datos preocupantes de este reporte es que, aunque la población aumento, el total de asegurados del IMSS se redujo. Esto se puede deber a ciertos factores, sin embargo, una de las posibles causas más preocupantes es el traslado a la informalidad. Según este mismo reporte, se estima que el 27% no es derechohabiente de ninguna institución, esto equivale a aproximadamente a casi 35 millones de mexicanos en la informalidad (el número es menor si se considera a personas económicamente activas).</p><p>¿Y como la informalidad afecta a las personas? Ester Duflo, en su libro <em>Repensando la Pobreza </em>(Banerjee &amp; Duflo, 2012), lo explica de una manera cruda y con una perspectiva cercana a las personas de bajos recursos. Parafraseando a Ester, el manejo del riesgo para los menos favorecidos es algo sumamente complejo, ya que están a un par de decisiones de terminar en la calle; se puede comparar su manejo del riesgo al trabajo de un <em>hedge fund manager, </em>con la diferencia que los segundos sí tienen la posibilidad de perder dinero sin repercusiones irreversibles en su vida, es por eso que la inestabilidad laboral y la incertidumbre a que algo pueda ocurrir tiene como consecuencia el deterioro de la capacidad de las personas pobres para desarrollar plenamente su potencial. Refiriendo a un ejemplo concreto en el libro: “<em>se ha observado </em>que<em> los hijos de los beneficiarios de PROGRESA, el programa mexicano de transferencias monetarias, tienen niveles significativamente más bajos de cortisol que otros niños cuyas madres no se beneficiaron del programa”</em> (Banerjee &amp; Duflo, 2012). Esto es sumamente preocupante ya que se sabe que el cortisol afecta partes del cerebro esenciales para el funcionamiento cognitivo, especialmente en los niños. En resumen, la incertidumbre causada en parte por el empleo informal hace que los riesgos tomados por las personas sean menores, lo que los lleva a manejar de manera más conservadora sus recursos, aunque sean manejados de maneras menos eficientes.</p><p>Por otro lado, en el sector formal la situación no es menos preocupante. La ley establece que los trabajadores pueden trabajar máximo 8 horas al día, sin embargo, la realidad es que las jornadas de más de 10 horas son algo común. En promedio los mexicanos trabajamos 2,128 horas al año, siendo de los países con más horas laboradas y nada cerca de ser los más productivos. Sumado a eso, aunque se hayan duplicado los días de vacaciones recientemente después de casi decenas de años seguimos siendo de los países con menor número de días libres pagados. La realidad es que, aunque las reformas laborales sean pobres en cuanto a los beneficios de los trabajadores, las empresas siguen estando muy lejos de cumplir con estos mínimos beneficios. En mi opinión, esto seguirá siendo una constante hasta que la impunidad del Estado hacia las empresas se acabé para así lograr monitorear, regular y sancionar empresas que no cumplan con los mínimos requisitos y busquen generar ganancias a costa de reducir los derechos de los trabajadores. Este es un ejemplo muy claro del término <em>impuesto de clase</em> mencionado por Chomsky en el libro <em>Entrevista a Noam Chomsky (</em>1978), el cual consiste en el precio que las empresas están dispuestas a pagar por las consecuencias que la reducción de la democracia y derechos puedan tener en una población; el costo de una economía golpeada es normalmente menor al costo de cumplir con los derechos laborales no reducidos de una población.</p><p>Para concluir, creo que la mayor responsabilidad descansa sobre los hombros de las personas privilegiadas que tenemos condiciones laborales mejores que la mayoría del país, Soy fiel creyente la ecuación para un cambio consiste en gente que alce la voz sumada a gente dentro del poder que logré darse cuenta de las condiciones que ofrece y hacer un cambio desde dentro para poder vivir en un mundo más justos.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1f461e0a2b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I didn’t knew what to learn next, so I did web-scrapping to 900 BI analyst jobs from Glassdoor…]]></title>
            <link>https://medium.com/@diegooctavioperez21/i-didnt-knew-what-to-learn-next-so-i-did-web-scrapping-to-900-bi-analyst-jobs-from-glassdoor-d80a17b5999b?source=rss-5cf7f99e899e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d80a17b5999b</guid>
            <category><![CDATA[bi-analytics]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Diegooctavioperez]]></dc:creator>
            <pubDate>Thu, 21 Jul 2022 04:26:28 GMT</pubDate>
            <atom:updated>2022-07-21T04:26:28.817Z</atom:updated>
            <content:encoded><![CDATA[<h3>I didn’t knew what to learn next, so I did web-scrapping to 900 BI analyst jobs from Glassdoor with Python</h3><p>This summer I’ve been doing some projects for practice, gaining expertise, and especially because I like data analysis. I learned that the best way to learn and reinforce my knowledge is to create something based on it. And I kind of figured out that I love to write, which is also helping with my storytelling. With that being said, let me show you what I found.</p><p>You’ll see the code is divided into 3 scripts although it could be done in a single script, this was because of time efficiency.</p><p>The first script extracts all of the individual job links of the specified search; mine was ‘Business Intelligence Analyst’ in the United States. So if you want to extract information about your job, you just have to change the <em>main_link</em> variable. Feel free to reach me if you need any help.</p><p><strong>Scrapping code</strong></p><p>Imports:</p><pre>import requests<br>from bs4 import BeautifulSoup<br>from selenium import webdriver<br>import time<br>import pandas as pd</pre><p>Log in function: You need to add the Glassdoor username and password to the script so it can work.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d26da6de6b6c3b0506a59ead8609d80/href">https://medium.com/media/0d26da6de6b6c3b0506a59ead8609d80/href</a></iframe><p>Functions:</p><p><strong><em>numberOfPages</em></strong><em> get the number of pages given with the job offers</em></p><p><strong><em>gettingLinksInfo </em></strong>goes to every job offer link on the page and extracts the text of the description</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/09c0bb3543aa77d615d39ed2e846a72f/href">https://medium.com/media/09c0bb3543aa77d615d39ed2e846a72f/href</a></iframe><p><strong><em>pageScrapper</em></strong> creates a soup and calls the said functions all together</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9da0489dcf05c333d40979ac61be9d1c/href">https://medium.com/media/9da0489dcf05c333d40979ac61be9d1c/href</a></iframe><p>Main:</p><p>It logins into the account, opens the main page, scraps it, and then scraps all the pages to get the text of each one so they can be added to a list which would convert into a data frame that we’ll later use.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fb2624cf1685971e2987844a9f2f7b0/href">https://medium.com/media/3fb2624cf1685971e2987844a9f2f7b0/href</a></iframe><p>Then we’ll analyze the unigrams, bigrams, and their frecuency to find the most used technologies using sklearn.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba5b65d0b6889ec5ae393451a801b098/href">https://medium.com/media/ba5b65d0b6889ec5ae393451a801b098/href</a></iframe><p>After getting the information and deserting it, we got the following keywords and the frequency of them in the 930 job offers listed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*r0F2UiJhX_MKVkhsiIJ1aA.png" /></figure><p><strong>Conclusion</strong></p><p>Based on the results, we can affirm that the most requested technologies are SQL, Tableau, and Excel, in that order. And from the bigrams, we got business analysis, communication skills, and a degree.</p><p>If you want to see the full code, you can find it in <a href="https://github.com/octaviodiego78/Glassdoor_scrapping">Github</a>. And if you have any comments or what me to run the script to help you in your job search, feel free to send me a connection request on<a href="http://www.linkedin.com/in/operezurb"> Linkedin</a></p><p>Stay tuned for the second part of the analysis!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d80a17b5999b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[miBici, Guadalajara bike mobility program analysis]]></title>
            <link>https://medium.com/@diegooctavioperez21/mibici-guadalajara-bike-mobility-program-analysis-92a084a26640?source=rss-5cf7f99e899e------2</link>
            <guid isPermaLink="false">https://medium.com/p/92a084a26640</guid>
            <category><![CDATA[mobility]]></category>
            <category><![CDATA[eda]]></category>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[bikes]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Diegooctavioperez]]></dc:creator>
            <pubDate>Fri, 24 Jun 2022 22:15:15 GMT</pubDate>
            <atom:updated>2022-06-24T22:15:15.278Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Diego Pérez</blockquote><blockquote>Disclaimer: This is a personal project and it doesn’t have any relation with the government or any company.</blockquote><p>For context, as a government program, we have the premise that their objective is to increase bike usage on a daily basis, so that will be the investigation objective as well. But to answer the question, we have to ask a couple ofquestions before: who uses the bikes? and how they use it?</p><p>For this article, we’ll be covering information for the first 2022 trimester, which includes information about 980,000 rides that covered 1&#39;454,254 km and about 300 stations located in Zapopan and Guadalajara.</p><h3><strong>Service users.</strong></h3><p>First, we’ll talk about the service users. Of the 16,522 unique users, <strong>66% of users are male</strong>, and from this group, 72% are between 20 and 40 years old. Of women users, 82% are between 20 and 40 years old.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*IE4LqpWJtaEyMY5F-OofwQ.png" /><figcaption>Unique users by age and gender</figcaption></figure><p>Talking about the ride duration, bikes were used a total of <strong>175,363 hours</strong>, from which men from 20 to 40 years represented 52% of total rides duration, and <strong>women of all ages represent just 27.3%</strong> of total rides duration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*xOoDY_s-oLG0Cq590RbuLA.png" /><figcaption>Total ride duration by age. Scientific notation 10x6*</figcaption></figure><h3><strong>Weekday and hour intervals.</strong></h3><p>If we see the information by weekday, we can conclude that Monday and Friday have about the same percentage of total ride duration; rides from <strong>Tuesday to Thursday concentrates 49.26% of the total rides duration.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*YZV444bYcz764gbW9jp9LA.png" /><figcaption>Total ride’s duration percentage by weekday</figcaption></figure><p>Now, it’s time to see the total rides duration by weekday and interval. We can clearly see the high usage trend from Monday to Friday in the shown intervals. <strong>The total ride duration of said intervals represents 28.13%</strong> of the total. And Sunday intervals (8:30 a.m — 13:30) represent 6.27% of the total. If we want to make the assumption that these rides were used to commute to work, first, we have to answer the following question: Are the riders in these intervals, the usual users? And a second question: How Sunday users are different from mid-week users?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tUXcVkjbpjFEaO07EofOIw.png" /><figcaption>Total ride duration by interval</figcaption></figure><p>We categorize usual riders based on 2 conditions: if they have more than 9 rides per week and have ridden in a minimum 10 of the 12 weeks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*YF-mefGx2oDRLfVvnQNkyA.png" /><figcaption>Rides percentage by user type and weekday in previously said intervals</figcaption></figure><p>In previously said intervals, the rides percentage distribution is almost 50/50, even though just 16.02% of the total unique users are usual riders.</p><p>The rides volume on Sundays from 8 a.m to 1 p.m have some differences when compared to the weekly rides: <strong>The men’s rides volume is 3.79 percentual points less</strong>, and the rides volume for people of 20–30 years is 1.42 percentual points more, this means that younger people ride more in Sundays and men ride less on Sundays.</p><p>Also, <strong>Sunday’s average ride duration</strong> (15.71 minutes) <strong>is 5.15 minutes higher </strong>than the week’s average duration.</p><h4>Dark hours</h4><p>We also compared the number of rides by women and men, and classified the rides based on if there was light on the ride (after 7:00 and before 21:00) or not, and we find the following: <strong>On lighted hours, women’s trips represent 27.6%</strong> of the total rides, however <strong>on dark hours, women’s trips represent 22.2%</strong>, a 5.4 percentual points difference. <strong>5.4% of the total dark hour rides represent 5161 rides less.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*wsVWLIbB6rSy6aLsKQ0AoA.png" /></figure><h3><strong>Routes and stations map</strong></h3><h4>Most used stations</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OkpOZ_6fLXTCPfSGRtyzWg.png" /><figcaption>Stations/ Most used stations (red)</figcaption></figure><p>The top 10 most used stations all together held 14.15% of the total rides. The most used station is located in<strong> <em>Lopez Cotilla/ Marcos Castellanos </em>with 45,331 rides.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*oTQFJLNtfhzzosg6-JTizA.png" /></figure><h4>Most used routes</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OX0H0Kmu5rcRsJO_timlHg.png" /><figcaption>The left picture is located in the north of Zapopan and the left picture is located in the Americana neighborhood and surroundings</figcaption></figure><p>Some things to highlight about the most used routes: <strong>the average distance is 1.2 km, </strong>the longest distance is 2.98 km and <strong>these routes together concentrate 1.68% of all rides.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*om9F8A9cCNVnSBBJYRFMbA.png" /><figcaption>Each route takes into consideration rides in both directions of the route</figcaption></figure><h4>Neighborhoods</h4><p>We categorized the stations by neighborhood and grouped the results so we can identify the neighborhoods with more bike stations. The top 5 neighborhoods were the following:</p><ul><li>Americana / 41</li><li>Centro / 35</li><li>Ladrón de Guevara / 17</li><li>Zapopan Centro / 12</li><li>Moderna / 9</li></ul><p>We also extracted information about each neighborhood, which contained: the population amount, economically active people amount, and amount of households with cars. Then, we compute the <strong>economically active people percentage </strong>and<strong> the households with cars percentage by </strong>neighborhood<strong>. </strong>After this, we can rank those percentages one by one together with the population amount. So, in the end, we will have the population, <strong>the households with cars percentage, and the economically active people percentage </strong>ranks, for us to get an average rank of these 3 variables. The neighborhoods that need the bikes the most are the ones with the lowest ranks.</p><p><strong>After combining this information about 973 neighborhoods, we found the following:</strong></p><p>The neighborhoods with the most station amounts are not even close to the neighborhoods that need them the most; as we said, <strong>the neighborhood that needs the bike stations the most is the number 1 rank, however, the average rank of the neighborhoods with most of the stations is 553</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jBL5P6mg3emOQu0-J79h2w.png" /></figure><p>Based on the neighborhoods and this information, this program can be seen more like a tourist facility than as a mobility program.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92a084a26640" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>