-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from EducationalTestingService/add-weights-as-…
…attribute Save weights as an attribute
- Loading branch information
Showing
2 changed files
with
19 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
with optional rotation using Varimax or Promax. | ||
:author: Jeremy Biggs ([email protected]) | ||
:author: Nitin Madnani ([email protected]) | ||
:date: 10/25/2017 | ||
:organization: ETS | ||
""" | ||
|
@@ -288,6 +289,7 @@ def __init__(self, | |
self.corr_ = None | ||
self.loadings_ = None | ||
self.rotation_matrix_ = None | ||
self.weights_ = None | ||
|
||
@staticmethod | ||
def _fit_uls_objective(psi, corr_mtx, n_factors): | ||
|
@@ -734,13 +736,13 @@ def transform(self, X): | |
structure = self.loadings_ | ||
|
||
try: | ||
weights = np.linalg.solve(self.corr_, structure) | ||
self.weights_ = np.linalg.solve(self.corr_, structure) | ||
except Exception as error: | ||
warnings.warn('Unable to calculate the factor score weights; ' | ||
'factor loadings used instead: {}'.format(error)) | ||
weights = self.loadings_ | ||
self.weights_ = self.loadings_ | ||
|
||
scores = np.dot(X_scale, weights) | ||
scores = np.dot(X_scale, self.weights_) | ||
return scores | ||
|
||
def get_eigenvalues(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters