Update
This commit is contained in:
parent
b761dff5c7
commit
03f1dcaca6
2 changed files with 45 additions and 3 deletions
40
compression.md
Normal file
40
compression.md
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
# Compression
|
||||||
|
|
||||||
|
Compression means encoding [data](data.md) (such as images or texts) in a different way so that it takes less storage memory while keeping all the important [information](information.md), or, in plain terms, it usually means "making files smaller". Compression is pretty important so that we can utilize memory well -- without it our hard drives would be able to store just a handful of videos, internet would be slow as hell due to the gigantic amount of transferred data and our [RAM](ram.md) wouldn't suffice for things we normally do. There are many [algorithms](algorithm.md) for compressing various kinds of data, differing by their complexity, performance, efficiency of compression etc. The reverse process to compression (getting the original data back from the compressed data) is called **decompression**. The ratio of the compressed data size to the original data size is called **compression ration** (the lower, the better). The science of data compression is truly huge and complicated AF, here we'll just mention some very basics.
|
||||||
|
|
||||||
|
{ There is a cool compressing competition known as Hutter Prize that offers 500000 pounds to anyone who can break the current record for compressing [Wikipedia](wikipedia.md). Currently the record is at compressing 1GB down to 115MB. See http://prize.hutter1.net for more. ~drummyfish }
|
||||||
|
|
||||||
|
Let's keep in mind compression is not applied just to files on hard drives, it can also be used e.g. in RAM to utilize it more efficiently.
|
||||||
|
|
||||||
|
Why don't we compress everything? Firstly because compressed data is slow to work with, it requires significant CPU time to compress and decompress data, it's a kind of a space-time tradeoff (we gain more storage space for the cost of CPU time). Secondly compressed data is more prone to [corruption](corruption.md) because redundant information (which can help restoring corrupted data) is removed from it -- in fact we sometimes purposefully do the opposite of compression and make our data bigger on purpose to protect it from corruption (see e.g. [error correcting](error_correction.md) codes, [RAID](raid.md) etc.). And last but not least, many data can hardly be compressed or are so small it's not even worth it.
|
||||||
|
|
||||||
|
The basic division of compression methods is to:
|
||||||
|
|
||||||
|
- **lossless**: No information contained in the original data will be lost in the compressed data, i.e. the original file can be restored in its entirety from the compressed file.
|
||||||
|
- **lossy**: Some information contained in the original data is lost during compression, i.e. for example a compressed image will be of slightly worse quality. This usually allows for much greater compression. Lossy compressors usually also additionally apply lossless compression as well.
|
||||||
|
|
||||||
|
Furthermore we may divide compression e.g. to offline (compresses a whole file, may take long) and streaming (compressing a stream of input data on-the-go and in real-time), by the type of input data (binary, text, audio, ...), basic principle ([RLE](rle.md), dictionary, "[AI](ai.md)", ...) etc.
|
||||||
|
|
||||||
|
The following is an example of how well different types of compression work for an image (screenshot of main page of Wikimedia Commons, 1280x800):
|
||||||
|
|
||||||
|
| compression | size (Kb) | ratio |
|
||||||
|
| --------------------------------------------------- | --------- | ------ |
|
||||||
|
| none | 3000 | 1 |
|
||||||
|
| general lossless (lz4) | 396 | 0.132 |
|
||||||
|
| image lossless (PNG) | 300 | 0.1 |
|
||||||
|
| image lossy (JPG), nearly indistinguishable quality | 164 | 0.054 |
|
||||||
|
| image lossy (JPG), ugly but readable | 56 | 0.018 |
|
||||||
|
|
||||||
|
**Every lossless compression will inevitably enlarge some input files**, i.e. it is mathematically impossible to make a lossless compressor which would make every input smaller than the original (if this was possible, we could just apply this compression over and over and reduce literally anything to 0 bytes). Why is this so? Imagine we are trying to compress data that may be up to 3 bits long -- then we are really looking for a way to map values to shorter values, e.g. *001 compresses to 01*, so that it is also possible to get the original value back from the latter value, i.e. *01 decompresses to 001*. This means each input value must uniquely map to one output value and vice versa (the mapping must be [bijective](bijection.md)), otherwise (if two or more input values mapped to the same output value) we couldn't know what value to later decompress. However this can't be done because there will always be fewer possible output value than input values as we are trying to map longer sequences to shorter (of which there are always fewer). In our case of 3 bits we have 13 possible input values (2 1bit values, 4 2bit values plus 8 3bit values) but only 6 output values (2 1bit values plus 4 2bit values), simply because the output values cannot be longer than 2 bits. Hence we are left with no other option than to map some input values to longer output values.
|
||||||
|
|
||||||
|
**Dude, how does compression really work tho?** The basic principle of lossless compression is **removing [redundancy](redundancy.md)** ([correlations](correlation.md) in the data), i.e. that which is explicitly stored in the original data but doesn't really have to be there because it can be reasoned out from the remaining data. This is why a completely random [noise](noise.md) can't be compressed -- there is no correlated data in it, nothing to reason out from other parts of the data. However human language for example contains many redundancies. Imagine we are trying to compress English text and have a word such as "computer" on the input -- we can really just shorten it to "computr" and it's still pretty clear the word is meant to be "computer" as there is no other similar English word (we also see that compression algorithm is always specific to the type of data we expect on the input -- we have to know what nature of the input data we can expect). Another way to remove redundancy is to e.g. convert a string such as "HELLOHELLOHELLOHELLOHELLO" to "5xHELLO". Lossy compression on the other hand tries to decide what information is of low importance and can be dropped -- for example a lossy compression of text might discard information about case (upper vs lower case) to be able to store each character with fewer bits; an all caps text is still readable, though less comfortably.
|
||||||
|
|
||||||
|
**OK, but how much can we really compress?** Well, as stated above, there can never be anything such as a universal uber compression algorithm that just makes any input file super small -- everything really depends on the nature of the data we are trying to compress. The more we know about the nature of the input data, the more we can compress, so a general compression program will compress only a little, while an image-specialized compress program will compress better (but will only work with images). As said, we just cannot compress completely random data at all (as we don't know anything about the nature of such data). On the other hand data with a lot of redundancy, such as video, can be compressed A LOT. **In theory we can make an algorithm that compresses one specific 1000GB video to 1 bit** (we just define that a bit "1" uncompresses to this specific video), but it will only work for that one single video, not for video in general. Similarly video compression algorithms used in practice work only for videos that appear in the real world which exhibit certain patterns, such as two consecutive frames being very similar -- if we try to compress e.g. static (white noise), video codecs just shit themselves trying to compress it (look up e.g. videos of confetti and see how blocky they get).
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
## Code Example
|
||||||
|
|
||||||
|
TODO
|
|
@ -1,12 +1,14 @@
|
||||||
# Democracy
|
# Democracy
|
||||||
|
|
||||||
Democracy stands for *rule of the people*, it is a form of [government](government.md) that somehow lets all citizens collectively make political decisions, which is usually implemented by voting but possibly also by other means. The opposite of democracy is [autocracy](autocracy.md) (for example [dictatorship](dictatorship.md)), the absolute rule of a single individual. Democracy may take different forms, e.g. direct (people directly vote on specific questions) or representative (people vote for officials who then make decisions on their behalf).
|
Democracy stands for *rule of the people*, it is a form of [government](government.md) that somehow lets all citizens collectively make political decisions, which is usually implemented by voting but possibly also by other means. The opposite of democracy is [autocracy](autocracy.md) (for example [dictatorship](dictatorship.md)), the absolute rule of a single individual. It can also be contrasted with [oligarchy](oligarchy.md), the rule of a few (e.g. [plutocracy](plutocracy.md), the rule of the rich, which we see under [capitalism](capitalism.md)). Democracy may take different forms, e.g. direct (people directly vote on specific questions) or representative (people vote for officials who then make decisions on their behalf).
|
||||||
|
|
||||||
**Democracy does NOT equal voting**, even though this simplification is too often made. Voting doesn't imply democracy and democracy doesn't require voting, an alternative to voting may be for example a [scientifically](science.md) made decision. Democracy in the wide sense doesn't even require a [state](state.md) or legislation -- true democracy simply means that rules and actions of a society are controlled by all the people and in a way that benefits all the people. Even though we are led to believe we live in democratic society, the truth is that a large scale largely working democracy has never been established and that nowadays most of so called democracy is just an illusion as society clearly works for the benefit of the few richest and most powerful people while greatly abusing everyone else, especially the poorest majority of people. **We do NOT live in true democracy**. A true democracy would be achieved by ideal models of society such as those advocated by (true) [anarchism](anarchism.md) or [LRS](less_retarded_society.md), however some anarchists may be avoiding the use the term democracy as that in many narrower contexts implies an existence of government.
|
**Democracy does NOT equal voting**, even though this simplification is too often made. Voting doesn't imply democracy and democracy doesn't require voting, an alternative to voting may be for example a [scientifically](science.md) made decision. Democracy in the wide sense doesn't even require a [state](state.md) or legislation -- true democracy simply means that rules and actions of a society are controlled by all the people and in a way that benefits all the people. Even though we are led to believe we live in democratic society, the truth is that a large scale largely working democracy has never been established and that nowadays most of so called democracy is just an illusion as society clearly works for the benefit of the few richest and most powerful people while greatly abusing everyone else, especially the poorest majority of people. **We do NOT live in true democracy**. A true democracy would be achieved by ideal models of society such as those advocated by (true) [anarchism](anarchism.md) or [LRS](less_retarded_society.md), however some anarchists may be avoiding the use the term democracy as that in many narrower contexts implies an existence of government.
|
||||||
|
|
||||||
Nowadays the politics of most first world countries is based on elections and voting by people, but despite this being called democracy by the propaganda the reality is [de facto](de_facto.md) not a democracy but rather an [oligarchy](oligarchy.md) that rules THROUGH (not by) the people, creating an illusion of democracy which however lacks a real choice (e.g. the [US](usa.md) two party system in which people can either vote for capitalists or capitalists) or pushes the voters towards a certain choice by huge propaganda, misinformation and manipulation.
|
Nowadays the politics of most first world countries is based on elections and voting by people, but despite this being called democracy by the propaganda the reality is [de facto](de_facto.md) not a democracy but rather an [oligarchy](oligarchy.md), the rule THROUGH the people, creating an illusion of democracy which however lacks a real choice (e.g. the [US](usa.md) two party system in which people can either vote for capitalists or capitalists) or pushes the voters towards a certain choice by huge propaganda, misinformation and manipulation.
|
||||||
|
|
||||||
Voting may be highly ineffective and even dangerous. We have to realize that **sometimes voting is awesome, but sometimes it's an extremely awful idea**. Why? Consider the two following scenarios:
|
Voting may be highly ineffective and even dangerous. We have to realize that **sometimes voting is awesome, but sometimes it's an extremely awful idea**. Why? Consider the two following scenarios:
|
||||||
|
|
||||||
- **On simple issues wisdom of the crowd work very well**, as demonstrated by the famous experiment in which averaging guesses of many people on a number of beans in a jar resulted in an extremely precise estimate, a much more precise than any man alone could give. This is an example of when voting is the superior solution to making a decision.
|
- **On simple issues wisdom of the crowd work very well**, as demonstrated by the famous experiment in which averaging guesses of many people on a number of beans in a jar resulted in an extremely precise estimate, a much more precise than any man alone could give. This is an example of when voting is the superior solution to making a decision.
|
||||||
- **Non-experts voting on complex issues is a disaster** (which is why we mostly don't have direct democracy but rather representative one). For example when a [chess](chess.md) grandmaster plays against thousands of people who make moves by voting, the master easily wins, as demonstrated e.g. by the Karpov vs the World (or Twitch plays Pokémon lol) experiment (later projects such as Kasparov vs the World had to somehow moderate and filter the move votes to give the world a chance). The reason is that the majority of weak moves voted by non-experts outweight the few good votes of experts, but also ADDITIONALLY even if only expert votes are takes, the result may be inferior because different long-term plans and visions will collide with the long term plans of others, which is probably the reason why e.g. Romans used to elect a single dictator in times of a crisis rather than relying on a council of experts. This is why it's a very bad idea to have people vote directly e.g. on complex economic or diplomatic issues. We have to say [we](we.md) do NOT advocate for dictators (we are anarchists) -- we rather believe in implementing a [decentralized](decentralization.md), self-regulating society in which we avoid the need for any dictators or governments.
|
- **Non-experts voting on complex issues is a disaster** (which is why we mostly don't have direct democracy but rather representative one). Many retarded rightists believe direct democracy would somehow be "better" -- no, it would be indeed be infinitely worse to let braindead rednecks vote on complex issues. When a [chess](chess.md) grandmaster plays against thousands of people who make moves by voting, the master easily wins, as demonstrated e.g. by the Karpov vs the World (or Twitch plays Pokémon lol) experiment (later projects such as Kasparov vs the World had to somehow moderate and filter the move votes to give the world a chance). The reason is that the majority of weak moves voted by non-experts outweight the few good votes of experts, but also ADDITIONALLY even if only expert votes are takes, the result may be inferior because different long-term plans and visions will collide with the long term plans of others, which is probably the reason why e.g. Romans used to elect a single dictator in times of a crisis rather than relying on a council of experts. This is why it's a very bad idea to have people vote directly e.g. on complex economic or diplomatic issues. We have to say [we](we.md) do NOT advocate for dictators (we are anarchists) -- we rather believe in implementing a [decentralized](decentralization.md), self-regulating society in which we avoid the need for any dictators or governments.
|
||||||
|
|
||||||
|
What happens when it is democratically decided that democracy is not a good tool for decision making? If we believe in democracy, then we have to accept its decision and stop believing in democracy, but then if we stop believing in democracy we can just reject the decision because it was made by something that's not to be trusted, but then...
|
Loading…
Reference in a new issue