Skip to main content

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(X, Y)

# Calculate out-of-sample forecasts
Y_forecast = model.predict(X)

print("Predicted targets:")
print(Y_predicted)

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


Download files

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

Source Distribution

ptfa-0.2.1.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

ptfa-0.2.1-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file ptfa-0.2.1.tar.gz.

File metadata

  • Download URL: ptfa-0.2.1.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ptfa-0.2.1.tar.gz
Algorithm Hash digest
SHA256 861f84c8dcf3119220aeb0cf2d3cf6df5efda0cbd6078597f40e55585d4dc926
MD5 ed39cc79807f8562745aa896fcc62f14
BLAKE2b-256 72509f453da94f17e693714fc3f0fb0b0703314b242700559ad30afda3b98555

See more details on using hashes here.

File details

Details for the file ptfa-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ptfa-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ptfa-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 91ab75115e09ac20d87ace68b5ee5d8430a13f4ce446f1f1f112a72e4e268f42
MD5 db31b18def90390a18c5b2c8c922a466
BLAKE2b-256 ce4bb8464f32a661b07495b7631a7edc436424a9e2345ed02039618a07d63863

See more details on using hashes here.

Supported by

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