-
9 votes
-
Indonesian police officer claims he was fired for being gay, files lawsuit for wrongful dismissal
4 votes -
Grazhdanskaya Oborona - Lobotomija (Lobotomy) (1989)
3 votes -
Denmark's first high-speed rail line officially inaugurated
5 votes -
Why do people faint?
6 votes -
US Iran sanctions spell the end of diplomacy, senior official says
7 votes -
Canada’s chance for a Green New Deal
4 votes -
Our Stories: How Instagram accounts like @lgbt_history and @h_e_r_s_t_o_r_y are weaving queer history into everyday life.
4 votes -
Sweden is on track to see a record number of British people applying for Swedish citizenship this year
4 votes -
A generation of hip-hop was given away for free. Can it be archived?
6 votes -
The Girl With The Dragon Tattoo – Breaking convention
5 votes -
Twins for a Day
8 votes -
Istanbul mayoral re-run: Turkey's ruling AKP set to lose in blow for Erdoğan
27 votes -
How Oxford university shaped Brexit — and Britain’s next prime minister
13 votes -
Celebrating thirty years of Warp with a special weekend broadcast. Warp Records and NTS present WXAXRXP Fri 21 June 2019 12:00 — Sun 23 June 2019 23:59
7 votes -
Bill Gates on making “one of the greatest mistakes of all time”
10 votes -
Norway is building the world's first submerged floating tunnel to cross the fjords
7 votes -
Sweden beat Canada 1-0 in a hard-fought game at the Women's World Cup
4 votes -
What have you been listening to this week?
What have you been listening to this week? You don't need to do a 6000 word review if you don't want to, but please write something! If you've just picked up some music, please update on that as...
What have you been listening to this week? You don't need to do a 6000 word review if you don't want to, but please write something! If you've just picked up some music, please update on that as well, we'd love to see your hauls :)
Feel free to give recs or discuss anything about each others' listening habits.
You can make a chart if you use last.fm:
http://www.tapmusic.net/lastfm/
Remember that linking directly to your image will update with your future listening, make sure to reupload to somewhere like imgur if you'd like it to remain what you have at the time of posting.
13 votes -
SpaceX preps Falcon Heavy for “most difficult” flight
9 votes -
When Myspace was king, employees abused a tool called ‘overlord’ to spy on users
8 votes -
Statement on 32-bit i386 packages for Ubuntu 19.10 and 20.04 LTS
11 votes -
Updates to "Activity" sorting method (the site's default)
Since it launched, Tildes has always been using "Activity" as the site's default sorting method, which behaves like a classic forum—any new comment in any topic causes it to "bump" back to the top...
Since it launched, Tildes has always been using "Activity" as the site's default sorting method, which behaves like a classic forum—any new comment in any topic causes it to "bump" back to the top of the list. This has generally worked well overall, and has been a good way to keep threads visible and active over longer periods.
However, there have been a few issues related to it, such as controversial threads staying at the top of the site for long periods of time, and bickering back and forth between two users causing threads to constantly bump back up to the top even if nobody else is interacting with the topic at all. We haven't had great ways to deal with this so far, and have mostly had to work around it by setting the default time period to "last 3 days" so that threads can't dominate the site indefinitely, or even locking threads to force them to drop off.
As an attempt at a better solution, "Activity" has now had its behavior changed so that topics will only bump to the top when something "interesting" happens, instead of for every single comment. The exact methods we're using to determine "interesting" will need experimentation and to be adjusted as we see how they work, but initially it's entirely based on comment labels:
If a comment or any of its parent comments has an active Noise, Offtopic, or Malice label (note: it generally takes at least two users applying the label to make it "active"), the comment will not cause the thread to bump to the top. For example, this means that if a particular comment gets labeled as Offtopic, any replies "below" that comment will no longer bump the thread in the Activity sort. This will also apply retroactively, so if someone posts a new top-level comment, the thread will still initially bump to the top, but if that comment is then labeled as Noise, it will "un-bump" and return back to its previous location in the listing.
Since this will give us a better way to prevent threads from staying at the top of the site forever, I've also now changed the default time period back to "all time".
If you'd rather keep the previous behavior and continue having threads always bump to the top when a new comment is posted in them, you can use the new "All activity" sorting method instead. Logged-in users can set it as their default sorting across the site by changing to it on the home page and clicking "Set as default" to the right of the time period dropdown.
Any feedback is welcome, but these are questions that I'm particularly interested in:
- Are there cases where the label-based "uninteresting" judgment won't work well? Links to specific examples would be ideal, if possible.
- What other methods could we use to judge a new comment as "uninteresting"?
- Should we try triggering bumps from other non-comment events? For example, if a topic is getting voted up a lot, should it bump even if there isn't a new comment?
As usual, I've also given everyone 10 invites again (and don't worry, I haven't forgotten about turning the visible comment votes back on either, and I'll do that this afternoon, along with posting a thread to discuss it).
65 votes -
How people want to feel determines whether others can influence their emotions, Stanford psychologists find
7 votes -
Staining The Timbre XXL Freshman Class Review Series - Megan Thee Stallion
2 votes -
England fans escorted from stadium amid Cameroon World Cup tensions
5 votes -
What happens after Amazon’s domination is complete? Its bookstore offers clues
11 votes -
Who actually ruined the Borg?
9 votes -
DJ Shadow - Stem/Long Stem (1996)
8 votes -
Albert Einstein's relativity document gifted to Nobel museum
4 votes -
Secrets and lies at Guantanamo Bay: Listening devices, FBI informants, and gag orders… these are just some of the ways that the US is mishandling classified information in the Al Qaeda trials
5 votes -
Genetic Algorithms
Introduction to Genetic Algorithms Genetic algorithms can be used to solve problems that are difficult, or impossible to solve with traditional algorithms. Much like neural networks, they provide...
Introduction to Genetic Algorithms
Genetic algorithms can be used to solve problems that are difficult, or impossible to solve with traditional algorithms. Much like neural networks, they provide good-enough solution in short amount of time, but rarely find the best one. While they're not as popular as neural networks nor as widely used, they still have their place, as we can use them to solve complicated problems very fast, without expensive training rigs and with no knowledge of math.
Genetic algorithms can be used for variety of tasks, for example for determining the best radio antenna shape, aerodynamic shapes of cars and planes, wind mill shapes, or various queing problems. We'll use it to print "Hello, World!".
How does it work?
Genetic algorithm works in three steps.
- Generate random solutions
- Test how good they are
- Pick the best ones, breed and mutate them, go to step 2
It works just like evolution in nature. First, we generate randomised solutions to our problem (in this case: random strings of letters).
Then, we test each solution and give it points, where better solutions gain more points. In our problem, we would give one point for each correct letter in the string.
Afterwards, we pick the best solutions and breed it together (just combine the strings). It's not bad idea to mutate (or randomize) the string a bit.
We collect the offsprings, and repeat the process until we find good enough solution.
Generate random solutions
First of all, we need to decide in which form we will encode our solutions. In this case, it will be simply string. If we wanted to build race cars, we would encode each solution (each car) as array of numbers, where first number would be size of the first wheel, the second number would be size of the second wheel, etc. If we wanted to build animals that try to find food, fight and survive, we would choose a decision tree (something like this).
So let's start and make few solutions, or entities. One hundred should be enough.
from random import randint goal = "Hello, World!" allowed_characters = list("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM ,!") def get_random_entity(n, string_length): entities = [] for _ in range(0, n): entity = "" for _ in range(0, string_length): entity += allowed_characters[randint(0, len(allowed_characters)-1)] entities.append(entity) return entities print(get_random_entity(100, 13))
Test how good they are
This is called a "fitness function". Fitness function determines how good a solution is, be it a car (travel distance), animal (food gathered), or a string (number of correct letters).
The most simple function we can use right now will simply count correct letters. If we wanted, we could make something like Levenshtein distance instead.
def get_fitness(entity): points = 0 for i in range(0, len(entity)): if goal[i] == entity[i]: points += 1 return points
Crossover and mutation
Now it's time to select the best ones and throw away the less fortunate entities. Let's order entities by their fitness.
Crossover is a process, when we take two entities (strings) and breed them to create new one. For example, we could just give the offspring one part from one parent and another part from second parent.
There are many ways how to do this, and I encourage you to try multiple approaches when you will be doing something like this.
P: AAAABBB|BCCCC P: DDDDEEE|FGGGG F1: AAAABBB|FGGGG
Or we can just choose at random which letter will go from which parent, which works the best here. After we have the offsprint (
F1
), we should mutate it. What if we were unfortunate, andH
(which we need for ourHello, World!
) was not in any of the 100 entities? So we take the string and for each character of the string, there is a small chance to mutate it - change it at random.F1: ADDDEBEFGCGG F1`: ADHDEBEFGCGG
And it's done. Now kill certain part of old population. I don't know which percentage is best, but I usually kill about 90% of old population. The 90% that we killed will be replaced by new offsprings.
There is just one more thing: which entities do we select for crossover? It isn't bad idea - and it generally works just fine - to just give better entities higher chance to breed.
def get_offspring(first_parent, second_parent, mutation_chance): new_entity = "" for i in range(0, len(first_parent)): if randint(0, 100) < mutation_chance: new_entity += allowed_characters[randint(0, len(allowed_characters)-1)] else: if randint(0, 1) == 0: new_entity += first_parent[i] else: new_entity += second_parent[i] return new_entity
When we add everything together, we get this output:
Generation 1, best score: 2 ::: QxZPjoptHfNgX Generation 2, best score: 3 ::: XeNlTOQuAZjuZ Generation 3, best score: 4 ::: weolTSQuoZjuK Generation 4, best score: 5 ::: weTgnC uobNdJ Generation 5, best score: 6 ::: weTvny uobldb Generation 6, best score: 6 ::: HellSy mYbZdC Generation 7, best score: 7 ::: selOoXBWoAKn! Generation 8, best score: 8 ::: HeTloSoWYZlh! Generation 9, best score: 8 ::: sellpX WobKd! Generation 10, best score: 9 ::: welloq WobSdb Generation 11, best score: 9 ::: selloc WoZjd! Generation 12, best score: 10 ::: wellxX WoVld! Generation 13, best score: 10 ::: welltX World! Generation 14, best score: 10 ::: welltX World! Generation 15, best score: 10 ::: welltX World! Generation 16, best score: 11 ::: zellov Wobld! Generation 17, best score: 11 ::: Hellty World! Generation 18, best score: 11 ::: welloX World! Generation 19, best score: 11 ::: welloX World! Generation 20, best score: 11 ::: welloX World! Generation 21, best score: 12 ::: welloX World! Generation 22, best score: 12 ::: Helloy World! Generation 23, best score: 12 ::: Helloy World! Generation 24, best score: 12 ::: Helloy World! Generation 25, best score: 12 ::: Helloy World! Generation 26, best score: 12 ::: Helloy World! Generation 27, best score: 12 ::: Helloy World! Generation 28, best score: 12 ::: Helloy World! Generation 29, best score: 12 ::: Helloy World! Generation 30, best score: 12 ::: Helloy World! Generation 31, best score: 12 ::: Helloy World! Generation 32, best score: 12 ::: Helloy World! Generation 33, best score: 12 ::: Helloy World! Generation 34, best score: 13 ::: Helloy World! Generation 35, best score: 13 ::: Hello, World!
As we can see, we find pretty good solution very fast, but it takes very long to find perfect solution. The complete code is here.
Maintaining diversity
When we solve difficult problems, it starts to be increasingly important to maintain diversity. When all your entities are basically the same (which happened in this example), it's difficult to find other solutions than those that are almost the same as the currently best one. There might be a much better solution, but we didn't find it, because all solutions that are different to currently best one are discarded. Solving this is the real challenge of genetic algorithms. One of the ideas is to boost diverse solutions in fitness function. So for every solution, we compute distance to the current best solutions and add bonus points for distance from it.
20 votes -
From two bulls, nine million dairy cows
5 votes -
Generative Adversarial Networks - The story so far
6 votes -
Italy beats Sweden to host 2026 Winter Olympics
7 votes -
How Verizon and a BGP optimizer knocked large parts of the internet offline today
14 votes -
Ann Sarnoff named Warner Bros. CEO in surprise pick
3 votes -
The history of the Elite Beat Agents / Osu! Tatakae! Ouendan series
5 votes -
How the Swedish town of Eskilstuna became the world capital of recycling
5 votes -
In the largest protests in decades, Czechs demand resignation of prime minister
8 votes -
Dutch telephone outage takes out nation’s emergency number for over three hours
9 votes -
Every way to cook a potato (sixty-three methods) | Bon Appétit
4 votes -
A crispy, salty, American history of fast food
3 votes -
What is a scam that people should know about?
There are, sadly, far too many people and companies out there more than willing to take advantage of people. Fortunately, awareness is usually a good defense. What are some scams that we should...
There are, sadly, far too many people and companies out there more than willing to take advantage of people. Fortunately, awareness is usually a good defense. What are some scams that we should all know about so that we don't fall for them?
38 votes -
"13 Minutes to the Moon" - BBC documentary podcast on Apollo 11
7 votes -
Digging deeper into Pompeii's past
6 votes -
9 top subreddits for tech sustainability enthusiasts
2 votes -
Trey Anastasio on the endurance of jam bands and the life of Phish
4 votes -
Pastry chef, Claire Saffitz, attempts to make "gourmet" Starburst | Gourmet Makes
6 votes -
The Cube Rule of food identification
22 votes