#import "@preview/touying:0.6.1": * #import themes.university: * #show: university-theme.with( aspect-ratio: "16-9", config-info( title: [bioai - assignment 1], author: [fredrik robertsen], date: "09.02.2026", institution: [ntnu idi], logo: box(image("ntnu.png", height: 1em)) ), ) #title-slide(authors: [fredrik robertsen]) == problem 1 - binary knapsack - there are many items, each with a value and weight - the knapsack you are wearing can only carry so much weight - you want the most bang for your buck - what's the best _combination_ of items to keep? - combinatory problem, np hard - approximate using a genetic algorithm - this is like optimizing your inventory in games like skyrim - do you want 400 spoons in your pocket, each worth a dime, or do you want that gold bar that weighs a ton? - formally, you want to maximize $z = sum_(j=1)^n p_j x_j$ such that $sum_(j=1)^n w_j x_j <= c$ where $x_j in {0, 1}$ - for item $j$: $p_j$ is the profit; $w_j$ the weight; $x_j$ whether to keep it == problem 2 - feature selection - similar to the binary knapsack problem - this time you have many data points - each data point consists of _features_ - each data point has an associated _output_ - you wish to eliminate the features that are least influential in producing a given output - this is like choosing what items to keep in your knapsack - this is like weather forecasting - hundreds of features in data - which are most relevant? - which are noise? == general implementation - generate a population of randomized chromosomes - calculate their fitness values - perform a _tournament selection_ to choose parent chromosomes - more fit individuals are more likely to be selected - introduces less diversity - combine two parents to form two children via _single point crossover_ - mutate children randomly - merge children into population, evicting the least fit individuals - this is the _elitism survivor selection_ - repeat == specific implementation - fitness function - used the sum mentioned earlier - used linear regression and rmse for feature selection == optimizations todo == results todo == conclusion todo