Don’t add Django migrations to version control,, at least.

And here’s the one thing that might be useful, might not: committing
your migrations to version control.

Here’s the situation: you’re working on the models for a Django app.

class Dog(models.Model):
    owner = models.ForeignKey(Person, on_delete=models.CASCADE)
    name = models.CharField(max_length=255)
    age = models.IntegerField()

Hmm, perhaps age should be date-of-birth. After all, you don’t want to
have to write some script to be updating the age value for every dog
every year. No, perhaps it should be named dob after all.

So you make the change in and add the migrations for the
changes as well, they get saved as or

Problem is, your colleague has been working on the very same model, and
he had added some other fields too:

class Dog(models.Model):
    owner = models.ForeignKey(Person, on_delete=models.CASCADE)
    name = models.CharField(max_length=255)
    dob = models.DateField()
    fav_foods = models.CharField(max_length=255, blank=True)
    potty_trained = models.BooleanField(default=False)

The migration that changes the first code snippet to the second in
PostgreSQL gets saved as, and now your
django-migrate fails after a git pull. Because
assumes that age is still there and it’s a models.IntegerField, but the
database on your machine looks different because you already renamed age
to dob. Git can resolve conflicts between your, but not
between the Django migrations.

So it’s best to just not add those migrations to the code repository
unless you’re really sure that only one guy is working on the models.
Because if more than one guy is working on the models, then everybody’s
databases are different and the migrations can’t resolve that. You might
as well do django-manage makemigrations from scratch.

Unless, of course, you already have data in there.

Machine Learning Tutorials

Machine Learning

  1. Dr Jason Browniee’s
    Machine Learning
    is for everybody, even total beginners, who’ve heard the
    hype about ML, and want to get in on the action. It’s step by step,
    simple and very easy to follow.
  2. Once one has done quite a few chapters into Machine Learning Mastery
    it’s good to check out ujjwalkarn’s Github list of
    Learning and Deep Learning Tutorials

Neural Networks

  1. If you’re totally new to neural networks, Andrej Karpathy’s
    Hacker’s Guide to Neural
    is hands down the best. No complex formulas, no jargon,
    just plain and simple concepts demonstrated with code (which you
    should definitely rewrite to fully understand).
  2. Genetic Algorithms
    for tuning the weights of an existing neural network: pretty cool,
    although this is just one way to train a neural network. I’d imagine
    one would use the gradients in Karpathy’s tutorial to get to a pretty
    well trained neural network, and then use the genetic algorithm to
    make small improvement tweaks from there.