Skip to content
ml-recall

#code-reading

44 questions from Genetic Algorithms, Linear Algebra, Information Theory, Logistic Regression & Softmax, Learning Theory, Dimensionality Reduction, Neural Network Basics, Deep Learning Frameworks, Convolutional Neural Networks, Graph Neural Networks, Transfer Learning, Explainable AI, Computer Vision Basics, Object Detection, Segmentation, Autoencoders & VAEs, Diffusion Models, Fine-tuning & PEFT, Alignment & Reasoning, PyTorch

Timed test

20 questions · 20 min · score and explanations at the end

Longer test or by difficulty: mixed test with #code-reading

Take a test
Q 1 / 44Score 0 / 0

Question 1: True or false

mediumAI-checkedGenetic Algorithms

This is the main loop of the aima-python genetic algorithm. select samples two parents with fitness-proportionate probability, recombine is one-point crossover, and mutate changes one gene with probability pmut.

def genetic_algorithm(population, fitness_fn, gene_pool=[0, 1], f_thres=None, ngen=1000, pmut=0.1):
    for i in range(ngen):
        population = [mutate(recombine(*select(2, population, fitness_fn)), gene_pool, pmut)
                      for i in range(len(population))]
        fittest_individual = fitness_threshold(fitness_fn, f_thres, population)
        if fittest_individual:
            return fittest_individual
    return max(population, key=fitness_fn)

True or false: with this loop, the best fitness in the population can never decrease from one generation to the next.

Choose one option