SlideShare une entreprise Scribd logo
1  sur  26
Count Min Sketch
대충 이해하기
charsyam@naver.com
Count 를 위한 확률적 자료구조
IP가 100만개 정도 되는데
Count를 해야 한다면?
IP 개수에 따른 메모리 할당 양
개수 메모리(Redis 에서 계산)
10000 1.64MB
100000 8.69MB
1000000 77.49MB
2000000 123.64MB
IP 개수가 늘어날 수록
메모리 사용량도 늘어난다.
IP는 특정 IP 들이 많을까?
다들 동일한 횟수로 접근할까?
TOP(K)의 Count가 정확해야할 때
Count Min Sketch가 유리
근사한 Count 값을 구하는 것이 목적
계산 시간과 메모리를 적게 사용한다.
필요한 값
d = 몇 개의 hash 함수를 쓸 것인가?
w = 메모리 공간을 얼마나 쓸 것인가?
Count Min Sketch
0 1 2 3 4 5
Hash 1 0 0 0 0 0 0
Hash 2 0 0 0 0 0 0
Hash 3 0 0 0 0 0 0
Hash 4 0 0 0 0 0 0
w : 사용하고자 하는 메모리 공간
d
할당되는 메모리는
w * d * 변수크기
만큼 사용된다.
Hash 는 어떤 hash라도 가능
Hash % w 값으로 나오는 값을 사용
Example
1.1.1.1 2.2.2.2 3.3.3.3 4.4.4.4 5.5.5.5 6.6.6.6
Hash 1 1 2 1 3 5 4
Hash 2 5 4 3 5 1 3
Hash 3 2 4 5 1 0 2
Hash 4 1 2 2 3 0 4
다음과 같은 해시결과가 나온다고 하자.
Example
그리고 다음과 같은 데이터셋이 있다고 가정한다.
1.1.1.1
2.2.2.2
1.1.1.1
3.3.3.3
1.1.1.1
Example : 1.1.1.1
0 1 2 3 4 5
Hash 1 0 1 0 0 0 0
Hash 2 0 0 0 0 0 1
Hash 3 0 0 1 0 0 0
Hash 4 0 1 0 0 0 0
Hash1(1.1.1.1) = 1
Hash2(1.1.1.1) = 5
Hash3(1.1.1.1) = 2
Hash4(1.1.1.1) = 1
나온 해시 값의 자리를 1 증가시킨다.
Example : 2.2.2.2
0 1 2 3 4 5
Hash 1 0 1 1 0 0 0
Hash 2 0 0 0 0 1 1
Hash 3 0 0 1 0 1 0
Hash 4 0 1 1 0 0 0
Hash1(2.2.2.2) = 2
Hash2(2.2.2.2) = 4
Hash3(2.2.2.2) = 4
Hash4(2.2.2.2) = 2
나온 해시 값의 자리를 1 증가시킨다.
Example : 1.1.1.1
0 1 2 3 4 5
Hash 1 0 2 1 0 0 0
Hash 2 0 0 0 0 1 2
Hash 3 0 0 2 0 1 0
Hash 4 0 2 1 0 0 0
Hash1(1.1.1.1) = 1
Hash2(1.1.1.1) = 5
Hash3(1.1.1.1) = 2
Hash4(1.1.1.1) = 1
나온 해시 값의 자리를 1 증가시킨다.
Example : 3.3.3.3
0 1 2 3 4 5
Hash 1 0 3 1 0 0 0
Hash 2 0 0 0 1 1 2
Hash 3 0 0 2 0 1 1
Hash 4 0 2 2 0 0 0
Hash1(3.3.3.3) = 1
Hash2(3.3.3.3) = 3
Hash3(3.3.3.3) = 5
Hash4(3.3.3.3) = 2
나온 해시 값의 자리를 1 증가시킨다.
Example : 1.1.1.1
0 1 2 3 4 5
Hash 1 0 4 1 0 0 0
Hash 2 0 0 0 1 1 3
Hash 3 0 0 3 0 1 1
Hash 4 0 3 2 0 0 0
Hash1(1.1.1.1) = 1
Hash2(1.1.1.1) = 5
Hash3(1.1.1.1) = 2
Hash4(1.1.1.1) = 1
나온 해시 값의 자리를 1 증가시킨다.
이제 1.1.1.1 의 개수를 세어보자
0 1 2 3 4 5
Hash 1 0 4 1 0 0 0
Hash 2 0 0 0 1 1 3
Hash 3 0 0 3 0 1 1
Hash 4 0 3 2 0 0 0
Hash1(1.1.1.1) = 1
Hash2(1.1.1.1) = 5
Hash3(1.1.1.1) = 2
Hash4(1.1.1.1) = 1
각 자리의 값
(hash1, 1) = 4, (hash2, 5) = 3, (hash3, 2) = 3, (hash4, 1) = 3
즉 4, 3, 3, 3 중에서 가장 작은 MIN 값은 3 이므로 1.1.1.1의 개수는 3이 된다.
이제 3.3.3.3 의 개수를 세어보자
0 1 2 3 4 5
Hash 1 0 4 1 0 0 0
Hash 2 0 0 0 1 1 3
Hash 3 0 0 3 0 1 1
Hash 4 0 3 2 0 0 0
Hash1(3.3.3.3) = 1
Hash2(3.3.3.3) = 3
Hash3(3.3.3.3) = 5
Hash4(3.3.3.3) = 2
각 자리의 값
(hash1, 1) = 4, (hash2, 3) = 1, (hash3, 5) = 1, (hash4, 2) = 2
즉 4, 1, 1, 2 중에서 가장 작은 MIN 값은 1 이므로 3.3.3.3의 개수는 1이 된다.
W가 10000이고 d 가 4라면
4 * 10000 * 4 해서
160kb 정도만 메모리를 사용
160kb 와 77.49MB 중에 큰 것은?
Count Min Sketch 는 해시의 충돌을
감안하고 고정된 크기에서 특정 값의
개수를 근사치로 구하는 방법
Count Min Sketch
실제 값 <= 근사치 값
이 성립한다.
(해시 충돌이 일어나면
다른 것의 값이 더해질 수 있으므로)
w와 d를 늘리면 좀 더 충돌이 줄어드므로
에러 값이 줄어든다.
근사값이지만, 운이 나쁘면 튀는 값이
위의 원리로 나올 수도 있다.
여러 해시값 들 중에 가장 적은 값을 가지
고 있는 해시의 값이 자신의 근사값이 됨.
감사합니다.

Contenu connexe

Tendances

Deep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech Talks
Deep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech TalksDeep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech Talks
Deep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech TalksAmazon Web Services
 
How to build massive service for advance
How to build massive service for advanceHow to build massive service for advance
How to build massive service for advanceDaeMyung Kang
 
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버Heungsub Lee
 
In-memory OLTP storage with persistence and transaction support
In-memory OLTP storage with persistence and transaction supportIn-memory OLTP storage with persistence and transaction support
In-memory OLTP storage with persistence and transaction supportAlexander Korotkov
 
How NOT to Measure Latency, Gil Tene, London, Oct. 2013
How NOT to Measure Latency, Gil Tene, London, Oct. 2013How NOT to Measure Latency, Gil Tene, London, Oct. 2013
How NOT to Measure Latency, Gil Tene, London, Oct. 2013Azul Systems Inc.
 
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019confluent
 
MongoDB at Baidu
MongoDB at BaiduMongoDB at Baidu
MongoDB at BaiduMat Keep
 
Deep Dive into Apache Kafka
Deep Dive into Apache KafkaDeep Dive into Apache Kafka
Deep Dive into Apache Kafkaconfluent
 
Multiplayer Game Sync Techniques through CAP theorem
Multiplayer Game Sync Techniques through CAP theoremMultiplayer Game Sync Techniques through CAP theorem
Multiplayer Game Sync Techniques through CAP theoremSeungmo Koo
 
How is Kafka so Fast?
How is Kafka so Fast?How is Kafka so Fast?
How is Kafka so Fast?Ricardo Paiva
 
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정PgDay.Seoul
 
AWS와 함께 한 쿠키런 서버 Re-architecting 사례 (Gaming on AWS)
AWS와 함께 한 쿠키런 서버 Re-architecting 사례 (Gaming on AWS)AWS와 함께 한 쿠키런 서버 Re-architecting 사례 (Gaming on AWS)
AWS와 함께 한 쿠키런 서버 Re-architecting 사례 (Gaming on AWS)Brian Hong
 
webservice scaling for newbie
webservice scaling for newbiewebservice scaling for newbie
webservice scaling for newbieDaeMyung Kang
 
Caching solutions with Redis
Caching solutions   with RedisCaching solutions   with Redis
Caching solutions with RedisGeorge Platon
 
[IGC 2017] 펄어비스 민경인 - Mmorpg를 위한 voxel 기반 네비게이션 라이브러리 개발기
[IGC 2017] 펄어비스 민경인 - Mmorpg를 위한 voxel 기반 네비게이션 라이브러리 개발기[IGC 2017] 펄어비스 민경인 - Mmorpg를 위한 voxel 기반 네비게이션 라이브러리 개발기
[IGC 2017] 펄어비스 민경인 - Mmorpg를 위한 voxel 기반 네비게이션 라이브러리 개발기강 민우
 
MySQLを割と一人で300台管理する技術
MySQLを割と一人で300台管理する技術MySQLを割と一人で300台管理する技術
MySQLを割と一人で300台管理する技術yoku0825
 
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹InfraEngineer
 

Tendances (20)

Deep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech Talks
Deep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech TalksDeep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech Talks
Deep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech Talks
 
How to build massive service for advance
How to build massive service for advanceHow to build massive service for advance
How to build massive service for advance
 
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
 
In-memory OLTP storage with persistence and transaction support
In-memory OLTP storage with persistence and transaction supportIn-memory OLTP storage with persistence and transaction support
In-memory OLTP storage with persistence and transaction support
 
How NOT to Measure Latency, Gil Tene, London, Oct. 2013
How NOT to Measure Latency, Gil Tene, London, Oct. 2013How NOT to Measure Latency, Gil Tene, London, Oct. 2013
How NOT to Measure Latency, Gil Tene, London, Oct. 2013
 
How to Design Indexes, Really
How to Design Indexes, ReallyHow to Design Indexes, Really
How to Design Indexes, Really
 
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019
 
MongoDB at Baidu
MongoDB at BaiduMongoDB at Baidu
MongoDB at Baidu
 
Deep Dive into Apache Kafka
Deep Dive into Apache KafkaDeep Dive into Apache Kafka
Deep Dive into Apache Kafka
 
Introduction to Apache Storm
Introduction to Apache StormIntroduction to Apache Storm
Introduction to Apache Storm
 
Multiplayer Game Sync Techniques through CAP theorem
Multiplayer Game Sync Techniques through CAP theoremMultiplayer Game Sync Techniques through CAP theorem
Multiplayer Game Sync Techniques through CAP theorem
 
The PostgreSQL Query Planner
The PostgreSQL Query PlannerThe PostgreSQL Query Planner
The PostgreSQL Query Planner
 
How is Kafka so Fast?
How is Kafka so Fast?How is Kafka so Fast?
How is Kafka so Fast?
 
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
 
AWS와 함께 한 쿠키런 서버 Re-architecting 사례 (Gaming on AWS)
AWS와 함께 한 쿠키런 서버 Re-architecting 사례 (Gaming on AWS)AWS와 함께 한 쿠키런 서버 Re-architecting 사례 (Gaming on AWS)
AWS와 함께 한 쿠키런 서버 Re-architecting 사례 (Gaming on AWS)
 
webservice scaling for newbie
webservice scaling for newbiewebservice scaling for newbie
webservice scaling for newbie
 
Caching solutions with Redis
Caching solutions   with RedisCaching solutions   with Redis
Caching solutions with Redis
 
[IGC 2017] 펄어비스 민경인 - Mmorpg를 위한 voxel 기반 네비게이션 라이브러리 개발기
[IGC 2017] 펄어비스 민경인 - Mmorpg를 위한 voxel 기반 네비게이션 라이브러리 개발기[IGC 2017] 펄어비스 민경인 - Mmorpg를 위한 voxel 기반 네비게이션 라이브러리 개발기
[IGC 2017] 펄어비스 민경인 - Mmorpg를 위한 voxel 기반 네비게이션 라이브러리 개발기
 
MySQLを割と一人で300台管理する技術
MySQLを割と一人で300台管理する技術MySQLを割と一人で300台管理する技術
MySQLを割と一人で300台管理する技術
 
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
 

Plus de DaeMyung Kang

How to use redis well
How to use redis wellHow to use redis well
How to use redis wellDaeMyung Kang
 
The easiest consistent hashing
The easiest consistent hashingThe easiest consistent hashing
The easiest consistent hashingDaeMyung Kang
 
How to name a cache key
How to name a cache keyHow to name a cache key
How to name a cache keyDaeMyung Kang
 
Integration between Filebeat and logstash
Integration between Filebeat and logstash Integration between Filebeat and logstash
Integration between Filebeat and logstash DaeMyung Kang
 
Data Engineering 101
Data Engineering 101Data Engineering 101
Data Engineering 101DaeMyung Kang
 
How To Become Better Engineer
How To Become Better EngineerHow To Become Better Engineer
How To Become Better EngineerDaeMyung Kang
 
Kafka timestamp offset_final
Kafka timestamp offset_finalKafka timestamp offset_final
Kafka timestamp offset_finalDaeMyung Kang
 
Kafka timestamp offset
Kafka timestamp offsetKafka timestamp offset
Kafka timestamp offsetDaeMyung Kang
 
Data pipeline and data lake
Data pipeline and data lakeData pipeline and data lake
Data pipeline and data lakeDaeMyung Kang
 
Internet Scale Service Arichitecture
Internet Scale Service ArichitectureInternet Scale Service Arichitecture
Internet Scale Service ArichitectureDaeMyung Kang
 
Redis From 2.8 to 4.x(unstable)
Redis From 2.8 to 4.x(unstable)Redis From 2.8 to 4.x(unstable)
Redis From 2.8 to 4.x(unstable)DaeMyung Kang
 
Redis From 2.8 to 4.x
Redis From 2.8 to 4.xRedis From 2.8 to 4.x
Redis From 2.8 to 4.xDaeMyung Kang
 

Plus de DaeMyung Kang (20)

Redis
RedisRedis
Redis
 
Ansible
AnsibleAnsible
Ansible
 
Why GUID is needed
Why GUID is neededWhy GUID is needed
Why GUID is needed
 
How to use redis well
How to use redis wellHow to use redis well
How to use redis well
 
The easiest consistent hashing
The easiest consistent hashingThe easiest consistent hashing
The easiest consistent hashing
 
How to name a cache key
How to name a cache keyHow to name a cache key
How to name a cache key
 
Integration between Filebeat and logstash
Integration between Filebeat and logstash Integration between Filebeat and logstash
Integration between Filebeat and logstash
 
Data Engineering 101
Data Engineering 101Data Engineering 101
Data Engineering 101
 
How To Become Better Engineer
How To Become Better EngineerHow To Become Better Engineer
How To Become Better Engineer
 
Kafka timestamp offset_final
Kafka timestamp offset_finalKafka timestamp offset_final
Kafka timestamp offset_final
 
Kafka timestamp offset
Kafka timestamp offsetKafka timestamp offset
Kafka timestamp offset
 
Data pipeline and data lake
Data pipeline and data lakeData pipeline and data lake
Data pipeline and data lake
 
Redis acl
Redis aclRedis acl
Redis acl
 
Coffee store
Coffee storeCoffee store
Coffee store
 
Scalable webservice
Scalable webserviceScalable webservice
Scalable webservice
 
Number system
Number systemNumber system
Number system
 
Internet Scale Service Arichitecture
Internet Scale Service ArichitectureInternet Scale Service Arichitecture
Internet Scale Service Arichitecture
 
Bloomfilter
BloomfilterBloomfilter
Bloomfilter
 
Redis From 2.8 to 4.x(unstable)
Redis From 2.8 to 4.x(unstable)Redis From 2.8 to 4.x(unstable)
Redis From 2.8 to 4.x(unstable)
 
Redis From 2.8 to 4.x
Redis From 2.8 to 4.xRedis From 2.8 to 4.x
Redis From 2.8 to 4.x
 

Count min sketch

  • 1. Count Min Sketch 대충 이해하기 charsyam@naver.com
  • 2. Count 를 위한 확률적 자료구조
  • 3. IP가 100만개 정도 되는데 Count를 해야 한다면?
  • 4. IP 개수에 따른 메모리 할당 양 개수 메모리(Redis 에서 계산) 10000 1.64MB 100000 8.69MB 1000000 77.49MB 2000000 123.64MB IP 개수가 늘어날 수록 메모리 사용량도 늘어난다.
  • 5. IP는 특정 IP 들이 많을까? 다들 동일한 횟수로 접근할까?
  • 6. TOP(K)의 Count가 정확해야할 때 Count Min Sketch가 유리
  • 7. 근사한 Count 값을 구하는 것이 목적 계산 시간과 메모리를 적게 사용한다.
  • 8. 필요한 값 d = 몇 개의 hash 함수를 쓸 것인가? w = 메모리 공간을 얼마나 쓸 것인가?
  • 9. Count Min Sketch 0 1 2 3 4 5 Hash 1 0 0 0 0 0 0 Hash 2 0 0 0 0 0 0 Hash 3 0 0 0 0 0 0 Hash 4 0 0 0 0 0 0 w : 사용하고자 하는 메모리 공간 d 할당되는 메모리는 w * d * 변수크기 만큼 사용된다.
  • 10. Hash 는 어떤 hash라도 가능 Hash % w 값으로 나오는 값을 사용
  • 11. Example 1.1.1.1 2.2.2.2 3.3.3.3 4.4.4.4 5.5.5.5 6.6.6.6 Hash 1 1 2 1 3 5 4 Hash 2 5 4 3 5 1 3 Hash 3 2 4 5 1 0 2 Hash 4 1 2 2 3 0 4 다음과 같은 해시결과가 나온다고 하자.
  • 12. Example 그리고 다음과 같은 데이터셋이 있다고 가정한다. 1.1.1.1 2.2.2.2 1.1.1.1 3.3.3.3 1.1.1.1
  • 13. Example : 1.1.1.1 0 1 2 3 4 5 Hash 1 0 1 0 0 0 0 Hash 2 0 0 0 0 0 1 Hash 3 0 0 1 0 0 0 Hash 4 0 1 0 0 0 0 Hash1(1.1.1.1) = 1 Hash2(1.1.1.1) = 5 Hash3(1.1.1.1) = 2 Hash4(1.1.1.1) = 1 나온 해시 값의 자리를 1 증가시킨다.
  • 14. Example : 2.2.2.2 0 1 2 3 4 5 Hash 1 0 1 1 0 0 0 Hash 2 0 0 0 0 1 1 Hash 3 0 0 1 0 1 0 Hash 4 0 1 1 0 0 0 Hash1(2.2.2.2) = 2 Hash2(2.2.2.2) = 4 Hash3(2.2.2.2) = 4 Hash4(2.2.2.2) = 2 나온 해시 값의 자리를 1 증가시킨다.
  • 15. Example : 1.1.1.1 0 1 2 3 4 5 Hash 1 0 2 1 0 0 0 Hash 2 0 0 0 0 1 2 Hash 3 0 0 2 0 1 0 Hash 4 0 2 1 0 0 0 Hash1(1.1.1.1) = 1 Hash2(1.1.1.1) = 5 Hash3(1.1.1.1) = 2 Hash4(1.1.1.1) = 1 나온 해시 값의 자리를 1 증가시킨다.
  • 16. Example : 3.3.3.3 0 1 2 3 4 5 Hash 1 0 3 1 0 0 0 Hash 2 0 0 0 1 1 2 Hash 3 0 0 2 0 1 1 Hash 4 0 2 2 0 0 0 Hash1(3.3.3.3) = 1 Hash2(3.3.3.3) = 3 Hash3(3.3.3.3) = 5 Hash4(3.3.3.3) = 2 나온 해시 값의 자리를 1 증가시킨다.
  • 17. Example : 1.1.1.1 0 1 2 3 4 5 Hash 1 0 4 1 0 0 0 Hash 2 0 0 0 1 1 3 Hash 3 0 0 3 0 1 1 Hash 4 0 3 2 0 0 0 Hash1(1.1.1.1) = 1 Hash2(1.1.1.1) = 5 Hash3(1.1.1.1) = 2 Hash4(1.1.1.1) = 1 나온 해시 값의 자리를 1 증가시킨다.
  • 18. 이제 1.1.1.1 의 개수를 세어보자 0 1 2 3 4 5 Hash 1 0 4 1 0 0 0 Hash 2 0 0 0 1 1 3 Hash 3 0 0 3 0 1 1 Hash 4 0 3 2 0 0 0 Hash1(1.1.1.1) = 1 Hash2(1.1.1.1) = 5 Hash3(1.1.1.1) = 2 Hash4(1.1.1.1) = 1 각 자리의 값 (hash1, 1) = 4, (hash2, 5) = 3, (hash3, 2) = 3, (hash4, 1) = 3 즉 4, 3, 3, 3 중에서 가장 작은 MIN 값은 3 이므로 1.1.1.1의 개수는 3이 된다.
  • 19. 이제 3.3.3.3 의 개수를 세어보자 0 1 2 3 4 5 Hash 1 0 4 1 0 0 0 Hash 2 0 0 0 1 1 3 Hash 3 0 0 3 0 1 1 Hash 4 0 3 2 0 0 0 Hash1(3.3.3.3) = 1 Hash2(3.3.3.3) = 3 Hash3(3.3.3.3) = 5 Hash4(3.3.3.3) = 2 각 자리의 값 (hash1, 1) = 4, (hash2, 3) = 1, (hash3, 5) = 1, (hash4, 2) = 2 즉 4, 1, 1, 2 중에서 가장 작은 MIN 값은 1 이므로 3.3.3.3의 개수는 1이 된다.
  • 20. W가 10000이고 d 가 4라면 4 * 10000 * 4 해서 160kb 정도만 메모리를 사용 160kb 와 77.49MB 중에 큰 것은?
  • 21. Count Min Sketch 는 해시의 충돌을 감안하고 고정된 크기에서 특정 값의 개수를 근사치로 구하는 방법
  • 22. Count Min Sketch 실제 값 <= 근사치 값 이 성립한다. (해시 충돌이 일어나면 다른 것의 값이 더해질 수 있으므로)
  • 23. w와 d를 늘리면 좀 더 충돌이 줄어드므로 에러 값이 줄어든다.
  • 24. 근사값이지만, 운이 나쁘면 튀는 값이 위의 원리로 나올 수도 있다.
  • 25. 여러 해시값 들 중에 가장 적은 값을 가지 고 있는 해시의 값이 자신의 근사값이 됨.