Skip to main content

A package for interpretable factor analysis

Project description

The interpretablefa package

Overview

This is a package, which is available on the Python Package Index, for performing interpretable factor analysis. This implements the priorimax rotation, including the associated interpretability index and plot, that are described here.

It also contains several helper and visualization functions and wraps several functions from the factor_analyzer package.

For more details about the methods implemented and some of the package's features, see Pairwise Target Rotation for Factor Models. The package's source code can be found here.

The linked paper provides some documentation to the package and docstrings are available. However, a comprehensive guide or documentation is still under development.

Example

For instance, suppose that data contains the dataset and q contains the questions. Then, one can fit a 4-factor priorimax model using the snippet below.

import pandas as pd
from interpretablefa import InterpretableFA

# Load the dataset and the questions
data = pd.read_csv("./data/ECR_data_clean.csv")
with open("./data/ECR_questions.txt") as questions_file:
    q = questions_file.read().split("\n")
    questions_file.close()

# Initialize the analyzer
analyzer = InterpretableFA(data)

# Fit the 4-factor model with the priorimax rotation
analyzer.fit_factor_model("model", 4, "priorimax", q)

# Get the results
print(analyzer.calculate_indices("model")["v_index"])
print(analyzer.models["model"].rotation_matrix_)

# Visualize the results
analyzer.var_factor_corr_plot("model")
analyzer.interp_plot("model")

Requirements

  • Python 3.8 or higher
  • numpy
  • pandas
  • scikit-learn
  • factor_analyzer
  • tensorflow_hub
  • scipy
  • seaborn
  • matplotlib
  • statsmodels

License

GNU General Public License 3.0

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

interpretablefa-6.0.7.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

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

interpretablefa-6.0.7-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file interpretablefa-6.0.7.tar.gz.

File metadata

  • Download URL: interpretablefa-6.0.7.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for interpretablefa-6.0.7.tar.gz
Algorithm Hash digest
SHA256 85ace130e920c5ef06f86fe8ec008a48b77141ed750a4982c915474dd99af8bc
MD5 c7a3bff232374a9c1979b1fdb3354cb2
BLAKE2b-256 2ec8530da479a0d9cbedd31584713a9c8a65d45e60d4e9c46e2a8fac4cf84a61

See more details on using hashes here.

File details

Details for the file interpretablefa-6.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for interpretablefa-6.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b9520eac28b5aa0571b459ed4dd63dba7b0ffeab634745600c655a67a74e8d86
MD5 d4d637eef536c1fedbf133ce1047c143
BLAKE2b-256 d9a5e0eaaf7dc9932f3c0904ee5f4f5e93ce2545d5c5872f78b10ef0f8b0bcbb

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