Translate

lunes, 19 de septiembre de 2016

Inter-, extra- and intra- polation

Interpolation: the mathematical problem of interpolation is to find a function that goes exactly through the training points. It doesn't say anything on the inputs on which this function will be later evaluated. Of course, the solution provides a way of evaluating the function in unseen inputs, but it really is not about that, it is about "going through the given points".

Extrapolation: is about the relation between the new inputs where the function will be evaluated and the inputs used for training. It doesn't say anything about the relation between the function and the training inputs, as interpolation does: you can extrapolate using an interpolating function (i.e. that goes exactly through the training inputs) or an approximating function (i.e. that goes close to the training inputs). Extrapolation means that the new inputs are "outside the region delimited by the examples we used for training (the observation range)", for example one could say that extrapolation is evaluating a learned function outside the convex-hull of the inputs used for training (this example applies only if the input set has a notion of "inside" and "outside", which is the case in many many situations).

Intrapolation: is a term I coined (I am sure I am not the first! do you know if anybody used it first? or maybe another clever word to express the same idea?). As in extrapolation it is about the relation the new inputs have with the inputs used for training. It doesn't say anything about the function we are using, as interpolation does. You can either intrapolate with an interpolating function or with an approximating function. Intrapolation means that the new inputs on which the function will be evaluated are inside the observation range, following the previous example, they will be inside the convex-hull of the inputs used for training.

interpolation, intrapolation,extrapolation and approximation

Hence, the complement of extrapolation would be intrapolation, whether we are suing an interpolant or not. I think this makes the jargon cleaner!

Summary:
interpolation <-----> approximation
intrapolation <-----> extrapolation

miércoles, 19 de agosto de 2015

Kivy - variable Label

Lately I have been working with Kivy to produce some simple Apps. One of the things I needed was a Label which text could be changed by double clicking on it. I came up with this derived class that merges Label, TextInput and Popup.

from kivy.app import App

from kivy.uix.label import Label
from kivy.uix.popup import Popup
from kivy.uix.textinput import TextInput

class variableLabel (Label):

    def __init__(self, text):
        super(variableLabel, self).__init__()
        self.text  = text

    def on_touch_down(self, touch):
        if touch.is_double_tap and self.collide_point(*touch.pos):
          _input = TextInput(text=self.text, multiline=False, auto_dismiss=False)
          popup = Popup(title='Editing Label text', content=_input)
          _input.bind (text=self.on_text)
          _input.bind (on_text_validate=popup.dismiss)
          popup.open()

    def on_text (self, instance, value):
        self.text = value

class MyApp(App):

    def build(self):
        return variableLabel("New")

if __name__ == '__main__':
    MyApp().run()

Do you have suggestions for improvement?

viernes, 16 de enero de 2015

BIN2FRAC

Binary numbers to fractions

The mapping from binary numbers to fractions described in this article can be written in GNU Octave as the function

bin2q = @(x) arrayfun (@str2num,x) (2.^-[1:length(x)].')

Giving the results that .0100... and .001111... map to 1/4

octave> bin2q ('0100000000000000000')
ans =  0.25000
octave> bin2q ('0011111111111111111')
ans =  0.25000

Números binarios a fracciones

El mapeo de números binario a fracciones, descriptoi en este artículo se puede definir como la siguiente función en GNU Octave

bin2q = @(x) arrayfun (@str2num,x) (2.^-[1:length(x)].')

Dando el resultado que .0100... y .001111... se mapean en 1/4

octave> bin2q ('0100000000000000000')
ans =  0.25000
octave> bin2q ('0011111111111111111')
ans =  0.25000

domingo, 14 de septiembre de 2014

Salteños visitarán Bélgica

Este post es derivado de este otro.



Muchas cosas han sucedido desde la última visita de Dwengo a Salta. Si están siguiendo la página de CErrobotics ya saben de los robots fabricados en Campo Quijano y las placas Dwengo fabricadas en la escuela técnica Albert Einstein de Salta. Quizas algunos también se hayan enterado de las actividades de Fundasoft en Córdoba, que ahora comineza con sus cursos en programación y lanza su propia versión de la placa Dwengo (hace un tiempo publiqué una reseña de la historía de Dwengo).

Los que nos mantiene ocupados el día de hoy es la organización de la semana Internacional de Robótica en Gante, Belgica (del 22 al 27 de Octubre, 2014). Con el dinero que logramos juntar con nuestra campaña en IndieGoGo (dato curioso: las únicas contribuciones argentinas son de gente que vive en el exterior ¿crisis económica o poca cultura de la internet?) solventaremos los gastos de traslado de 4 jóvenes Salteños. Estos son los seleccionados:

  • Matias Fajardo (17): habitante de Orán, desde niño fascinado por los robots. Ha construído sus propios aparatos gracias a instruccions que obtuvo de revistas y de la internet.
  • Marcos Emanuel Sosa (15): nacido en J.V. Gonzales, es un hacker del radio-control desde pequeño. Un visionario que se preocupa por el mañan de la humanidad. Esperamos oir sus ideas!
  • Florencia Antonella Correa (17): viene de Moldes y confiesa no saber mucho de robótica. Sin embargo muestra un sorprendente compromiso con la divulgación de la ciencia y la tecnología en su entorno. Vamos!
  • Lourdes Guyot (18): es de Salta capital y participó en el proyecto CErrobotics, ahora busca consolidar su experiencia en robótica.

Serán acompañados por Carlos Alberto Ríos quién ha mantenido una actividad constante en su escuela, integrando cada vez mas jovenés a su clase de robótica de los días Sábados.

Este evento será el último de mi estadía en Bélgica, puesto que mi postdoctorado en la universidad de Gante llega a su final. Mi próximo destino es incierto, pero seguramente, por cuestiones personales, estaré cerca de Suiza. El plan es continuar con este tipo de actividades desde mi nuevo lugar.

sábado, 13 de septiembre de 2014

Best practices in Science [coming from Cybernetics] by N. Wiener, 1947

The following text is extracted from the introduction to the first edition of "Cybernetics, or Control and Communication in the Animal and the Machine". I put it here because Norbert Wiener not only gave his opinion about good and evil in science but he also recommended an attitude and the expected behavior of the ethical scientist. I have highlighted phrases that for me are most important and provided some links.

On ethical science...
"
Those of us who have contributed to the new science of cybernetics thus stand in a moral position which is, to say the least, not very comfortable. We have contributed to the initiation of  new science, which, as I have said, embraces technical developments with great possibilities for good and for evil. We can only hand it over into the world that exists about us, and this is the world of Belsen and Hiroshima. We do not even have the choice of suppressing these new technological developments. They belong to the age, and the most any of us can do by suppression is to put the development of the subject into the hands of the most irresponsible and most venal of out engineers. The best we can do is to see that a large public understands the trend and the bearing of the present work, and to confine our personal efforts to those fields, such as physiology and psychology, most remote from war and exploitation. As we have seen, there are those who hope that the good of a better understanding of man and society which is offered by this new field of work may anticipate and outweigh the incidental contribution we are making to the concentration of power (which is always concentrated, by its very conditions of existence, in the hands of the most unscrupulous). I write in 1947, and I am compelled to say that it is a very slight hope.
"

On values...
"
... I say that the first industrial revolution, the revolution of the "dark satanic mills", was the devaluation of the human arm by the competition of machinery. There is no rate of pay at which a United States pick-and-shovel laborer can live which is low enough to compete with the work of a steam shovel and an excavator. The modern industrial revolution is similarly bound to devalue the human brain, at least in its simpler and more routine decisions. Of course, just as the skilled carpenter, the skilled mechanic, the skilled dressmaker have in some degree survived the first industrial revolution, so the skilled scientist and the skilled administrator may survive the second. However, taking the second revolution as accomplished, the average human being of mediocre attainments or less has nothing to sell that is worth anyone's money to buy.
The answer, of course, is to have a society based on human values other than buying and selling. To arrive at this society, we need a good deal of planning and a good deal of struggle, which, if the best comes to the best, may be on the plane of ideas, and otherwise--who knows?
"

 On slavery...
"
I have said that this new development [cybernetics] has unbounded possibilities for good and for evil... It gives the human race a new and most effective collection of mechanical slaves to perform its labor. Such mechanical labor has most of the economic properties of slave labor, although, unlike slave labor, it does not involve the direct demoralizing effects of human cruelty. However, any labor that accepts the condition of competition with slave labor accepts the condition of slave labor, and is essentially slave labor. The key word is of this statement is competition. It may very well be a good thing for humanity to have the machine remove from it the need of menial and disagreeable tasks, or it may not. I do not know. It cannot be good for these new potentialities to be assessed in terms of the market, of the money they save...
"

Se ha producido un error en este gadget.