diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d63e805..e87e751 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: - test variables: - PYVERSION: "3.8" + PYVERSION: "3.9" NOSE_WITH_COV: "1" NOSE_COVER_PACKAGE: "factor_analyzer" LOGCAPTURE_LEVEL: "DEBUG" diff --git a/README.rst b/README.rst index 211304a..c1f942f 100644 --- a/README.rst +++ b/README.rst @@ -187,7 +187,7 @@ Confirmatory factor analysis example. Requirements ------------ -- Python 3.4 or higher +- Python 3.7 or higher - ``numpy`` - ``pandas`` - ``scipy`` diff --git a/conda-recipe/factor_analyzer/meta.yaml b/conda-recipe/factor_analyzer/meta.yaml index 82348b8..2b432f1 100644 --- a/conda-recipe/factor_analyzer/meta.yaml +++ b/conda-recipe/factor_analyzer/meta.yaml @@ -1,8 +1,5 @@ {% set name = "factor_analyzer" %} -{% set version = "0.3.2" %} -{% set file_ext = "tar.gz" %} -{% set hash_type = "sha256" %} -{% set hash_value = "94ea4c7d46e846cc7174787adce47156cf58dc257905c878edc5181b4fa300ed" %} +{% set version = "0.4.0" %} package: name: '{{ name|lower }}' diff --git a/factor_analyzer/__init__.py b/factor_analyzer/__init__.py index 5acf1ac..03028ba 100644 --- a/factor_analyzer/__init__.py +++ b/factor_analyzer/__init__.py @@ -1,29 +1,24 @@ -# License: GLP2 +# License: GPL2 """ :author: Jeremy Biggs (jbiggs@ets.org) -:organization: ETS +:author: Nitin Madnani (nmadnani@ets.org) +:organization: Educational Testing Service +:date: 2021-10-18 """ +from .confirmatory_factor_analyzer import ConfirmatoryFactorAnalyzer, ModelSpecification, ModelSpecificationParser +from .factor_analyzer import FactorAnalyzer, calculate_bartlett_sphericity, calculate_kmo from .rotator import Rotator - -from .factor_analyzer import (FactorAnalyzer, - calculate_bartlett_sphericity, - calculate_kmo) - -from .confirmatory_factor_analyzer import (ConfirmatoryFactorAnalyzer, - ModelSpecificationParser, - ModelSpecification) - -from .utils import (cov, +from .utils import (commutation_matrix, corr, - fill_lower_diag, - impute_values, - smc, - partial_correlations, - merge_variance_covariance, + cov, + covariance_to_correlation, duplication_matrix, duplication_matrix_pre_post, - covariance_to_correlation, - commutation_matrix, + fill_lower_diag, get_symmetric_lower_idxs, - get_symmetric_upper_idxs) + get_symmetric_upper_idxs, + impute_values, + merge_variance_covariance, + partial_correlations, + smc) diff --git a/factor_analyzer/confirmatory_factor_analyzer.py b/factor_analyzer/confirmatory_factor_analyzer.py index 31b5129..85dcd9a 100644 --- a/factor_analyzer/confirmatory_factor_analyzer.py +++ b/factor_analyzer/confirmatory_factor_analyzer.py @@ -1,33 +1,33 @@ """ -Confirmatory factor analysis using ML. +Confirmatory factor analysis using machine learning methods. :author: Jeremy Biggs (jbiggs@ets.org) -:date: 2/05/2019 -:organization: ETS +:author: Nitin Madnani (nmadnani@ets.org) +:organization: Educational Testing Service +:date: 2021-10-18 """ -import pandas as pd -import numpy as np import warnings - from copy import deepcopy -from scipy.optimize import minimize -from scipy.linalg import block_diag +import numpy as np +import pandas as pd +from scipy.linalg import block_diag +from scipy.optimize import minimize from sklearn.base import BaseEstimator, TransformerMixin from sklearn.utils import check_array from sklearn.utils.validation import check_is_fitted -from factor_analyzer.utils import (cov, - covariance_to_correlation, - commutation_matrix, - duplication_matrix_pre_post, - get_free_parameter_idxs, - get_symmetric_lower_idxs, - get_symmetric_upper_idxs, - impute_values, - unique_elements, - merge_variance_covariance) +from .utils import (commutation_matrix, + cov, + covariance_to_correlation, + duplication_matrix_pre_post, + get_free_parameter_idxs, + get_symmetric_lower_idxs, + get_symmetric_upper_idxs, + impute_values, + merge_variance_covariance, + unique_elements) class ModelSpecification: diff --git a/factor_analyzer/factor_analyzer.py b/factor_analyzer/factor_analyzer.py index 8804ff7..c86206c 100644 --- a/factor_analyzer/factor_analyzer.py +++ b/factor_analyzer/factor_analyzer.py @@ -1,36 +1,27 @@ """ -Factor analysis using MINRES or ML, -with optional rotation using Varimax or Promax. +Factor analysis using MINRES or ML, with optional rotation using Varimax or Promax. :author: Jeremy Biggs (jbiggs@ets.org) :author: Nitin Madnani (nmadnani@ets.org) -:date: 10/25/2017 -:organization: ETS +:organization: Educational Testing Service +:date: 2021-10-18 """ import warnings import numpy as np -import scipy as sp import pandas as pd - -from scipy.stats import chi2, pearsonr +import scipy as sp from scipy.optimize import minimize - +from scipy.stats import chi2, pearsonr from sklearn.base import BaseEstimator, TransformerMixin - -from factor_analyzer.utils import (corr, - impute_values, - partial_correlations, - smc) -from factor_analyzer.rotator import Rotator -from factor_analyzer.rotator import POSSIBLE_ROTATIONS, OBLIQUE_ROTATIONS - - -from sklearn.utils.extmath import randomized_svd from sklearn.utils import check_array +from sklearn.utils.extmath import randomized_svd from sklearn.utils.validation import check_is_fitted +from .rotator import OBLIQUE_ROTATIONS, POSSIBLE_ROTATIONS, Rotator +from .utils import corr, impute_values, partial_correlations, smc + POSSIBLE_SVDS = ['randomized', 'lapack'] POSSIBLE_IMPUTATIONS = ['mean', 'median', 'drop'] diff --git a/factor_analyzer/rotator.py b/factor_analyzer/rotator.py index 847e02d..02b3bad 100644 --- a/factor_analyzer/rotator.py +++ b/factor_analyzer/rotator.py @@ -1,15 +1,14 @@ """ -Rotator class to perform various -rotations of factor loading matrices. +Class to perform various rotations of factor loading matrices. :author: Jeremy Biggs (jbiggs@ets.org) -:date: 05/21/2018 -:organization: ETS +:author: Nitin Madnani (nmadnani@ets.org) +:organization: Educational Testing Service +:date: 2021-10-18 """ import numpy as np import scipy as sp - from sklearn.base import BaseEstimator ORTHOGONAL_ROTATIONS = ['varimax', 'oblimax', 'quartimax', 'equamax', 'geomin_ort'] diff --git a/factor_analyzer/test_utils.py b/factor_analyzer/test_utils.py index 97ab8a9..bc5ce13 100644 --- a/factor_analyzer/test_utils.py +++ b/factor_analyzer/test_utils.py @@ -1,25 +1,21 @@ """ -Testing utilities +Utility functions used for testing. :author: Jeremy Biggs (jbiggs@ets.org) -:date: 05/21/2018 -:organization: ETS +:author: Nitin Madnani (nmadnani@ets.org) +:organization: Educational Testing Service +:date: 2021-10-18 """ -import os -import math import json +import math +import os +from os.path import join import numpy as np import pandas as pd -from os.path import join - +from factor_analyzer import ConfirmatoryFactorAnalyzer, FactorAnalyzer, ModelSpecificationParser, Rotator from factor_analyzer.utils import unique_elements -from factor_analyzer import ModelSpecificationParser -from factor_analyzer import ConfirmatoryFactorAnalyzer -from factor_analyzer import FactorAnalyzer -from factor_analyzer import Rotator - DATA_DIR = os.path.join('tests', 'data') JSON_DIR = os.path.join('tests', 'model') diff --git a/factor_analyzer/utils.py b/factor_analyzer/utils.py index 831beee..586e54d 100644 --- a/factor_analyzer/utils.py +++ b/factor_analyzer/utils.py @@ -1,13 +1,14 @@ """ -Utility functions, used primarily by -the confirmatory factor analysis module. +Utility functions, used primarily by the confirmatory factor analysis module. :author: Jeremy Biggs (jbiggs@ets.org) -:date: 2/05/2019 -:organization: ETS +:author: Nitin Madnani (nmadnani@ets.org) +:organization: Educational Testing Service +:date: 2021-10-18 """ -import numpy as np import warnings + +import numpy as np from scipy.linalg import cholesky diff --git a/setup.py b/setup.py index c54ff75..60fcf3c 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ def requirements(): setup(name='factor_analyzer', - version='0.3.2', + version='0.4.0', description='A Factor Analysis class', long_description=readme(), keywords='factor analysis', @@ -35,9 +35,8 @@ def requirements(): 'Operating System :: Unix', 'Operating System :: MacOS', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', ], zip_safe=True)