Python coding skills for statistic

Learning statistics is greatly facilitated by using a computational platform for doing statistics calculations and visualizations. You can do basic stats calculations using pen-and-paper for small datasets, but you’ll need a computer to help you with larger datasets. Common computational platforms for doing statistics include JASP, jamovi, SPSS, R, and Python, among many others. You can even do statistics calculations using spreadsheet software like Excel, LibreOffice calc, or Google Sheets. I believe using Python is the best computational platform for learning statistics. Specifically, an interactive notebook environment like JupyterLab provides the best-in-class tools for data visualizations and probability calculations.

But what about learners who are not familiar with Python? Should we abandon non-tech learners and say they can’t learn statistics because they don’t know how to use Python? Naaaah, we ain’t having none of that! Instead, my plan is to bring non-technical learners up to speed on Python by teaching them the Python basics that they need to use for statistics. Anyone can learn Python, it’s really not a big deal. I hope to convince you of this fact in this blog post, which is intended as a Python crash-course for the absolute beginner.

Continue reading “Python coding skills for statistic”

Learning loops

I was talking with friends recently about an interesting phenomenon that all self-taught programmers have observed, which we ended up calling “learning loops.” A learning loop is a process in which learners are motivated to advance their knowledge thanks to the positive feedback on their performance.

In this blog post, I want to look at the mechanics that make learning loops work and think about ways they could be used by teachers, private tutors, and publishers to build learning experiences in which learners have more agency and control over their learning. We’ll also look at the related phenomenon of game mechanics that exists in certain “addictive” computer games. Figure 1 contains a visual summary of the ideas we’ll discuss in this blog post. The two main questions we’re interested in are: “What can teachers within the formal educational system learn from autodidacts?” and “What can autodidacts learn from the gaming industry about staying motivated?

In the second part of the blog post we’ll think about the role of teachers and educational resources in supporting and reinforcing learning loops. I’m writing this mostly as a self-reflection and welcome comments by other educators, content creators, and learning experience designers interested in this phenomenon.

Concept map illustrating the ideas discussed in the blog post: learning loops and their relation to game-loops and potential uses in the formal educational system.

Figure 1: The main question I’m interested in thinking about is how to introduce aspects of self-directed learning into the formal educational system, in order to give students more agency over their learning process.

 

Continue reading “Learning loops”

Generating ePub from LaTeX

I want to tell you about my journey to produce the ePub files for the No Bullshit Guide textbooks. This has been an epic battle with lots of technological obstacles, but I got it working in the end, and the results are beautiful:

In this blog post, I want to share what I’ve learned about generating ePub and Mobi files from LaTeX source files that contain lots of math equations. I feel this ought to be recorded somewhere for the benefit of other STEM authors and publishers who have LaTeX manuscripts and want to convert them to .epub and .mobi formats. Read on to watch the “How it’s made” episode about math eBooks.

The end-to-end book production pipeline looks like this:

eBook production pipeline including .tex, .html, .epub, and .mobi formats

Figure 1: The eBook production pipeline described in this blog post. Each box represents a different markup format and the arrows indicate the software used to convert between formats. The hard step is to produce clean .html+MathJax format from the .tex source. The generation of the other formats is standard.

Continue reading “Generating ePub from LaTeX”

Impression from NYC and the RC

Two months ago I was on a train going from Montreal to New York City. It’s a long ride, but I used the time on the train to triage all the coding project ideas I could work on while at the Recurse Center (RC). So many projects; so many ideas.

Today I’m on the same train heading back to Montreal and have another 10 hours to triage the thoughts, experiences, and observations about the big city and the social experiment that is RC. Here is my best shot at it—stream-of-consciousness-style—before I forget it all.

Continue reading “Impression from NYC and the RC”

No bullshit guide to programming

How does one learn to code? Students in computer science and software engineering will have a few first-year programming courses, with the first one introducing basics like variables, control flow, and loops. Autodidact programmers probably started with a tutorial somewhere, but eventually got a book on the subject. Regardless of the learner’s path, we’re talking about a book that teaches “the basics.”

Continue reading “No bullshit guide to programming”

Annual general update

It’s May. Winter is done now, so it’s time for spring cleaning! In addition to cleaning your living space, Spring is also a good time to clean out the “project plans” and focus on one or two key goals for the summer. This is what I intend to do in this post. Read on to learn about the recent developments, and the strategic plan for Minireference Co. for the coming year.

Continue reading “Annual general update”

Binary search in three languages

Hola! Regardons ensemble un peu de code. The binary_search algorithm. It will get a little technical, pero no es mucho complicado. A ver. En ingles. En anglais, parce que le code—ça va foule mieux en anglais.

Assume you’re given a array of integers sorted in increasing order [3,6,19,21,87]. You job is to write a “search” function that returns the 0-based index of query value, or -1 if val is not in array.

Binary search algorithm

The “usual” algorithm use the start and finish pointers in a weird way, which I found difficult to understand, so I wrote another one. The invariant “we’ve already checked the limits” feels more logical to me.

In JavaScript

In JavaScript the code for the binary search strategy is as follows:

SearchableArray.prototype.binary_search = function (val) {
    var data = this.data;

    if (data.length === 0) return -1;
    if (data[0] === val) return 0;
    if (data[data.length-1] === val) return data.length -1 ;

    var bin_search_limits = function(start,finish) {
        // invariant: data[start] and data[finish] have been checked already
        var mid;
        //console.log(start, finish);
        if (start === finish || start+1 === finish) 
            return -1;

        mid = start + Math.floor((finish-start)/2);

        if (data[mid]===val) {
            return mid;
        } else if (data[mid] < val) {
            return bin_search_limits(mid,finish);
        } else if (data[mid] > val) {
            return bin_search_limits(start,mid);
        }
    };
    return bin_search_limits(0, data.length-1);

};

The full javascript code (with tests;) is here.

In C

It was surprisingly easy to transform the JavaScript code into C. See the code and some basic tests here. The main functions essentially the same:

int bin_search_limits(int *data, int start, int finish, int val) {
      // invariant: data[start] and data[finish] have been checked already
      int mid;

      if (start == finish || start+1 == finish) 
          return -1;

      mid = start + (finish-start)/2;  

      if (data[mid]==val) {
          return mid;
      } else if (data[mid] < val) {
          return bin_search_limits(data,mid,finish, val);
      } else if (data[mid] > val) {
          return bin_search_limits(data,start,mid, val);
      }
  };

int binary_search(int *data, int length, int val) {
  if (length == 0) return -1;
  if (data[0] == val) return 0;
  if (data[length-1] == val) return length-1;

  return bin_search_limits(data,0,length-1, val);
};

In python

The pleasure of implementing binary search in python is left to the reader.


I’ve got to go code learn how to make a hash function to make the C test suite go faster 😉