I love the stories where students solve unsolved problems just because the professor neglected to tell them it was difficult.
@CaioMizerkowski3 жыл бұрын
Me too, those are the best stories.
@AA-gl1dr3 жыл бұрын
"Just call it entropy, nobody really knows what it is" Truly an intelligent man.
@stevenneuberger43232 жыл бұрын
I think either John Von Neuman was joking or just being a dickhead
@busterdafydd30969 ай бұрын
10:59 yea what they mean is that entropy seems to be what they are explaining, and if someone disagrees, you can ask them, make a mathematical proof (different to ours) that defines "entropy". what Shannon found I think is entropy. but sadly I don't think @Reducible is explaining it quite right. Entropy and prediction should not be in the same sentence. Entropy is looking at data/environment and asking how much information can be used to define this information. high entropy is when the information cannot be described with less information. repeating patterns of course the easiest defined by less information the the original information. Prediction (inference-ing) has a time/event element to it. Or if you did approach a repeating pattern it doesn't look at the whole pattern and is always asking from what I can see of the pattern so far what would be the next part of it? something is not very predictable if you can't guess what comes next. it sounds the same but really should be careful to overlap these ideas.
@paradoxicallyexcellent51383 жыл бұрын
The section leading up to 8:00 epitomizes a problem solving technique that sets apart mathematicians: rather than directly search for a formula that describes a thing, instead list what *properties* you expect that thing to have. Make deductions from those properties, and eventually all kinds of insights and formulas fall on your lap.
@sixhundredandfive71233 жыл бұрын
Would encoding something in Base Three (using either "0, 1, 2" or "0, 1, .5" ) increase the amount of information transmitted because there's an extra number or decrease the amount of information transmitted because you can make more complicated patterns?
@klobiforpresident22542 жыл бұрын
@@sixhundredandfive7123 Base three (or any alphabet of three symbols) can encode more information *per symbol*, which means fewer symbols are needed to represent some information (a message). That would mean messages are shorter but have the same overall amount of information.
@user_27932 жыл бұрын
Yeah that's also how you actually obtain the determinant, the most striking example to me. You prove that the 'set' of all alternating (swapping two rows makes it negative) multilinear (breakup of the determinant based on the row property) forms on matrices (with elements belonging to a commutative ring with identity), and which outputs 1 for the identity matrix is a unique function, the determinant. From this definition you can obtain a nicer result that is every alternating n linear form D on n n-tuples which give the matrix A on stacking must satisfy D(A) = detA D(I). This is used to prove a lot of properties concerning determinants.
@jimboli94003 жыл бұрын
The legend is back. I love your work, the production quality, the content, everything! You are the computer science equivalent of 3b1b.
@muskyoxes3 жыл бұрын
Hopefully not the equivalent of the 3b1b who apparently stopped making videos
@Mogwai883 жыл бұрын
@@muskyoxes looks like he is that too lol
@multiarray23202 жыл бұрын
@@muskyoxes b...but he still makes videos...
@strictnonconformist73692 жыл бұрын
The wisest thing Huffman’s professor did was not mention it was an unsolved problem. Great, clear presentation, others on youTube are so fast they require you to pretty much already know how it works before you watch it, which is insane.
@TheQueencircleAcademy6 ай бұрын
👌🏽
@chopper3lw Жыл бұрын
Many years ago after studying this algorithm I sent a fan letter to D. Huffman. He wrote back in appreciation because he'd never gotten a fan letter before.
@alexismandelias3 жыл бұрын
Having also learned the Huffman encoding algorithm as an example of a greedy algorithm (along with its accompanying greedy-style proof), this video provided me with a new perspective which, combined with the interesting history of alternative algorithms, gave me a fuller understanding and appreciation for the topic, which I have to admit is extremely well presented!
@mementomori71603 жыл бұрын
20:26, "optimal binary representation must have the two least likely symbols at the bottom of the tree" My first thought: "So can we count it as one node and repeat the process? Nah, that can't be right, that would be too easy" XD turns out it really is easy
@r75shell3 жыл бұрын
You actually need to proof that you may build node with two of those. Also, author of video didn't prove why they should have longest number of bits, it's not so obvious, you need to apply exchange argument, most basic one though.
@OmarChida3 жыл бұрын
At that moment I thought "just apply the same process recursively" which turns out to be the case
@aethrya Жыл бұрын
Man it's so amazing that any of this works at all. Being an autodidact philomath and self educated amateur mathematician and cryptographer, I am so glad to have all of this information available to learn at my own pace. Thank you.
@emmamovsesyan2 жыл бұрын
The smallest shift in perspective can sometimes make all the difference
@ShefsofProblemSolving Жыл бұрын
I just recently learned about Huffman encoding and this video is absolutely AMAZING. You really motivated the solution incredibly well! Congratulations and hope you make more videos
@erumabo3 жыл бұрын
I really love this algorithms that look so obvious and simple yet I know that even with all the time on the world I couldn't have invented them myself.
@wampwamp14583 жыл бұрын
This video is an amazing compilation of information, in a well presented order and in an engaging way. Information well encoded! Cheers
@viveksomani8462Ай бұрын
This video does an excellent job giving an intuition. It's still complicated for someone who hasn't done much with information theory, so I had to pause to really understand some parts of it -- but this video helps a lot and makes the topic really interesting. This idea of entropy in information theory is also used in seemingly unrelated areas, like deciding which splits to take with a decision tree (or random forests).
@FreestateofOkondor3 жыл бұрын
Your presentation is entertaining, thought-provoking and truly educational. One of the best channels on KZbin in my opinion.
@NeotenicApe3 жыл бұрын
People be sleeping on this channel. Incredible content.
@Mutual_Information3 жыл бұрын
This is very impressive. It takes a lot of hard to present so much so well. Excellent vid!
@17ashwinipatel723 жыл бұрын
woahhhhhhhhhh 🔥🔥🔥🔥🔥🔥 I absolutely have no words for this masterpiece. The way you explained it, now I'm going to take my information theory classes seriously 😂 Thanks a lot. Great work! Sharing this with my friends as this deserves lot more appreciation ♥️
@RequiosWoW3 жыл бұрын
I'm taking numerical analysis course right now, and my chapter was just on Huffman Codes, great timing!
@rccowboys2 жыл бұрын
This has got to be the most amazing video I have ever seen. Seriously! It was absolutely the most intriguing thing I have never pondered. Great explanation skills for slow people like me but yet very entertaining at the same time. Thank you sir for your effort and information!
@kwinvdv3 жыл бұрын
The Huffman encoding algorithm looks very similar to dynamic programming. So I wondered which came first, and it seems that they where both development around the time, namely around the year 1952.
@smolboi96593 жыл бұрын
Yea I googled and apparently, this is a greedy algorithm that converges to the global optimal. Greedy algos and dynamic programming are similar in that they utilise the subproblems to build up the full solution. In general greedy algorithms only converge to local optimizers as they do not exhaustively check all subproblems and is faster. DP is slower but global optimality is guaranteed. For this problem the greedy algo guarantees the global optimal and we have the best of both worlds.
@grahamhenry93682 жыл бұрын
Huffman encoding is only optimal if each symbol is conditionally independent of all previous symbols, which is almost never the case, which is why Huffman encodings didn’t solve compression, though they are typically used as part of a broader compression algorithm. Ray Solomonoff did a lot of important work in this area with his invention of algorithmic complexity theory
@redpepper742 жыл бұрын
Ooh interesting. In the equation constraints section it was mentioned (almost as just a side note) that the events had to be independent of each other, and for a moment I wondered what if they weren’t independent? Now I want to know :0
@grahamhenry93682 жыл бұрын
@@redpepper74 You can compress a lot more when the symbols are conditionally dependent upon previous symbols, but you need to use other methods, typically those that rely upon conditional probability
@grahamhenry93682 жыл бұрын
@@redpepper74 Huffman encodings are based purely on symbol frequencies, and don’t take into account what symbols came before. So for example, if you see the sequence of symbols “Mary had a little” you can immediately recognize that the next four symbols are very likely to be “lamb”, with a high degree of probability. Huffman codes do not see this
@redpepper742 жыл бұрын
@@grahamhenry9368 I suppose what you could do then is get a separate Huffman encoding table for each symbol that tells you how likely the next symbol is. And instead of using single characters you could use the longest, most common groups of characters
@grahamhenry93682 жыл бұрын
@@redpepper74 Yeap, I actually coded this up once, but only looking back at the last character. The important idea here is that the ability to predict future symbols directly correlates with how well you can compress the data because if a symbol is very probable then you can encode it with fewer bits via a Huffman encoding. This shows that compression and prediction are two sides of the same coin. Markus Hutter has done a lot of work in this area with his AI system (AIXI) that uses compression algorithms to make predictions and attempts to identify optimal beliefs
@pafloxyq3 жыл бұрын
Really loved it! It was knowing about Huffman codes that made me take information theory classes. It is really an elegant piece of mathematics.
@niofer72473 жыл бұрын
Great video. Though I was a bit confused in the end and going further in depth with an example of using the huffman encoding and decoding, while comparing it to uncompressed encoding would make it a bit clearer. Still an amazing video!
@alexrhinefield1233 жыл бұрын
How am I just finding this channel? This guy’s awesome
@joeeeee87383 жыл бұрын
This channel is pure gold
@Danielle_12343 жыл бұрын
Best explanation of Huffman Encoding I've seen. Bravo!
@aethrya Жыл бұрын
10:50 JvN's second and most important reasoning for the term _entropy_ is truly the genius of a mad mathematician.
@pellythirteen5654 Жыл бұрын
I've watched many of your beautiful presentations and found them very instructive. This one not only clearly demonstrates Huffman's idea , but also the "bottleneck" in any communication channel formalized by Shannon himself.
@Some.username.idk.03 жыл бұрын
Yoooo, your videos are awesome, great day when you upload
@yakov9ify3 жыл бұрын
21:09 S_1 S_2 don't HAVE to be on the same node on the optimal tree, in fact they can be exchanged with any other nodes on the bottom layer. What is instead true is that you always can construct an optimal tree with them paired from one where they are not through the aforementioned exchange.
@tru19882 жыл бұрын
Your voice is great, the visuals are on point, and I finally understand Huffman codes. Great job; subscribed!
@fredg83283 жыл бұрын
Very good video. That's the first one I see on youtube that put together Shannon-Fano and Huffman coding and tries to explain the differences between them. Most of them only explain the Huffman algorthm and discard all the history behind it
@tejaswibiduru51313 жыл бұрын
Dude long time no see.. I am so happy that you are back. Please make more videos...
@gplgomes2 жыл бұрын
Guy, thank you for this amazing video.
@PeterDebney Жыл бұрын
There was a lot of information in that video, and I could decode it all! 🙂 It is definitely not easy to explain something so well, so thank you.
@buzzyproton58853 жыл бұрын
Underrated channel
@anasbekheit54792 жыл бұрын
I think there's a missing negative sign in the lengths at 16:11,anyway one of the best videos on the topic, I subscribed awhile ago and i don't regret it .
@leyasep59193 жыл бұрын
The Huffman algo is so brilliant... GIF's LZW is another system that sounded obscure until I dared looking and it was in fact much simpler than I thought. It would be a great subject for your next videos.
@huffmancollins6142 жыл бұрын
Hey its me Huffman. I made these codes.
@prodigy-3433 жыл бұрын
KZbin algorithm usually sucks, just put on your feed some shitty latin music or just the stupid trending stuff, but today feels generous, long long time ago that I don't see content like this, man keep going, you have an incredible way to explain things, simple but clear and clever, amazing channel pal
@antiraedus3 жыл бұрын
Wow. Great video! The way you explained it was so clear and succinct that I guessed "Oh shit it's recursion!!" at 23:12. Good work on the organisation of explaining topics & pacing, love this channel!
@JayLikesLasers2 жыл бұрын
I'm only just starting to learn about Information Theory - but this was very accessible. Thanks, subscribed.
@Darth_Pro_x3 жыл бұрын
Just yesterday I wondered when you'll upload next. Awesome video as usual!
@moopoo1233 жыл бұрын
This was so fun to watch. Please keep making more videos.
@telemanchos79863 жыл бұрын
Incredible educative video, I respect the amount of work you put into this! I enjoyed the overview of the field and the connection between information and probability theory was splendidly shown! I'm looking forward to your future videos!
@redpepper742 жыл бұрын
This was a really cool watch! The more I immerse myself into information theory the more it interests me :D I do disagree with the part about the importance naming things though- names have power! The roots in a word tell you what it means, the meanings of a word in some contexts hint at the meaning in others, and the connotation that a word has affects the way that people think about it. (Yes my passion for writing clean code has turned me into someone who thinks way too much about naming conventions :P )
@jursamaj2 жыл бұрын
On the other hand, words can develop meanings well beyond their origins. Also, even the original meaning doesn't always perfectly correlate to the roots. It just isn't as simply as you claim.
@typingcat2 жыл бұрын
23:40 I have seen other videos about the Huffman tree construction before watching this video, but this explanation is clearest. I was not sure how the nodes after the initial two nodes should be added.
@ゾカリクゾ3 жыл бұрын
The day Reducible uploads is a good day
@Ouuiea3 жыл бұрын
As always, amazing quality of a video!! loved it. Please keep doing them
@stefanioan75693 жыл бұрын
Great video. I really appreciate the hard work and explanations you put in your videos.
@ViktorFerenczi3 жыл бұрын
Good visual explanation. But the part actually encoding a message into bits an decoding the message was completely missing. So while the method how we get the optimal encoding is clear, how to apply the Huffman encoding is not explained at the end. Also, this compression rate applies only in the limiting case (infinite stream lengths) where sending the distribution (tree) to the decoder is negligible. In real data compression the compressed stream, file or block must include the distribution as well.
@Reducible3 жыл бұрын
Good feedback, thank you. These details were part of the script at one point, but I kind of went back and forth on whether I should include it in the final version of the video. I decided to not include them to maintain focus on the actual motivation of Huffman codes, but thank you for bringing these details up in this comment. They are indeed an essential part of doing this in practice.
@wChris_3 жыл бұрын
@@Reducible maybe in a follow-up video you can explain how you would implement this in practice and maybe how its done in the real world like the Deflate algorithm
@atrus38233 жыл бұрын
I completely disagree with this critique. There are already a lot of videos showing how to compute Huffman codes and plenty of tutorials on programming an encoder/decoder. This focuses on the what is missing from the usual teaching (you could say it maximizes information entropy): an intuitive, high-level overview of how the code evolved, where it came from, what it means, etc., as well as beautiful visuals. Usually, videos on these kinds of topics are dry, textbook descriptions with nothing but formulas and step-by-step instructions on computation. I also think that when being introduced to new ideas, introducing too many practical, real-world considerations can muddy the waters and make things really hard to understand. Once a good understanding is in place, then as you introduce complexity, it makes sense where it is coming from and why it matters.
@drabart61213 жыл бұрын
@@atrus3823 It was not a video premise to show how to compute them, but a brief explanation of decoding would have been nice.
@ItsDrike3 жыл бұрын
I disagree, he did explain how to turn binary trees into bit representations at the start, while this wasn't done in the code example, in my opinion, that's fine, it's easy enough to figure out, i.e. assign 0es to left branches, assign 1s to right branches (or vice-versa), since the Node class is keeping track of what's on right/left, it really wouldn't be hard to get the binary representations, and including this in the video would just be distracting and not as important to understand how the algorithm works.
@romanpleshkov11252 жыл бұрын
man I love this channel. so well made.
@madvoice37033 жыл бұрын
Thank you sir because of your vedio I learned how uncertainty is compressed in our nature
@abu-bakrmohamed17076 ай бұрын
What an exceptional video , that was so fun !
@rexlin282 жыл бұрын
Holy!! Thanks for the journey and nice video! :D
@dixztube2 жыл бұрын
You broke this down soooo well
@aaryunik9 ай бұрын
Lovely explanation and storytelling!
@emperorpingusmathchannel53653 жыл бұрын
Thank you for keeping it precise but also intuitive!!!
@thewiirocks Жыл бұрын
I’m not too proud to admit that the first time I tried implementing Huffman Encoding, I just could not wrap my head around it. It didn’t matter how many times I read that Huffman was “Bottom up”, I tried to implement the algorithm “Top down”. That’s just the natural way we think about trees. As you might imagine, I crashed pretty quickly and had to walk through some examples in detail until I wrapped my head around the “Bottom up” nature.
@adodge23 жыл бұрын
3:20 I think these are misrepresented in the video. 1) "single symbol -> unique binary code' doesn't mean you can't map multiple symbols to a single code, it means you can't map the same sequence of symbols to multiple codes. 2) "Lossless" means the decoded message has to be exactly the same as the source, not an approximation of the original. Nothing to do with deleting random bits.
@devashishmittal2 жыл бұрын
Brilliant video! Thanks for your wonderful effort.
@mystic35499 ай бұрын
I already knew huffman's algo before watching this video....6:53 had me goosebumps :) i mean what---?!?!?!? the correlation omg ... tysmmm for this _/\_
@virajgoyanka51503 жыл бұрын
You are back.. 🥳🥳🥳✨✨✨✨ I am watching from last week approx it grow from 89k to 91.5k
@atonurc3 жыл бұрын
27:05 I think it would be more eye-pleasing if the codes were written in a monospace font.
@manik35113 жыл бұрын
expandable is back
@3ractnodi2 жыл бұрын
I wish I could like this twice.
@WildEngineering3 жыл бұрын
wow, very well explained. great job sir
@AT-271823 жыл бұрын
Great explanation. I appreciate your efforts very much.
@saulalonsopalazuelos95943 жыл бұрын
Congratulations for posting an excellent info content!
@kinldk26385 ай бұрын
Your video is amazing! Thanks for the interesting presentation
@vojtechsejkora15542 жыл бұрын
It is really impressive how he came up with this solution - how many concept he have to understand to garantee optimal static encoding. I wonder how he can transpit particular codig for that message. And if we you modification during decoding, is there possibility to shring coding a little bit more? Like when we has message ABDCBBB, first letter we encode only A, then AB, then ABD and so on (last letter is encoding as we would encode ABDCBBB). Decoder then has to start from the end and know how many times each letter should apper.
@MissPiggyM9763 ай бұрын
Very well done, many thanks!
@carly09et3 жыл бұрын
Nice, very clear on the logic.
@zuggrr2 жыл бұрын
This is really good ! Thank you ! I learned a lot.
@James-bv4nu3 жыл бұрын
Huffman, a student of Fano, came up with a better encoding algorithm than Fano. Rudolph Kalman, a student of Lotfi Zadeh (Fuzzy Logic), invented the Kalman Filter, which is widely used in signal processing. Professor Zadeh was my undergrad advisor at Berkeley.
@askemervigbahnson3333 жыл бұрын
Wow, great video man! I forgot multiple times that you aren't 3b1b
@sanjaychhetri34073 жыл бұрын
Excellent explanation! Thanks!
@G12GilbertProduction3 жыл бұрын
This data compression algorithm presented in this video, reminds me one of a Recursive Neural Network paper contain in the one of Yannic Klicher videos.
@chadx8269 Жыл бұрын
A lazy graduate student solves an important problem in a weekend. He's my hero.
@agustindiaz33613 жыл бұрын
Amazing video. You are very good at this.
@scottbigbrain39443 жыл бұрын
We need a reducible information theory series.
@wunkewldewd3 жыл бұрын
Outstanding, as always.
@alegian79343 жыл бұрын
That small intro to information theory shocked me! So naturally deriving Information equations... I might need to get a book! Anyone have any suggestions?
@Reducible3 жыл бұрын
Checkout the links in the description :)
@pafloxyq3 жыл бұрын
Also try David Mackay's lecture sereis and book: www.inference.org.uk/mackay/
@cfalguiere Жыл бұрын
Amazing work
@etienneboutet71933 жыл бұрын
Thank you for this video. Very informative !
@MindshineTube3 жыл бұрын
This video reminds me a coursework that I had almost 20 years ago. I had to write an implementation of the Huffman Algorithm in Assembler. What I remember is that I had to make two passes over a file: the first to count frequencies and the second to encode the file. It didn't work for streams.
@SergioGomez-qe3kn3 жыл бұрын
For one-pass compression, you need LZW compression (I think). Let me know if I'm wrong. Regards.
@leocelente3 жыл бұрын
This is great! Amazing work
@user-or7ji5hv8y3 жыл бұрын
This is truly informative.
@luffytaro6892 жыл бұрын
I don't know if you guys will believe me but i actually saw that way to improve it before he explained even though I hv never seen this algorithm
@hermes_logios3 жыл бұрын
Everything is a data compression algorithm! All knowledge! All language! The process we call "learning" is the process of encoding ... of compressing data. The map is not the territory.
@user-fp6dt1os1l3 жыл бұрын
16:14 those logarithms need negative signs in front of them log2(0.5) = -1 not 1
@ikituriflash Жыл бұрын
Thanks again fantastic video. 17:37 with the ShannonFano code I thought wow this thing is just guessing, it will way too often give B(0.35) two bits, although 1 bit would be better. Try with an even more extreme distribution like this D(0.14), E(0.14), A(0.15), C(0.17), B(0.4) And it will still assign two bits to B. So this must be non optimal, just from the first impression. 24:29 yeah, this is it, this Huffman looks like an optimal recursive function, just intuitively right
@iLeno3 жыл бұрын
I wish my professor at college explained this way to me all of this, I barely passed information theory with the min requirements.
@csvegso2 жыл бұрын
what a great and still simple algorithm
@Lucky102792 жыл бұрын
11:00 Actually, entropy in thermodynamics is defined almost exactly the same way as information entropy in information theory. I'm not sure of the historical development or which formal definition came first, the modern day mathematical definition of entropy in thermodynamics differs from information entropy by a factor of Boltzmann's constant, and that's only there to make the SI units work out. Really, thermodynamic entropy should be dimensionless, and then the definitions would be exactly the same, but since, for historical reasons, temperature in the SI system has different units than energy, the SI unit of entropy is Joules/Kelvin and the Boltzmann constant in the definition of thermodynamic entropy just serves to make that work out.
@rajivshukla78923 жыл бұрын
great video man content on your channel is awesome !!!
@DDvargas1233 жыл бұрын
I've always wondered about huffman codes is: don't you have to have a way to send the constructed tree to the decoder? I doubt that you can decode any arbitrary text message in exactly the same way. Like, at what point isn't it better to just have like a 6bit encoding for the 52 letters so you dont have to send the tree? Also don't you need a way to send the exact symbol as well? Like how does the receiver know that 001 is B without u saying so in the encoding of the tree you're sending (via ascii or unicode most likely)? It feels like huffman only works when you're constrained into exact specific symbols with exact and known probabilities.
@Reducible3 жыл бұрын
Fantastic questions! Let me address them one by one: You do have to find a way to send the constructed tree to the decoder. Usually how this is done in practice is through an array representation of the binary tree. So it turns out to store the compressed version of the text, you need to allocate some extra memory to store this array representation. So in cases where the text can't be compressed that well or the text file is not even that large, it may not even make sense to use Huffman encoding since the overhead of storing the tree may not make it that great at all. But most of the time, in large text files with lot's of redundancy, the overhead of storing this array is pretty negligible. But you're right, in some cases a fixed-length encoding might be the best solution. You can actually use an estimate of the entropy to figure that out. The higher the entropy, the less compressibility there is in the text. And yeah that second question is a good one too. Usually you only have a constrained set of symbols whose size is significantly smaller than the total text in the file, but if it was the case that the set of symbols was almost equal to the size of the text file, Huffman encoding wouldn't really be able to help that much at all. In practice though, that's usually not the case, because the number of characters will generally be significantly larger the the set of symbols.
@unrealzocker3 жыл бұрын
You distribute the tree beforehand or in-place - at some point your receiver must know that this bit pattern is responsible for ASCII character 'B'. In some sense you can think of it as a lookup table.
@DDvargas1233 жыл бұрын
@@Reducible ah . would the size of the array be nearest power of 2 above the total number of unique symbols . or is there a way to consistently trim off the end (like getting all the nulls to line up)?
@r75shell3 жыл бұрын
You need to have some "protocol" regarding to tree. It's either encoded in message as some kind of header, in some simple way or tricky stuff like left-to-right tree traversal, and write symbol each time you visit leaf. Or it might be initialized into some tree, and then reconstructed after each occurrence of event (or just each symbol output) - these are so called Adaptive Huffman Coding.
@txorimorea38693 жыл бұрын
Just send a bit stream: 0 means node, 1 means leaf and the next N bits identify the symbol. After a node there are two elements that maybe a node or a leaf, after a leaf there is nothing more. That makes easy to reconstruct the tree, and is optimal in space.
@Sanjism-y9k Жыл бұрын
Thanks for this awesome explanation !!!
@hamedmirzaei97133 жыл бұрын
24:53 you need to be consistent in your tree representation. I mean, either always put the bigger node on the right or left. The final optimal case is still ok with what you have done but the representations are not those that huffman coding suggests.