Skip to content

Commit

Permalink
Modify RWD to use np svd
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjm committed Jul 24, 2023
1 parent b39f8ec commit 76a9732
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions ravenframework/SupervisedLearning/SupervisedLearning.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,16 +795,16 @@ def finalizeGlobalRomSegmentEvaluation(self, settings, evaluation, weights, slic
return evaluation
### END ROM Clustering ###

# @abc.abstractmethod
# def _train(self,featureVals,targetVals):
# """
# Perform training on samples in featureVals with responses y.
# For an one-class model, +1 or -1 is returned.
# @ In, featureVals, {array-like, sparse matrix}, shape=[n_samples, n_features],
# an array of input feature values
# @ Out, targetVals, array, shape = [n_samples], an array of output target
# associated with the corresponding points in featureVals
# """
@abc.abstractmethod
def _train(self,featureVals,targetVals):
"""
Perform training on samples in featureVals with responses y.
For an one-class model, +1 or -1 is returned.
@ In, featureVals, {array-like, sparse matrix}, shape=[n_samples, n_features],
an array of input feature values
@ Out, targetVals, array, shape = [n_samples], an array of output target
associated with the corresponding points in featureVals
"""

@abc.abstractmethod
def __confidenceLocal__(self,featureVals):
Expand Down
4 changes: 2 additions & 2 deletions ravenframework/TSA/RWD.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ def fit(self, signal, pivot, targets, settings):
baseMatrix = np.zeros((signatureWindowLength, windowNumber))
for i in range(windowNumber-1):
baseMatrix[:,i] = np.copy(history[i*signatureWindowLength:(i+1)*signatureWindowLength])
U, s, V = mathUtils.computeTruncatedSingularValueDecomposition(baseMatrix,0)
U,s,V = np.linalg.svd(baseMatrix, full_matrices=True)
featureMatrix = U.T @ signatureMatrix
params[target] = {'uVec' : U[:,0:fi],
'Feature': featureMatrix}
'Feature': featureMatrix[0:fi,:]}
return params

def getParamNames(self, settings):
Expand Down

0 comments on commit 76a9732

Please sign in to comment.