Installation | Usage | About | Examples | License | References
This library offers a suite of techniques for low-rank matrix completion of longitudinal data. These techniques introduces various regularization and descrepancy terms to impose structural information on the completed matrix.
Low-rank matrix completion (LMC) is a technique used to recover a partially observed matrix by exploiting the assumption that the matrix has a low-rank structure. In LMC for longitudinal data, the data was collected over time, potentially at irregular intervals.
In this context, the data can be organized as a partially observed matrix
Low-rank matrix completion aims to recover the missing entries by exploiting the assumption that the matrix, when viewed as time-dependent for each entity, can be approximated by a low-rank matrix. The basic factorization model decomposes
- Longitudinal matrix completion
- Convolutional longitudinal matrix completion
- Total variation longitudinal matrix completion
- Least-angle regression matrix completion
- Phase-shifted matrix completion
Install the library with pip:
pip install .
This ensures dependencies listed in pyproject.toml
are handled correctly.
A basic example involves estimating the entries of a matrix
# lmc lib
from lmc import CMC
from utils import train_test_data
# third party
from sklearn.metrics import mean_squared_error
X, O_train, O_test = train_test_data()
X_train = X * O_train
X_test = X * O_test
model = CMC(rank=5, n_iter=100)
model.fit(X_train)
Y_test = model.M * O_test
score = mean_squared_error(X_test, Y_test)