Skip to main content

StOp 1.4: Simulated Annealing in Python, Part 3: Allocating Groups by AI

I quite enjoy discussions. However, talking just to people within my friend circle can sometimes become boring. After all, I tend to attract similar perspectives, and to occasionally challenge my own outlook, and see things from another vantage point is something I'd like to do. Events with discussion groups are a great place to do this.

But one thing that tends to be a challenge with such events, is who to allocate which group to. Let's say there are 5 discussion groups, and the Google Form you have created allows a prospective participant to select their First-Choice and Second-Choice. How do you decide which groups to allocate to each participant? And this is a more general problem than the obscure idea of a discussion event: it could apply in a virtual conference of educational seminars, or even in class allocations. 

The most interesting part about AI, is its ability to express and solve seemingly subjective problems. Yes, I do mean that Simulated Annealing can solve this problem. Here's my Python Code to solve the problem. Don't worry if you hate Python - this is the last part of this Series, and after some more Stochastic Optimization, we're going to actually get into doing Machine Learning with Python!

To simulate this situation, I first created a Google Sheet with ID, and various First and Second Choices between 1 & 5, which I inputted randomly. Because of this, there's a little bit of Data Manipulation, but that isn't too important to the Annealing, so you can ignore that if you are not familiar with Pandas (a data handling library for Python). After running the second cell, you will need to upload the Sheet of IDs and Choices. You will find that file here. You can download this and then upload it into the button that will become visible when you run the second cell. 

The notebook is available here. Open it, and follow the standard protocol: open with Google Colab to mess with it or run it - or just go through the notebook as visible to get an idea of what we're doing. 

If you'd like to modify the code for some application, I'd love to know how you're using the idea! 

Comments

Popular posts from this blog

Phase Spaces 1 : Graphs and Geometry

Phase Spaces One of the least heard of, and most interesting techniques of the sciences, that you rarely realize you’ve used before. Phase spaces are symbolic representations of a particular problem, which you can then use to solve it. Let’s start with a simple problem - in physics maybe. Let’s say we have a car, as all good physics problems do. You’re driving at a set initial speed, and a set acceleration. At what time would you have travelled exactly 15 ft? Let’s look at it in terms of "a phase space". I have a velocity-time graph down here:                                                                                                                                  Linear Velocity-Time Graph Nothing very exciting, but it’s a useful analogy. Here, the two variables involved (more on that later), are effectively the speed and the time. What you want to know are the success cases (totally a technical term), where the car travels 15 ft, no more, no less. How could you do tha

Phase Spaces 2 : Math and Gradient Descent

I'm going to start from where we left off in the last part of this series. If you haven't read that yet, check that out first if you want a more detailed understanding: We explored what a Phase Space is, why it's useful, what it has to do with Machine Learning, and more!  I'm assuming you've read the previous article, or you know what I talked about there: so let's get to it. At the end of the last article, we discovered that it was the power of mathematics that would help us find the best values of the parameters for the lowest cost function. Before we get into what the Math does, however, we'll need to define some things in the math. If you've done Calculus, and in particular, partial derivatives, you can skip this section, but otherwise I would suggest at least a cursory glance. I don't go into too much detail on the subject, but that's only because you won't need it.  Calculus Interlude: Derivatives- The slope of a graph is a concept you

Stochastic Optimization: NEW MINISERIES!

This is part of my new miniseries on Stochastic Optimization. While this is not taught in a lot of Machine Learning courses, it's an interesting perspective, applicable in an incredible number of fields. Nevertheless, this won't be a very long series, and when we exit it, it'll be time to dive straight into our first Machine Learning algorithm! Introduction to Optimization: Ok, so what is Optimization? As the name may suggest, Optimization is about finding the optimal configuration of a particular system. Of course, in the real world, the important question in any such process is this: in what sense? i.e. By what criteria do you intend to optimize the system? However, we will not delve too much into that just yet, but I promise, that will bring about a very strong connection to ML. Introduction to Stochastic Optimization: So far, as part of our blogposts, we have discussed Gradient Descent and the Normal Equation Method . These are both Optimization algorithms, but they di