Skip to main content

Matrix completion with column subset selection.

Project description

CSMC

CSMC is a Python library for performing column subset selection in matrix completion tasks. It provides an implementation of the CSSMC method, which aims to complete missing entries in a matrix using a subset of columns.

Columns Selected Matrix Completion (CSMC) is a two-stage approach for low-rank matrix recovery. In the first stage, CSMC samples columns of the input matrix and recovers a smaller column submatrix. In the second stage, it solves a least squares problem to reconstruct the whole matrix.

Alt text

Installation

You can install CSMC using pip:

pip install -i  csmc

Usage

  1. Generate random data
import numpy as np
import random 

n_rows = 50
n_cols = 250
rank = 3

x = np.random.default_rng().normal(size=(n_rows, rank)) 
y = np.random.default_rng().normal(size=(rank, n_cols)) 
M = np.dot(x, y)

M_incomplete = np.copy(M)
num_missing_elements = int(0.7 * M.size)
indices_to_zero = random.sample(range(M.size), k=num_missing_elements)
rows, cols = np.unravel_index(indices_to_zero, M.shape)
M_incomplete[rows, cols] = np.nan
  1. Fill with CSNN algorithm
from csmc import CSMC
solver = CSMC(M_incomplete, col_number=100)
M_filled = solver.fit_transform(M_incomplete)
  1. Fill with Nuclear Norm Minimization with SDP (NN algorithm)
from csmc import NuclearNormMin
solver = NuclearNormMin(M_incomplete)
M_filled = solver.fit_transform(M_incomplete, np.isnan(M_incomplete))

Algorithms

Citation

Krajewska, A., Niewiadomska-Szynkiewicz E. (2023). Matrix Completion with Column Subset Selection. Krajewska, A. (2023). Efficient matrix completion for data recovery in data-driven IT applications. Systems Research Institute Polish Academy of Sciences.

Project details


Download files

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

Source Distribution

csmc-0.1.8.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

csmc-0.1.8-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file csmc-0.1.8.tar.gz.

File metadata

  • Download URL: csmc-0.1.8.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.12 Linux/6.5.0-15-generic

File hashes

Hashes for csmc-0.1.8.tar.gz
Algorithm Hash digest
SHA256 4881f752b0639b69b0a585f9da6a8a2e203d2b484981ebb7c1c2673b7f16f9e9
MD5 87e12c57fa65fec838d79ca86e56fe47
BLAKE2b-256 5a083e2f01b81d62834d2f3c97e02c268d2a6d47e1c961086ac18ced09223f5f

See more details on using hashes here.

File details

Details for the file csmc-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: csmc-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.12 Linux/6.5.0-15-generic

File hashes

Hashes for csmc-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 57b2dceed46b9cee4d2a91700630e07647ebeef2e56b1046b67fb3e3c034ef08
MD5 d35ef2655928f91bb284d53fcedbf4e5
BLAKE2b-256 9b52cc48237e3eb5f577a1088a1b9fa36c723c39cbc32b688bae02745feec727

See more details on using hashes here.

Supported by

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