Skip to main content

Install

pip install adilsm

Description

ILSM is Integrated Latent Multi Source Model.

Reference

https://www.preprints.org/manuscript/202402.1001/v3

Usage

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import adilsm.adilsm as ilsm

max_noise_level = 0.1
# Generate a random non-negative matrix with 100 rows and 10 columns
A = np.random.rand(100, 10)
# Swap the columns of the A and add some noise to generate B
B = np.random.permutation(A.T).T + np.random.uniform(low=0, high=max_noise_level, size=A.shape)
# Add noise to A
A += np.random.uniform(low=0, high=max_noise_level, size=A.shape)

# ISM is expected to recognize that A and B convey the same information up to some noise,
# albeit with the columns of B swapped around. Heatmaps of the loadings of A and B columns
# on ISM components show the effective permutation. 

Xs = [A, B]
n_embedding, n_themes = [10,10]

ilsm_result = ilsm.ism(Xs, n_embedding, n_themes, norm_columns=False, update_h_ism=True,
                                    max_iter_mult=200, fast_mult_rules=True, sparsity_coeff=.8)
hv = ilsm_result['HV']
hv_sparse = ilsm_result['HV_SPARSE']
hhii = ilsm_result['HHII']
w_ism = ilsm_result['W']
h_ism = ilsm_result['H']
q_ism = ilsm_result['Q']
Xs_emb = ilsm_result['EMBEDDING']
Xs_norm = ilsm_result['NORMED_VIEWS']

fig, ax = plt.subplots(1, 2, figsize=(10, 5), constrained_layout=True)
ax[0].imshow(hv[0], cmap='viridis', aspect='auto')
# Add labels and title
ax[0].set_xlabel('Component')
ax[0].set_ylabel('Column')
ax[0].set_title('Loadings of A columns on ISM components')
ax[1].imshow(hv[1], cmap='viridis', aspect='auto')
# Add labels and title
ax[1].set_xlabel('Component')
ax[1].set_ylabel('Column')
ax[1].set_title('Loadings of B columns on ISM components')

# Show the plot
plt.show()

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adilsm-0.0.12.tar.gz (44.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adilsm-0.0.12-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file adilsm-0.0.12.tar.gz.

File metadata

  • Download URL: adilsm-0.0.12.tar.gz
  • Upload date:
  • Size: 44.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for adilsm-0.0.12.tar.gz
Algorithm Hash digest
SHA256 7a7ed7c99ac1e27f714c8394ba8419db140217a6b7b1dee35d77525408214e25
MD5 bd58aadfa819527f7fe3828f5565814d
BLAKE2b-256 f3ae448c0873e0868f4512c8e83e1275a6ad017d221694085262a0cdd0782bae

See more details on using hashes here.

File details

Details for the file adilsm-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: adilsm-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for adilsm-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 ffa182a0aac76bf103243015afa8ba75d07ed74101fe4b3fd0c92d3cd68a3ff4
MD5 6bcc5d855c181d793d4e5fb085b45b14
BLAKE2b-256 39264db795d4727fee143329b3a1907031868356744d512c4ecaf84c9bd69d6e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.12 This release

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page