Skip to content

Commit

Permalink
Merge pull request #91 from EducationalTestingService/release/0.4.0
Browse files Browse the repository at this point in the history
Release/0.4.0
  • Loading branch information
jbiggsets authored Oct 21, 2021
2 parents 58ca155 + 73908b0 commit b11e839
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Confirmatory factor analysis example.
Requirements
------------

- Python 3.4 or higher
- Python 3.7 or higher
- ``numpy``
- ``pandas``
- ``scipy``
Expand Down
5 changes: 1 addition & 4 deletions conda-recipe/factor_analyzer/meta.yaml
Original file line number Diff line number Diff line change
@@ -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 }}'
Expand Down
35 changes: 15 additions & 20 deletions factor_analyzer/__init__.py
Original file line number Diff line number Diff line change
@@ -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)
36 changes: 18 additions & 18 deletions factor_analyzer/confirmatory_factor_analyzer.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
27 changes: 9 additions & 18 deletions factor_analyzer/factor_analyzer.py
Original file line number Diff line number Diff line change
@@ -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']
Expand Down
9 changes: 4 additions & 5 deletions factor_analyzer/rotator.py
Original file line number Diff line number Diff line change
@@ -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']
Expand Down
20 changes: 8 additions & 12 deletions factor_analyzer/test_utils.py
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
11 changes: 6 additions & 5 deletions factor_analyzer/utils.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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)

0 comments on commit b11e839

Please sign in to comment.