A performant factor analysis package for python
Project description
FastorAnalysis
FastorAnalysis is a performant Factor Analysis library for Python, modeled after R's factanal. FastorAnalysis is intended to provide efficient and scalable factor analysis.
Table of Contents
Introduction
FastorAnalysis is built to address the extremely pressing need for a slightly more performant and less featured factor analysis package in Python. The output stability of the R's factanal, the existing factoranalysis, and the emerging fastoranalysis vary somewhat significantly, however, there are parameter and implementation adjustments that can be made to match a given package more closely.
Features
- Fast (for python) and memory-efficient factor analysis implementation
- Support for large datasets
- Accessible API, similar to scikit-learn
- Optimized for both speed and memory usage
Installation
You can install FastorAnalysis using pip:
pip install fastoranalysis
Usage
Here's a quick example of how to use FastorAnalysis:
from fastoranalysis import FactorAnalysis
import numpy as np
# Generate sample data
X = np.random.rand(1000, 20)
# Create and fit the model
fa = FactorAnalysis(n_factors=5)
fa.fit(X)
# Get factor loadings
loadings = fa.loadings_
# Transform data
X_transformed = fa.transform(X)
For more detailed usage instructions and API documentation, please refer to documentation.
Performance Comparisons
Here are the results comparing the speed and memory performance of fastoranalysis, factoranalysis, and factanal.
Execution Time Comparison
Memory Usage Comparison
These benchmarks were conducted on datasets ranging from 1MB to 100MB, comparing FastorAnalysis ('fastor') with FactorAnalyzer ('factor') and R's factanal ('factanal'). The numerical values are available at /benchmarks/benchmark_results.csv.
As the graphs show, fastoranalyis execution time significantly outperforms factoranalysis unilaterally while being slower than factanal for smaller datasets. As dataset size increases, the difference between the execution times shrinks and fastoranalysis outperforms factanal for the 100MB dataset.
The Python implementations use significantly less memory, with fastor using the least memory across every dataset. The reasonably quick performance of fastoranalysis comes at the cost of less safety and general robustness.
Future Directions
- Input Flexibility: R's factanal supports formula interfaces and precomputed covariance matricies.
- Additional Rotation Methods: Expand the available rotation methods beyond varimax and promax.
- Incremental Learning: Develop an incremental learning approach for datasets that don't fit in memory.
- Improved Output Formatting: Implement more robust formatting and viewing options that are consistent with factanal.
- Parallel Processing: Add parallel processing capabilities for multi-core systems.
- GPU Acceleration: Implement cuda based computations for sufficiently large datasets.
License
Distributed under the MIT License. See LICENSE
file for more information.
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 fastoranalysis-0.1.0.tar.gz
.
File metadata
- Download URL: fastoranalysis-0.1.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fde97c119aa922d01387d73cf641c775547e78ea1b2a4aedccfc5bc6dace068 |
|
MD5 | 241b80e225f8e2e6733e39bf92359a18 |
|
BLAKE2b-256 | a491fae8dd66c19227e7aea4e751cd307532fb7bcd8bc5766cc125cc1ab2f5df |
File details
Details for the file fastoranalysis-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: fastoranalysis-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4118bfd0bc5ecff49073b4e8954a26966f13348835605e757929d1e6a72e6ba9 |
|
MD5 | b4a4e1b7694ecbacb5137406fab92849 |
|
BLAKE2b-256 | 65c6b8c90ce5fc2eeb48aab617cd73894e0dd9809e99c80a934a2dc46b8b9f88 |