Color similarity/distance in RGBA color space

Finally, I’ve found it! After thorough testing and experimentation my conclusions are: The correct way is to calculate maximum possible difference between the two colors. Formulas with any kind of estimated average/typical difference had room for discontinuities. I was unable to find a working formula that calculates the distance without blending RGBA colors with some … Read more

how to compute similarity between two strings in MYSQL

you can use this function (cop^H^H^Hadapted from http://www.artfulsoftware.com/infotree/queries.php#552): CREATE FUNCTION `levenshtein`( s1 text, s2 text) RETURNS int(11) DETERMINISTIC BEGIN DECLARE s1_len, s2_len, i, j, c, c_temp, cost INT; DECLARE s1_char CHAR; DECLARE cv0, cv1 text; SET s1_len = CHAR_LENGTH(s1), s2_len = CHAR_LENGTH(s2), cv1 = 0x00, j = 1, i = 1, c = 0; IF … Read more

Compare similarity algorithms

Expanding on my wiki-walk comment in the errata and noting some of the ground-floor literature on the comparability of algorithms that apply to similar problem spaces, let’s explore the applicability of these algorithms before we determine if they’re numerically comparable. From Wikipedia, Jaro-Winkler: In computer science and statistics, the Jaro–Winkler distance (Winkler, 1990) is a … Read more

Figure out if a business name is very similar to another one – Python

I’ve recently done a similar task, although I was matching new data to existing names in a database, rather than looking for duplicates within one set. Name matching is actually a well-studied task, with a number of factors beyond what you’d consider for matching generic strings. First, I’d recommend taking a look at a paper, … Read more

Finding similar strings with PostgreSQL quickly

The way you have it, similarity between every element and every other element of the table has to be calculated (almost a cross join). If your table has 1000 rows, that’s already 1,000,000 (!) similarity calculations, before those can be checked against the condition and sorted. Scales terribly. Use SET pg_trgm.similarity_threshold and the % operator … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)