Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

random initial values for rotation matrix in GPA rotations

Open
#116 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
numpy, python
Domain
data

Research direction

Start in factor_analyzer/rotator.py at Rotator._oblique, Rotator._orthogonal, and Rotator._varimax, then check the other rotation methods for the same initialization. Verify the current identity-matrix behavior, define how random_state controls orthogonal initialization, and confirm that the default remains unchanged.

Written by the indexing model from the issue text.

Description

Hi all. First, thanks so much to the devs of factor_analyzer. It's a fantastic and much needed package!

Is your feature request related to a problem? Please describe.

As has been pointed out, the GPA rotation methods often converge to local minima (Browne, 2001; Bernaards & Jennrich, 2005; Nguyen & Waller, 2022). As such, it's been recommended researchers initialize the GPA from many starting values when searching for a global minimum. I'm wondering if the Rotator class could be amended in order to allow initializing the GPA from different starting values.

Describe the solution you'd like

One simple solution would be for the Rotator class to accept a new argument, random_state, which defaults to None. When random_state = None, the rotation matrix is initialized with np.eye(n_cols) as is currently implemented (L326, L416, L493). When a user specifies a seed, however, the rotation matrix is initialized as a random orthogonal matrix from scipy.stats.ortho_group. That is,:

# initialize the rotation matrix
_, n_cols = loadings.shape
if self.random_state == None:
    rotation_matrix = np.eye(n_cols)
else:
    rotation_matrix = sp.stats.ortho_group(dim=n_cols, seed=self.random_state).rvs()

A solution like the above could be added to the Rotator._oblique, Rotator._orthogonal, Rotator._varimax methods (and any others that I missed).

Apologies in advance if the above is already possible and I've simply missed how. If the above sounds like it may be useful, I'd be happy to attempt a PR.

All the best,
Sam (@szorowi1)

Dominant language
Python
Stars
6
Forks
1
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from EducationalTestingService/factor_analyzer

All issues in EducationalTestingService/factor_analyzer

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.