<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://albertolumbreras.net/feed.xml" rel="self" type="application/atom+xml" /><link href="https://albertolumbreras.net/" rel="alternate" type="text/html" /><updated>2026-10-12T23:11:47+02:00</updated><id>https://albertolumbreras.net/feed.xml</id><title type="html">Alberto Lumbreras</title><subtitle>Staff Research Scientist at Criteo AI Lab, working on AI agents. Notes and essays on how AI works, how I work with it, and what it is doing to society.</subtitle><author><name>Alberto Lumbreras</name></author><entry><title type="html">A digression on exponential growth</title><link href="https://albertolumbreras.net/posts/a-digression-on-exponential-growth.html" rel="alternate" type="text/html" title="A digression on exponential growth" /><published>2023-06-06T00:00:00+02:00</published><updated>2023-06-06T00:00:00+02:00</updated><id>https://albertolumbreras.net/posts/a-digression-on-exponential-growth</id><content type="html" xml:base="https://albertolumbreras.net/posts/a-digression-on-exponential-growth.html"><![CDATA[<h2 id="a-digression-on-exponential-growth">A digression on exponential growth</h2>

<p>As an telecommunication enginner, I owe a lot to Leonhard Euler, the Swiss mathematician who introduced the number <em>e</em> (2.71828…). Euler’s number is a fundamental constant in mathematics, and it is used in many areas of science.</p>

<p>Imagine that you have a some initial capital \(c_o\) and that you are given one year maximize it. You decide to put the money into the bank, who gives you a yearly interest rate of \(r\). After one year, you will have</p>

\[c_1 = c_o \cdot (1+r).\]

<h4 id="growth-with-n-re-investments">Growth with $n$ re-investments</h4>

<p>Now imagine that, instead of waiting one year, the bank lets you compound the interest (that is, every time you get some interest, it’s used as your new capital upon which the next interest is calculated) \(n\) times that year. After one year, you will have</p>

\[c_{n} = c_o \cdot (1+\frac{r}{n})^{n}.\]

<p>The more often the interest is compounded, the more money you will have at the end of the year. And that is why banks prefer to give you your interests once every year, and not every month, or every day.</p>

<h4 id="growth-with-infinite-re-investments">Growth with infinite re-investments</h4>

<p>But, what would happen if we could re-invest our money every second, or every milisecond, is there a limit? Indeed, there is. Euler proved that, if your could compound the interest infinite times for any given period, your final capital would be multiplied by a factor $e^r$, where $r$ is the interest rate and $e=2.718281828459045…$. In other words:</p>

\[c_{\infty} = c_o \cdot e^r.\]

<p>Finally, if we repeat the exercise $t$ times where each time we grow $e^t$ we would get the famous particular case of exponential growth:</p>

\[c_{\infty}(t) = c_o \cdot (e^{r})^t.\]

<h4 id="a-deeper-meaning-euler-number-is-the-speed-of-life">A deeper meaning: Euler number is the speed of life</h4>

<p>There is something deeper here than just your money growing. The Euler number is to life what light is to the universe: a limit of how fast you can grow (or travel). Imagine rabbits reproducing as fast as they can. The bigger the population, the faster it will grow. Yet the ratio between one day and the day before will be given by Euler’s number.</p>

<div style="text-align: center;">
    <img src="/assets/img/DALLE-rabbits-exponential.png" alt="Exponential growth illustration" />
</div>]]></content><author><name>Alberto Lumbreras</name></author><category term="mathematics," /><category term="exponential-growth," /><category term="Euler" /><summary type="html"><![CDATA[A digression on exponential growth]]></summary></entry><entry><title type="html">From Alan Turing to ChatGPT</title><link href="https://albertolumbreras.net/posts/ChatGPT-en.html" rel="alternate" type="text/html" title="From Alan Turing to ChatGPT" /><published>2023-04-11T00:00:00+02:00</published><updated>2023-04-11T00:00:00+02:00</updated><id>https://albertolumbreras.net/posts/ChatGPT-en</id><content type="html" xml:base="https://albertolumbreras.net/posts/ChatGPT-en.html"><![CDATA[<p>(This article has been translated from its <a href="http://www.maldekstrakolono.net/2023/04/11/ChatGPT.html">Spanish version</a> by ChatGPT)</p>

<p>In 1936, Alan Turing published an article that marked a turning point in the perception of what machines could achieve. Turing addressed the issue of computability, defining as <em>computable</em> those mathematical problems that can be solved through a step-by-step process, an <em>algorithm</em>. Turing gave us both bad and good news. The bad news is that certain mathematical problems lack an algorithmic solution. The good news is that for the rest of the problems, there is an algorithm that solves them, and this algorithm is reproducible by a mechanical device with a set of very basic operations called a “<strong>Turing machine</strong>”.</p>

<p>The creation of the first computers, practical equivalents of the Turing machine, inspired some scientists to consider whether human thought could be replicated algorithmically. Thus, in the summer of 1956, a group of ten scientists gathered at Dartmouth College to explore the possibility of simulating every aspect of intelligence through machines. They named this research program “<strong>Artificial Intelligence</strong>” (AI).</p>

<p>The field of AI was born from various “<strong>schools of thought</strong>” that have evolved and branched out over the past half-century. Interestingly, the school that currently dominates the field, the connectionist school, inherits much from a branch called cybernetics, which was not invited to the Dartmouth meeting due to rivalries between its representative, Norbert Wiener, and the meeting organizers. Cybernetics is the study of automatic systems that use feedback mechanisms to improve themselves.</p>

<p>The <strong>connectionist</strong> school owes its success to the idea of using “artificial neural networks” as the mechanism for learning through that feedback. Neural networks are inspired by the neural connections in the human brain. A neuron activates if a sufficient number of neurons connected to it also activate. More precisely, each neuron adjusts the importance it gives to the activation of each neighbor. These adjustments are updated throughout the network until the neurons in the output layer generate the correct output for the given input examples. This protocol is called “training.” The idea of neural networks already existed in the 1970s. Their resounding success in the last decade is due to two key elements. On the one hand, the availability of <strong>computing power</strong> that allows for giant neural networks that barely fit in the memory of a single computer. On the other hand, the availability, thanks to the internet, of astronomical amounts of <strong>examples</strong> with which to “train” these giant neural networks. Since 2010, giant neural networks (technically called <em>deep</em>) have achieved human-level performance in tasks such as image recognition and even automatic translation.</p>

<p>In 2017, the next revolution in the field of AI began to take shape. A group of Google researchers proposed a type of neural network called “<strong>transformers</strong>,” whose main innovation was that it could be trained on thousands of processors in parallel, thus multiplying the amount of training data. It was here that an unexpected discovery occurred. Another group of researchers from OpenAI trained a neural network to behave like what is known as a “language model,” which consists of the simple task of predicting the next word in a text corpus. That is, if we present the phrase “the dog of San Roque has no” to the system, we will give positive feedback if the output is “tail” and negative feedback if it is anything else. They observed that, when the corpus was large and diverse enough, the network somehow <strong>encoded an internal representation of the world</strong>, which allowed it to be used for many other tasks for which it had not been explicitly trained: text summarization, explaining jokes, logical reasoning. They called these models <strong>Generative Pre-trained Transformers</strong> (GPT).</p>

<p>In 2022, OpenAI researchers added two new training stages to their latest GPT-3 model, one consisting of presenting examples of questions and answers, and a final one where human evaluators (Nigerian workers) numerically rated these answers. Since this allowed the model to acquire the ability to fluidly converse with users, they called it <strong>ChatGPT</strong>. The quality of the responses given by ChatGPT has surprised even its own creators, who have warned of the need for a regulatory framework to limit the misuse of these technologies.</p>

<p>A few months after ChatGPT’s release, Microsoft became OpenAI’s largest investor with 49% ownership of the company. Other tech giants like Meta and Google have also released their own versions (Llama and Gemini), and open-source initiatives are multiplying, attempting to train similar models for public availability.</p>

<p>What ChatGPT envisions is not simply another AI system confined to certain applications. The potential of these types of models has placed us on the brink of a technological revolution with social and economic consequences that are difficult to predict, perhaps on the order of the steam engine or the internet. Among the possibilities illuminated by these systems are a new wave of process automation or digital assistants for all kinds of tasks, from professional (most computer programmers already use code generated by these systems in their daily work) to domestic.</p>

<h2 id="the-real-challenges-of-ai">The Real Challenges of AI</h2>

<p>Our anthropomorphic tendency, along with our phobias and philias fueled by science fiction, have generated debates about whether these machines will be able to feel like us, or even rebel against us. Even linguists like Chomsky strive to make it clear that <a href="https://sinpermiso.info/textos/la-falsa-promesa-de-chatgpt">ChatGPT does not <em>really</em> think</a>. But without minimizing the importance of the new perspectives these advances may bring to fields like philosophy, linguistics, or psychology, in a sense, asking whether the machine thinks like a human is like asking whether a submarine “swims” like a fish. The fact that the machine does not think like a human does not diminish the effects its emergence will have on our societies.</p>

<p>Since the last internet revolution, the dream of a utopia of shared knowledge coexists (more poorly than well) with the monopolistic nightmare and concentration of power already seen in the analog world. Similarly, the AI revolution is pregnant with both utopia and dystopia. Beyond metaphysical musings about what intelligence is or whether human intelligence is the only possible intelligence, the real challenges posed by this new technology are much more tangible.</p>

<h4 id="control-of-the-means-of-production-gpus">Control of the Means of Production (GPUs)</h4>

<p>The means of production in the era of large language models (LLMs) are special processors called GPUs, manufactured almost exclusively by NVIDIA. To train ChatGPT, OpenAI used 1000 GPU processors for a month, which, between hardware and electricity, cost about 4 million dollars. It is estimated that future versions will cost around 2.5 billion euros (https://mpost.io/gpt-5-training-will-cost-2-5-billion-and-start-next-year/). Very few public or private institutions can afford this kind of expenditure. The largest GPU purchase to date has been announced by Princeton, which has secured 9 million dollars to buy 300 GPUs, far below the capabilities of private industry. Even so, Princeton has been lucky, as NVIDIA is rejecting orders from most customers to focus on the needs of the big players.</p>

<p>The concentration of these means of production in a few hands raises issues such as the opacity of their models. Without access to the data used by these companies to train their models, we cannot properly analyze the biases they internalize from these data. Thus, the models may end up asserting things like “a man is to a doctor what a woman is to a nurse,” or that a black person appearing in a photo dressed in civilian clothes at the prison door is an inmate and a white person in the same context is a prison officer. Controlling such biases is essential as these models are incorporated into decision-making processes in fields such as human resources, medicine, or justice.</p>

<p>The creation of open-source, open and transparent models is the only way to ensure democratic control and access to these.</p>

<h4 id="the-theft-of-raw-materials-data">The Theft of Raw Materials (Data)</h4>

<p>If GPUs are the means of production, data are the raw materials that these means transform into knowledge-commodities. AI models are trained using large volumes of data, which often include texts, images, and other types of content produced by humans without profit motive. From forum responses to YouTube videos, including computer code shared with the community for free use.</p>

<p>This exploitation of public information and user-created content poses an ethical and legal dilemma. Some illustrators and graphic artists have already expressed concerns about how large tech companies use their works to train image generation models without their explicit permission or compensation. These concerns have intensified with the creation of models capable of generating art in styles that mimic specific artists.</p>

<p>This unconsented appropriation of the commons recalls the processes of primitive capital accumulation through the appropriation of communal lands, in the sense that such appropriation is forced and, once achieved, will be difficult to undo.</p>

<h4 id="environmental-impacts">Environmental Impacts</h4>

<p>If, as journalist Guillaume Pitron explains in his book “The Digital Hell,” the internet already consumes 10% of the world’s electricity and accounts for 4% of CO2 emissions, it is expected that large language models will quickly increase this bill. Training a model like ChatGPT consumes the same as 1000 North American households in a year (10GWh). Once trained, each user query consumes ten times more than a Google query (a total of 1GWh per day). Not counting the generation of sound, images, and especially video, capabilities that have already begun to be incorporated into these systems.</p>

<p>Currently, there is a race toward more energy-efficient models. This could even reduce global CO2 emissions if AI were used to optimize current production chains. However, in the framework of consumer society, it is expected that Jevon’s paradox will be fulfilled again, where the improvement in the efficiency in the use of a resource increases the total consumption of that resource.</p>

<h4 id="surplus-value">Surplus Value</h4>

<p>The incorporation of language models into value chains is already increasing productivity. Like all preceding technology, we cannot expect this productivity increase to result in reduced working hours or higher wages. On the contrary, shareholders see this technology as a new cost-cutting opportunity. The translators’ guild</p>

<p>, for example, where self-employed workers are abundant, is already seeing agencies not only expecting faster translations but also pressing rates downwards.</p>

<p>The battle is again to avoid a new source of surplus value for shareholders, at least through taxes. Otherwise, the theft would be double since the vast majority of the advances that have led to current AI models have been funded by public funds.</p>]]></content><author><name>Alberto Lumbreras</name></author><category term="artificial-intelligence" /><summary type="html"><![CDATA[(This article has been translated from its Spanish version by ChatGPT)]]></summary></entry><entry><title type="html">Installing Spark on Ubuntu 18.04</title><link href="https://albertolumbreras.net/posts/Spark-installation.html" rel="alternate" type="text/html" title="Installing Spark on Ubuntu 18.04" /><published>2018-09-22T00:00:00+02:00</published><updated>2018-09-22T00:00:00+02:00</updated><id>https://albertolumbreras.net/posts/Spark-installation</id><content type="html" xml:base="https://albertolumbreras.net/posts/Spark-installation.html"><![CDATA[<p>This post contains the steps that I followed to install Spark on my Ubuntu 18.04 (Bitonic). I first tried with the pre-built version available on their site, but it threw an error when I tried to play with it. After that, I tried with the more <em>serious</em> alternatives: installation with Maven, which did not work either, and with SBT, which worked after some hours of struggle.</p>

<p>The first thing is to download and extract the .tgz file from <a href="http://spark.apache.org/downloads.html">the official website</a></p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>wget https://archive.apache.org/dist/spark/spark-2.3.1/spark-2.3.1.tgz
tar -zxvf spark-2.3.1.tgz
cd spark-2.3.1
</code></pre></div></div>

<p>Check that we have Java 8 or higher and whether we have the JAVA_HOME environment variable adequately defined:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>java --version
echo $JAVA_HOME
</code></pre></div></div>

<p>Java 9 (the default in Ubuntu 18) might give problems with Spark, so some people install Java 8. Oracle Java 8 is not in the official repositories of Ubuntu 18. Thus, I added the repositories and then installed it.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt install oracle-java8-set-default
</code></pre></div></div>

<p>Check that java and javac use both Oracle 8:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo update-alternatives --config java
sudo update-alternatives --config javac
</code></pre></div></div>

<p>And then check that the environment variable JAVA_HOME is also set to Java 8. Modify it if necessary:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>echo $JAVA_HOME
export JAVA_HOME="/usr/lib/jvm/java-8-oracle/"
</code></pre></div></div>

<p>Add the last line to the ~/.bashrc file to make it permanent.</p>

<p>Now Install <code class="language-plaintext highlighter-rouge">pyspark</code>, the Python interface to Spark to write  to execute pyspark scripts (python calling spark)</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>pip install pyspark
</code></pre></div></div>

<p>My attempt to build Spark using Maven or SBT did not work. Some of the compiling errors looked like it had something to do with Scala. So I installed Scala (SBT) following the instructions <a href="https://www.scala-sbt.org/download.html?_ga=2.151093565.506191957.1537690680-997580507.1537641438">from their site</a>.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt
</code></pre></div></div>

<p>Finally, I could install spark with</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> ./build/sbt package
</code></pre></div></div>

<p>Then I moved the complete spark directory to the /opt/ directory</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo mv spark-2.3.1 /opt/spark-2.3.1
sudo ln -s /opt/spark-2.3.1 /opt/spark
</code></pre></div></div>

<p>With this symbolic link, we can install multiple Spark versions in the /opt/ directory, and the link (that we will use in the environment variables) will point to the active one. Finally, we set the SPARK environment variables in our ~/.bashrc file:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>export SPARK_HOME=/opt/spark
export PATH=$SPARK_HOME/bin:$PATH
</code></pre></div></div>

<p>After these steps, I could start playing with the <a href="https://spark.apache.org/docs/latest/quick-start.html">quick start tutorial</a>. I entered the pyspark shell:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>pyspark
</code></pre></div></div>

<p>And then everything seemed to work fine:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&gt;&gt;&gt; textFile = spark.read.text("/opt/spark/README.md")
&gt;&gt;&gt; textFile.count()
103 
&gt;&gt;&gt; textFile.first()
Row(value='# Apache Spark')
</code></pre></div></div>

<p>However, I don’t like shells; I prefer Jupyter notebooks. Let’s see how we can use pyspark from a Jupyter network. A first option is to install findspark so that we can find Spark from any Jupiter notebook:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>pip install findspark
</code></pre></div></div>

<p>Then we can start our code in a Jupyter notebook as</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>import findspark
findspark.init()
import pyspark
</code></pre></div></div>

<p>A second alternative is to let Jupyter notebook be the default shell for pyspark, adding to our  ~/.bashrc file:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>export PYSPARK_DRIVER_PYTHON=jupyter
export PYSPARK_DRIVER_PYTHON_OPTS='notebook'
</code></pre></div></div>

<h2 id="computing-pi-with-a-parallel-monte-carlo">Computing \(\pi\) with a parallel Monte Carlo</h2>

<p>Now we can call pyspark from the command line and write our first program in a notebook. The following code approximates \(\pi\) using a Monte Carlo algorithm. We draw random points within a unit square and count how many of them fall inside the curve  \(x^2 + y^2\). We are working in one of the quadrants of a circle with radius 1. The area of the whole circle is, by definition, \(\pi\). Therefore \(\pi\) can be approximated as  \(\pi= 4*s \approx 4 * inside / total\). The code is</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>import random
num_samples = 100000000

def inside(p):     
     x, y = random.random(), random.random()
     return x*x + y*y &lt; 1

count = sc.parallelize(range(0, num_samples)).filter(inside).count()
pi = 4 * count / num_samples
print(pi)
sc.stop()

# 3.14109824
</code></pre></div></div>

<p>Each parallel worker draws a sample and communicates whether if felt inside or outside the circle curve. Spark counts the number of positive responses from the workers, and then we compute the total proportion to approximate \(\pi\).</p>

<h3 id="references">References</h3>

<p>Some links I visited during the installation:</p>

<ul>
  <li>https://www.davidadrian.cc/posts/2017/08/how-to-spark-cluster/</li>
  <li>https://stackoverflow.com/questions/28565837/filename-too-long-sbt</li>
  <li>https://blog.sicara.com/get-started-pyspark-jupyter-guide-tutorial-ae2fe84f594f</li>
</ul>]]></content><author><name>Alberto Lumbreras</name></author><category term="big" /><category term="data" /><summary type="html"><![CDATA[This post contains the steps that I followed to install Spark on my Ubuntu 18.04 (Bitonic). I first tried with the pre-built version available on their site, but it threw an error when I tried to play with it. After that, I tried with the more serious alternatives: installation with Maven, which did not work either, and with SBT, which worked after some hours of struggle. The first thing is to download and extract the .tgz file from the official website wget https://archive.apache.org/dist/spark/spark-2.3.1/spark-2.3.1.tgz tar -zxvf spark-2.3.1.tgz cd spark-2.3.1 Check that we have Java 8 or higher and whether we have the JAVA_HOME environment variable adequately defined: java --version echo $JAVA_HOME Java 9 (the default in Ubuntu 18) might give problems with Spark, so some people install Java 8. Oracle Java 8 is not in the official repositories of Ubuntu 18. Thus, I added the repositories and then installed it. sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt install oracle-java8-set-default Check that java and javac use both Oracle 8: sudo update-alternatives --config java sudo update-alternatives --config javac And then check that the environment variable JAVA_HOME is also set to Java 8. Modify it if necessary: echo $JAVA_HOME export JAVA_HOME="/usr/lib/jvm/java-8-oracle/" Add the last line to the ~/.bashrc file to make it permanent. Now Install pyspark, the Python interface to Spark to write to execute pyspark scripts (python calling spark) pip install pyspark My attempt to build Spark using Maven or SBT did not work. Some of the compiling errors looked like it had something to do with Scala. So I installed Scala (SBT) following the instructions from their site. echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 sudo apt-get update sudo apt-get install sbt Finally, I could install spark with ./build/sbt package Then I moved the complete spark directory to the /opt/ directory sudo mv spark-2.3.1 /opt/spark-2.3.1 sudo ln -s /opt/spark-2.3.1 /opt/spark With this symbolic link, we can install multiple Spark versions in the /opt/ directory, and the link (that we will use in the environment variables) will point to the active one. Finally, we set the SPARK environment variables in our ~/.bashrc file: export SPARK_HOME=/opt/spark export PATH=$SPARK_HOME/bin:$PATH After these steps, I could start playing with the quick start tutorial. I entered the pyspark shell: pyspark And then everything seemed to work fine: &gt;&gt;&gt; textFile = spark.read.text("/opt/spark/README.md") &gt;&gt;&gt; textFile.count() 103 &gt;&gt;&gt; textFile.first() Row(value='# Apache Spark') However, I don’t like shells; I prefer Jupyter notebooks. Let’s see how we can use pyspark from a Jupyter network. A first option is to install findspark so that we can find Spark from any Jupiter notebook: pip install findspark Then we can start our code in a Jupyter notebook as import findspark findspark.init() import pyspark A second alternative is to let Jupyter notebook be the default shell for pyspark, adding to our ~/.bashrc file: export PYSPARK_DRIVER_PYTHON=jupyter export PYSPARK_DRIVER_PYTHON_OPTS='notebook' Computing \(\pi\) with a parallel Monte Carlo Now we can call pyspark from the command line and write our first program in a notebook. The following code approximates \(\pi\) using a Monte Carlo algorithm. We draw random points within a unit square and count how many of them fall inside the curve \(x^2 + y^2\). We are working in one of the quadrants of a circle with radius 1. The area of the whole circle is, by definition, \(\pi\). Therefore \(\pi\) can be approximated as \(\pi= 4*s \approx 4 * inside / total\). The code is import random num_samples = 100000000 def inside(p): x, y = random.random(), random.random() return x*x + y*y &lt; 1 count = sc.parallelize(range(0, num_samples)).filter(inside).count() pi = 4 * count / num_samples print(pi) sc.stop() # 3.14109824 Each parallel worker draws a sample and communicates whether if felt inside or outside the circle curve. Spark counts the number of positive responses from the workers, and then we compute the total proportion to approximate \(\pi\). References Some links I visited during the installation: https://www.davidadrian.cc/posts/2017/08/how-to-spark-cluster/ https://stackoverflow.com/questions/28565837/filename-too-long-sbt https://blog.sicara.com/get-started-pyspark-jupyter-guide-tutorial-ae2fe84f594f]]></summary></entry><entry xml:lang="es"><title type="html">Revoluciones científicas y revoluciones políticas</title><link href="https://albertolumbreras.net/posts/revoluciones-cientificas.html" rel="alternate" type="text/html" title="Revoluciones científicas y revoluciones políticas" /><published>2013-11-08T00:00:00+01:00</published><updated>2013-11-08T00:00:00+01:00</updated><id>https://albertolumbreras.net/posts/revoluciones-cientificas</id><content type="html" xml:base="https://albertolumbreras.net/posts/revoluciones-cientificas.html"><![CDATA[<center>
<img alt="kuhn" src="/assets/img/2013-11-08-revoluciones-cientificas/kuhn.jpg" width="240" height="197" />
</center>
<p><br /></p>

<p style="text-align: justify;"> Frente a las diferencias tan grandes y esenciales entre el desarrollo político y el científico, ¿qué paralelismo puede justificar la metáfora que encuentra revoluciones en ambos?</p>

<p style="text-align: justify;">Uno de los aspectos del paralelismo debe ser ya evidente. Las revoluciones políticas se inician por medio de un sentimiento, cada vez mayor, restringido frecuentemente a una fracción de la comunidad política, de que las instituciones existentes han cesado de satisfacer adecuadamente los problemas planteados por el medio ambiente que han contribuido en parte a crear. De manera muy similar, las revoluciones científicas se inician con un sentimiento creciente, también a menudo restringido a una estrecha subdivisión de la comunidad científica, de que un paradigma existente ha dejado de funcionar adecuadamente en la exploración de un aspecto de la naturaleza. Hacia el cual, el mismo paradigma había previamente mostrado el camino. Tanto en el desarrollo político como en el científico, el sentimiento de mal funcionamiento que puede conducir a la crisis es un requisito previo para la revolución. Además, aunque ello claramente fuerza la metáfora, este paralelismo es no sólo válido para los principales cambios de paradigmas, como los atribuibles a Copérnico o a Lavoisier, sino también para los mucho más pequeños, asociados a la asimilación de un tipo nuevo de fenómeno, como el oxígeno o los rayos X. Las revoluciones científicas, como hicimos notar al final de la Sección V, sólo necesitan parecerles revolucionarias a aquellos cuyos paradigmas sean afectados por ellas. Para los observadores exteriores pueden parecer, como las revoluciones balcánicas de comienzos del siglo XX, partes normales del proceso de desarrollo. Los astrónomos, por ejemplo, podían aceptar los rayos X como una adición simple al conocimiento, debido a que sus paradigmas no fueron afectados por la existencia de la nueva radiación. Pero, para hombres como Kelvin, Crookes y Roentgen, cuyas investigaciones trataban de la teoría de la radiación o de los tubos de rayos catódicos, la aparición de los rayos X violó, necesariamente, un paradigma, creando otro. Es por eso por lo que dichos rayos pudieron ser descubiertos sólo debido a que había algo que no iba bien en la investigación normal.</p>
<p style="text-align: justify;">Este aspecto genético del paralelo entre el desarrollo político y el científico no debería ya dejar lugar a dudas. Sin embargo, dicho paralelo tiene un segundo aspecto, más profundo, del que depende la importancia del primero. Las revoluciones políticas tienden a cambiar las instituciones políticas en modos que esas mismas instituciones prohíben. Por consiguiente, su éxito exige el abandono parcial de un conjunto de instituciones en favor de otro y, mientras tanto, la sociedad no es gobernada completamente por ninguna institución. Inicialmente, es la crisis sola la que atenúa el papel de las instituciones políticas, del mismo modo, como hemos visto ya, que atenúa el papel desempeñado por los paradigmas. En números crecientes, los individuos se alejan cada vez más de la vida política y se comportan de manera cada vez más excéntrica en su interior. Luego, al hacerse más profunda la crisis, muchos de esos individuos se comprometen con alguna proposición concreta para la reconstrucción de la sociedad en una nueva estructura institucional. En este punto, la sociedad se divide en campos o partidos enfrentados, uno de los cuales trata de defender el cuadro de instituciones antiguas, mientras que los otros se esfuerzan en establecer otras nuevas. Y, una vez que ha tenido lugar esta polarización, el recurso político fracasa. Debido a que tienen diferencias con respecto a la matriz institucional dentro de la que debe tener lugar y evaluarse el cambio político, debido a que no reconocen ninguna estructura supra institucional para dirimir las diferencias revolucionarias, las partes de un conflicto revolucionario deben recurrir, finalmente, a las técnicas de persuasión de las masas, incluyendo frecuentemente el empleo de la fuerza. Aunque las revoluciones tienen una función vital en la evolución de las instituciones políticas, esa función depende de que sean sucesos parcialmente extra políticos o extra institucionales.</p>
<p style="text-align: justify;">Thomas Kuhn, 1962. <em>La estructura de las revoluciones científicas. </em><a href="http://dieumsnh.qfb.umich.mx/9__naturaleza.htm">Capítulo IX</a>.</p>]]></content><author><name>Alberto Lumbreras</name></author><category term="philosophy" /><summary type="html"><![CDATA[]]></summary></entry></feed>