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()

# 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


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.10.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

ptfa-0.2.10-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ptfa-0.2.10.tar.gz
  • Upload date:
  • Size: 13.4 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.10.tar.gz
Algorithm Hash digest
SHA256 da215fea50a91100a3a6bf8ca1f585ad9435dbc128c746fcb82192b8a2321ed1
MD5 dd436b8ec84f4f3b947dbe3d7892087d
BLAKE2b-256 e1e3ef6d0fd56fbdd8e01ce6d9fc70571eda6931b20433f6a312b81194e82ecc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ptfa-0.2.10-py3-none-any.whl
  • Upload date:
  • Size: 12.8 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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 6d1297ce44278f18eb4db439997f36373f18dea474333949750fb09c1dea4bad
MD5 2ecab407e852999d62fb3c8ccd3484ad
BLAKE2b-256 c74bda70f1973a530d440f53ccd737086ae7f5485aae07fc1c764678c26fe70e

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