programming

How to check the possible parameters for a function in Julia

Sometimes I create functions that receive a function as parameter, but in Julia the type is Function without any information, so when the function pass as parameter is not right, the error message is not very informative: By example: julia> function fun_demo(f::Function) values = [1.0, 2.3, 3.4] return f.(values) end each (generic function with 1 method) julia> fun_demo(sin) 3-element Vector{Float64}: 0.8414709848078965 0.7457052121767203 -0.2555411020268312 However, when the function is not right, the error is difficult to understand:

My Julia journey

In this post I am going to tell my Julia journey. I have read about Julia but not actually use it before version 0.7 just before 1.0. I work on Machine Learning and stochastic optimization (with evolutionary computation). In Machine Learning (and Deep Learning) I work nicely with Python (Scikit-learn and Keras/PyTorch). However, in optimization I usually did prototype in Python, and later have to translate to C++ for performance (well, not while the function evaluation takes too much).

My first Julia Package

For online teaching I use Moodle. I have a lot of experience using it (for more than 10 years). Unfortunately, the software could be improved a lot. My main complains are: You can import the grades using an Excel file. However, you cannot import the comments. I like to give comment to explain the reason of the qualifications. The Quiz is potent, but the creation of questions is very slow.

About online teaching

These days we have to be enclosed in our houses by the coronavirus (COVID-19), so in my University (in Granada) as the others in Spain, we had to became in online teaching expert in a weekend. For the courses we have following different approaches: Additional written material, several short videos about the materials, or conferences for giving the courses by video-conferences. All options have its advantages and drawbacks. However, because I like the feedback with the students (for instance, to make several examples in code about the concepts in my programming course), I have finally decided to give the course by video-conference.

Introduction to Julia

The last year I have been working in a promising programming language, Julia. Even I have done a presentation focused on people with Computer Science background (so the talk compares Julia against Python), Talk in English Also it was given in Spanish Julia Talk in Spanish The resources of that talk are available at Github Repository.

Introduction to CMake

In my last course, I decided to give a small introduction about CMake. The reason is that, although we teach them Make, the majority of students do not use them in their programs. In fact, many times they create a “makefile” program to pretend they are using “make”, but actually, it is a bash script. My intention is to teach them Cmake to encourage them to use an automatic tool for compiling, expecting they use it more, by its simpler syntax.

Bokeh plot in Django and with REST and Flask

Last weeks I have working with a django app for research. I will update it when it will be ready ;-). However, the introduction of Javascript and specifically Vue.js have produce that the website is mainly dynamic using JS and not Python. Also, we have done a static website http://www.tflsgo.org/ (using Gitlab Page and Jekyll), so I started considering to transform the website to a static website using Rest service with Python.

Using Python for Business Intelligence

Two weeks ago I started my first teaching day, replacing a teacher that has still not gone to Ceuta (because the temporal contract was offered to many people, and all of them refuse it). Do not worry, they will have the material, I said to myself, naïvely. However, my Phd. advisor, the coordinator of the course, has decided to replace the practice classes from Knime to Python using the different tools availables.

Improving performance in Python

All the source code of this post is available at github. In the previous post, I recognized my predilection for Python. For me, it is a great language for create prototypes in many areas. For my research work, I usually creates/designs algorithms for continuous optimization using evolutionary algorithms. For these algorithms, languages like C/C++ or Java are widely used, specially for its good performance (to publish, it is usual to have to make many comparisons between algorithms, so the performance could be critical.

Callback that stop algorithm in R

Today I was making a little programming using the mathematical software R (very useful for statistics, by the way), for a little test. I’m one of the authors of a Cran package (Rmalschains) for continuous optimization, and I was testing another packages to compare results. Comparing a particular package I realise that the API doesn’t give me enough control for the comparisons. Briefly, to compare different algorithms all of them should stop when the same number of solutions is achieved.