What AI taught me

So i was browsing the web and came across this paper A high-order recombination algorithm for weak approximation of stochastic differential equations a way above my intelligence level, but I always wondered how people use these crazy alien looking equations.

So i copy and pasted it to ChatGPT and the first explanation was again way over my intelligence level so I had it explain to me as if i was a teenager

Sure — here’s a simple way to think about it:

Imagine you’re trying to learn the best way to do something, like win a game or solve a puzzle. You don’t know the perfect strategy yet, so at each step, you mix different ideas (strategies) and try them out to see what works best.

Now, think of each idea or strategy as a "player" in your team. At each round (call it step i), you have some confidence in each player — that's what the weights αj\alpha_j represent. The more confident you are, the bigger the weight.

The equation is basically saying:

"Hey, after I apply this smart learning rule (called Alg and Q), I take my current team mix and recalculate my new team (for the next step, i+1) by seeing how well each idea transfers over using a table of scores (that’s the weight matrix w(i))."

So you're updating your mix of strategies based on how much each old idea contributes to new ideas in the next round.

It’s like upgrading your strategy team over time, keeping track of who’s helping the most and adjusting your trust in them.

 

So stoked! Who wouldn't want to know an algorithm to help them find the best way to do something? I love when I randomly come across such useful information on the web its like "Internet Gold".

Now how can I apply this in real life? I ask chatGPT to show me in a language I can understand.

Here’s an interactive version of the strategy learning loop in PHP CLI — it asks you (the user) to give feedback manually for each strategy in each round (e.g., "Did the user like the content? Yes or No?").

This simulates you being the decision-maker or tester of each strategy.

 

<?php

$strategies = ['popular_videos', 'similar_likes', 'geo_trending'];
$alpha = [0.4, 0.4, 0.2];

$w = [
[0.6, 0.3, 0.1],
[0.2, 0.6, 0.2],
[0.1, 0.3, 0.6]
];

function normalize($vector) {
$sum = array_sum($vector);
return array_map(fn($v) => round($v / $sum, 3), $vector);
}

function ask($prompt) {
echo $prompt . " (y/n): ";
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
return strtolower(trim($line)) === 'y' ? 1 : 0;
}

function showBar($label, $value, $width = 30) {
$barLength = round($value * $width);
$bar = str_repeat("█", $barLength);
printf("%-18s [%-30s] %.2f\n", $label, $bar, $value);
}

for ($round = 1; $round <= 10; $round++) {
echo "\n=== Round $round ===\n";

// Collect feedback
$feedback = [];
foreach ($alpha as $i => $weight) {
$strategy = $strategies[$i];
$reward = ask("Did the user like content from '{$strategy}'?");
$feedback[$i] = $weight * $reward;
}

// Update using transition matrix
$newAlpha = array_fill(0, count($strategies), 0);
foreach ($feedback as $k => $scaled_weight) {
foreach ($strategies as $j => $_) {
$newAlpha[$j] += $scaled_weight * $w[$k][$j];
}
}

// Normalize
$alpha = normalize($newAlpha);

// Display new weights visually
echo "\nUpdated Strategy Weights:\n";
foreach ($strategies as $i => $s) {
showBar($s, $alpha[$i]);
}
}

 

Output example:

=== Round 3 ===
Did the user like content from 'popular_videos'? (y/n): y
Did the user like content from 'similar_likes'? (y/n): n
Did the user like content from 'geo_trending'? (y/n): y

Updated Strategy Weights:
popular_videos [███████████████████████ ] 0.65
similar_likes [██ ] 0.07
geo_trending [█████████ ] 0.28

Its pretty awesome how ChatGPT was able to take a random alien looking equations I found and break it down in a way that I can understand and even apply in my own projects.

I dive much deeper, but dont want to bore you, if your interested here is the conversation here

Leave a Comment

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.