sequential Information Bottleneck
Project description
sequential Information Bottleneck (sIB)
Scope
This project provides an optimized implementation of the text clustering algorithm "sequential Information Bottleneck" (sIB), introduced by Slonim, Friedman and Tishby (2002). The algorithm is implemented in Python and C++ and packaged into a python library. For a documentation of this implementation see here.
Usage
The main class in this library is SIB
, which implements the clustering interface of SciKit Learn, providing methods such as fit()
, fit_transform()
, fit_predict()
, etc.
The sample code below clusters the 18.8K documents of the 20-News-Groups dataset into 20 clusters:
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.datasets import fetch_20newsgroups
from sklearn import metrics
from sib import SIB
# read the dataset
dataset = fetch_20newsgroups(subset='all', categories=None,
shuffle=True, random_state=256)
gold_labels = dataset.target
n_clusters = np.unique(gold_labels).shape[0]
# create count vectors using the 10K most frequent words
vectorizer = CountVectorizer(max_features=10000)
X = vectorizer.fit_transform(dataset.data)
# SIB initialization and clustering; parameters:
# perform 10 random initializations (n_init=10); the best one is returned.
# up to 15 optimization iterations in each initialization (max_iter=15)
# use all cores in the running machine for parallel execution (n_jobs=-1)
sib = SIB(n_clusters=n_clusters, random_state=128, n_init=10,
n_jobs=-1, max_iter=15, verbose=True)
sib.fit(X)
# report standard clustering metrics
print("Homogeneity: %0.3f" % metrics.homogeneity_score(gold_labels, sib.labels_))
print("Completeness: %0.3f" % metrics.completeness_score(gold_labels, sib.labels_))
print("V-measure: %0.3f" % metrics.v_measure_score(gold_labels, sib.labels_))
print("Adjusted Rand-Index: %.3f" % metrics.adjusted_rand_score(gold_labels, sib.labels_))
Expected result:
sIB information stats on best partition:
I(T;Y) = 0.5685, H(T) = 4.1987
I(T;Y)/I(X;Y) = 0.1468
H(T)/H(X) = 0.2956
Homogeneity: 0.616
Completeness: 0.633
V-measure: 0.624
Adjusted Rand-Index: 0.507
See the Examples directory for more illustrations and a comparison against K-Means.
License
Copyright IBM Corporation 2020
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
If you would like to see the detailed LICENSE click here.
Authors
- Algorithm and pseudo-code: Slonim, Friedman and Tishby (2002)
- First python implementation: Daniel Hershcovich
- Optimization work: Assaf Toledo and Elad Venezian
- Maintainer: Assaf Toledo
If you have any questions or issues you can create a new issue here.
Reference
N. Slonim, N. Friedman, and N. Tishby (2002). Unsupervised Document Classification using Sequential Information Maximization. SIGIR 2002. https://dl.acm.org/doi/abs/10.1145/564376.564401
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file sib-clustering-0.0.1.tar.gz
.
File metadata
- Download URL: sib-clustering-0.0.1.tar.gz
- Upload date:
- Size: 137.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 314cb9b3295631d299d76f4bc797e70661143c29c4dc119c977b698ccbb53f98 |
|
MD5 | a6d319635617af9352e5fa40fc4482ec |
|
BLAKE2b-256 | e865ed268153dedeafca1dfa775728061f4215379de4809c37f0ea2d8f4c06a0 |
File details
Details for the file sib_clustering-0.0.1-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 205.6 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98d319757f786180f6166cd2eba02847bed13631728fcd88dcc696f949d65547 |
|
MD5 | ed3c77b830de1a8fdc73469d4336ef4f |
|
BLAKE2b-256 | c791e9161609038679701af85866dc44fa89a386f071fd781b819c1766455244 |
File details
Details for the file sib_clustering-0.0.1-cp38-cp38-win32.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp38-cp38-win32.whl
- Upload date:
- Size: 192.1 kB
- Tags: CPython 3.8, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8767e40d9d144a5f19c7b44b81ac7cf8a6c18eed896572e4964884af7a702818 |
|
MD5 | 39b4f0a04a5531cf873a8df799735197 |
|
BLAKE2b-256 | de2e8c66d33af93e13181cf9957fe46ddbf91ca9a975ddd2ab85b75a13f0dfb4 |
File details
Details for the file sib_clustering-0.0.1-cp38-cp38-manylinux2010_x86_64.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp38-cp38-manylinux2010_x86_64.whl
- Upload date:
- Size: 545.4 kB
- Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a61469caa465522bca002bcf910226500000e37f8a0f8808a76f4a0a31c858df |
|
MD5 | 7873d1ddd6d39741e8bdc7a15f58f1ba |
|
BLAKE2b-256 | f40b4b01bcf2219a907d0a3841cc26a87b37e078fc52bf6478ff60432181113b |
File details
Details for the file sib_clustering-0.0.1-cp38-cp38-manylinux2010_i686.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp38-cp38-manylinux2010_i686.whl
- Upload date:
- Size: 518.9 kB
- Tags: CPython 3.8, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 903c75efd7566ebe28743081f256bedee7f9d1282f0a25d64275911016e9a0d1 |
|
MD5 | aeb40986519b80b854e5dd447954150e |
|
BLAKE2b-256 | 9791fdf5021e5a64ff4ecf406df8c17153da634d4e34a721d7f382df32ebeca5 |
File details
Details for the file sib_clustering-0.0.1-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 545.4 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32ef4059bdd4050f9c8b8418749468975128f3c81afa65e6b86725619ae8bfb2 |
|
MD5 | 84c10291ba49fcd3c0d01ffe61b0779f |
|
BLAKE2b-256 | 1d6f943e86b779f216b7376dba15d948c8a7984e1b33121d722ac7074838db2e |
File details
Details for the file sib_clustering-0.0.1-cp38-cp38-manylinux1_i686.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp38-cp38-manylinux1_i686.whl
- Upload date:
- Size: 518.9 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25eefa275ffff8a57ad49e99b1205c34b5701b83a7701ee525b2379739d16a16 |
|
MD5 | 2ea3c19d815f37b12776cb52e9dd9840 |
|
BLAKE2b-256 | 681293b1d37a739d4456a3df53e5a38729c8670eecbd157d7f3153d3c1414adb |
File details
Details for the file sib_clustering-0.0.1-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 207.6 kB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45164384e411524bb96c4182591933126923638cc1d3e90c229eb54f0bad3280 |
|
MD5 | 9520fabdff49972d4861fbde308b9a38 |
|
BLAKE2b-256 | a459d7df7d2070a911cc9636b9bf450177a9cb3d7e5320a3003e6c6a90cd0bec |
File details
Details for the file sib_clustering-0.0.1-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 204.0 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd3d326def955c31356fb0191dd4d04ae298c63734af637e3f735ffa2f750b03 |
|
MD5 | 52d2a7fb51f82adb8649b9e838051fe1 |
|
BLAKE2b-256 | 92d05c78a11da5478fef103c0ac002f60cd57e33831afc50bf08b6da58ea8799 |
File details
Details for the file sib_clustering-0.0.1-cp37-cp37m-win32.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp37-cp37m-win32.whl
- Upload date:
- Size: 190.6 kB
- Tags: CPython 3.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7886b2dad0a19d477e087844b20d831fe1eba193e76b738417d37dc6573f0394 |
|
MD5 | 78122b202ebbab25fda300071cccdc14 |
|
BLAKE2b-256 | 29ac73f5ac523038a35bfd14748ce337ae678635ab8d071563caabf01f7f9f87 |
File details
Details for the file sib_clustering-0.0.1-cp37-cp37m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp37-cp37m-manylinux2010_x86_64.whl
- Upload date:
- Size: 514.2 kB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaa5331742820824a6ac697a0bbd2f84ed0652871a5e88afee11254e75f8abc2 |
|
MD5 | 29ed3c5449a97079bf42d6fbdf4912c9 |
|
BLAKE2b-256 | 3a299057ce85e1ba9fff13f73e278918bf12718237fcf9798c9cdfb0f0848c73 |
File details
Details for the file sib_clustering-0.0.1-cp37-cp37m-manylinux2010_i686.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp37-cp37m-manylinux2010_i686.whl
- Upload date:
- Size: 487.2 kB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42d9f5d5e744385f0f850d06219209e0e051f1098b21f4d8b5ef461d812521af |
|
MD5 | 9a5540b2cf56fc9095ff0d1aed2c15e3 |
|
BLAKE2b-256 | 9ed8be9c085f859a0dba5834772af16281af5e085712db3288f00c2a5eb46880 |
File details
Details for the file sib_clustering-0.0.1-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 514.2 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 278f2e74d0470a6ee4f67e7d1c64e8ae41c935542ea3ed24ec280c4b06692329 |
|
MD5 | 630cef7c668d85719b2131109289f2d4 |
|
BLAKE2b-256 | 2b0c4419ae3432093b23688f2c9fe7ca634f6c0540ea85ed1f2d47d05788931d |
File details
Details for the file sib_clustering-0.0.1-cp37-cp37m-manylinux1_i686.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp37-cp37m-manylinux1_i686.whl
- Upload date:
- Size: 487.2 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9218f34ce56264bd305ddb09a561ac17b495ccc4a879185825d7c8634c51bcbf |
|
MD5 | c1732ba652e34b9a36515d271061e27b |
|
BLAKE2b-256 | 157cbab8504dc8da6fdd536723c06d25911a5fc4aea8daa17d31dd208bd7df35 |
File details
Details for the file sib_clustering-0.0.1-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 207.5 kB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 060fe612faba85d1682cc6a95298c19f826f35398d87e6ccd6522fe4e60608f3 |
|
MD5 | 36c68d059962a0675431176a0ece80bf |
|
BLAKE2b-256 | a9443900f307f03b3f318c0e5a92bb501cfba33b45467b14cf87fa5034eb0fce |
File details
Details for the file sib_clustering-0.0.1-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 203.9 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc4cf1cc975aab6699a6fe9e6ef52f62b724701c9233041319db35c818257d3d |
|
MD5 | 6c63d4814db2b8352557a8d60b00f443 |
|
BLAKE2b-256 | 7d995beb8b5781b2173f37d0a9ff8cad16461349e08f203787303012f8d3825d |
File details
Details for the file sib_clustering-0.0.1-cp36-cp36m-win32.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp36-cp36m-win32.whl
- Upload date:
- Size: 190.5 kB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 031f946f61636e45e2857d4374c9f5b0d16c96e465315bfc0b685e8a37679aaa |
|
MD5 | a1825bb752095a3723f45619d59213d9 |
|
BLAKE2b-256 | 6f3d6098458353ec060aa3d0d645fc7e1f0dfb7f134c1313e28d0cf1762d2f16 |
File details
Details for the file sib_clustering-0.0.1-cp36-cp36m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp36-cp36m-manylinux2010_x86_64.whl
- Upload date:
- Size: 512.9 kB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f73d5244a6b67134feb192b0c2398791a9621a102b7abb4349f897212221dcf |
|
MD5 | 135e8816c48c4f4eb688422fe084abdc |
|
BLAKE2b-256 | 7236629018edf8ff76261544c920d658e9b7309e1b3b2104e18b326e37faeb06 |
File details
Details for the file sib_clustering-0.0.1-cp36-cp36m-manylinux2010_i686.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp36-cp36m-manylinux2010_i686.whl
- Upload date:
- Size: 487.6 kB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7940c1f3d8fb4536111414cbef42bdc525edd601e6d62fa81bf9cb28ebcaad75 |
|
MD5 | 2db1d5fe5c527d4f26a5651837a6fae1 |
|
BLAKE2b-256 | b7b7fb84709598de1e77d2b94e07a08ac86298cc41370d7cbd7bb783f53c673f |
File details
Details for the file sib_clustering-0.0.1-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 512.9 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 086c4d68e49e437ea9035168d510195e1933ca29a8a9ed89dbf43e48ff1b8780 |
|
MD5 | 1e7a0fc30948744ea6d4b34f22d391ee |
|
BLAKE2b-256 | 1a6221146d94131d7a53755c4bf8cbeeaa90a4b9760fea306409dbf20eb50f2a |
File details
Details for the file sib_clustering-0.0.1-cp36-cp36m-manylinux1_i686.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp36-cp36m-manylinux1_i686.whl
- Upload date:
- Size: 487.6 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd46676c62780ea8d021a070b7b30aba8647907b2fe0ad668600e10aeae2cd99 |
|
MD5 | c9ecb210fa573f98ccc93d812f24dfb4 |
|
BLAKE2b-256 | 1e6906e405b6e2784d88f596891c2cd7ffbc957e0980567959b8e812489afb10 |
File details
Details for the file sib_clustering-0.0.1-cp36-cp36m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: sib_clustering-0.0.1-cp36-cp36m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 207.3 kB
- Tags: CPython 3.6m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93ac11c5e5dd019a834d53ae934b71756e2def644793d40d0d8ffec2dae5fdd5 |
|
MD5 | 87c9701123cca0ee81ecad3177df58e6 |
|
BLAKE2b-256 | 3add4d4efcd96b941346a205b6580e61f384830ba46be13f0c0daf669e09d415 |