Probabilistic Targeted Factor Analysis
Project description
Probabilistic Targeted Factor Analysis (PTFA)
PTFA is a probabilistic extension of Partial Least Squares (PLS), designed to extract latent factors from predictors (X) and targets (Y) for optimal prediction. It leverages an Expectation-Maximization (EM) algorithm for robust parameter estimation, accommodating challenges such as missing data, stochastic volatility, and dynamic factors.
The framework balances flexibility and efficiency, providing an alternative to traditional methods like PCA and standard PLS by incorporating probabilistic foundations.
Features
- Joint estimation of latent factors and parameters.
- Robust against noise, missing data, and model uncertainty.
- Extensible to stochastic volatility, mixed-frequency data and dynamic factor models.
- Competitive performance in high-dimensional forecasting tasks.
Installation
You can install PTFA from PyPI:
pip install ptfa
Usage
Here is a quick example of how to use the ProbabilisticTFA class:
import numpy as np
from ptfa import ProbabilisticTFA
# Example data: predictors (X) and targets (Y)
X = np.random.rand(100, 10) # 100 observations, 10 predictors
Y = np.random.rand(100, 2) # 100 observations, 2 targets
# Initialize PTFA model with desired number of components
model = ProbabilisticTFA(n_components=3)
# Fit the model
model.fit(X, Y)
# Calculate in-sample predictions
Y_predicted = model.fitted()
# Calculate out-of-sample forecasts
X = np.random.rand(100, 10)
Y_forecast = model.predict(X)
print("Predicted targets:")
print(Y_predicted)
print("Forecasted targets:")
print(Y_forecast)
Contributing
Feel free to open issues or contribute to the repository through pull requests. We welcome suggestions and improvements.
Licence
This project is licensed under the MIT License.
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 Distribution
File details
Details for the file ptfa-0.2.8.tar.gz
.
File metadata
- Download URL: ptfa-0.2.8.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae65d8b603be4a0cbc29dc9e040fec82c5cc3e1cd449b7225fef7e5210173777 |
|
MD5 | 49666182e51168ccbf916e85d400a342 |
|
BLAKE2b-256 | 9d0083ed53bb84d3b3e9f96bce9fc81324b54484ba40c2bc3c51ce31df2169e7 |
File details
Details for the file ptfa-0.2.8-py3-none-any.whl
.
File metadata
- Download URL: ptfa-0.2.8-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6adc5571e73c4c67a6392db965abae80f2d0389b2bee0445e9edf77025818376 |
|
MD5 | b873467d372d830a43949ee94344570a |
|
BLAKE2b-256 | 7427e8a2b3ab7e15c962771751ca3baff85ae2b075ac3332585a240307199976 |