Page MenuHomec4science

trained_model_pivoted_data.py
No OneTemporary

File Metadata

Created
Tue, May 21, 03:39

trained_model_pivoted_data.py

# Copyright (C) 2018 by the RROMPy authors
#
# This file is part of RROMPy.
#
# RROMPy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# RROMPy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with RROMPy. If not, see <http://www.gnu.org/licenses/>.
#
from rrompy.reduction_methods.base.trained_model.trained_model_data import (
TrainedModelData)
from rrompy.utilities.base.types import Np2D, List, ListAny, paramVal
from rrompy.parameter import checkParameterList
__all__ = ['TrainedModelPivotedData']
class TrainedModelPivotedData(TrainedModelData):
"""ROM approximant evaluation data (must be pickle-able)."""
def __init__(self, mu0:paramVal, projMat:Np2D,
scaleFactor : ListAny = [1.],
rescalingExp : List[float] = [1.],
directionPivot : ListAny = [0]):
super().__init__(mu0, projMat, scaleFactor, rescalingExp)
self.directionPivot = directionPivot
@property
def directionMarginal(self):
return tuple([x for x in range(self.npar) \
if x not in self.directionPivot])
@property
def mu0Pivot(self):
return checkParameterList(self.mu0(0, self.directionPivot),
self.nparPivot)[0]
@property
def mu0Marginal(self):
return checkParameterList(self.mu0(0, self.directionMarginal),
self.nparMarginal)[0]
@property
def nparPivot(self):
return len(self.directionPivot)
@property
def nparMarginal(self):
return self.npar - self.nparPivot
@property
def rescalingExpPivot(self):
return [self.rescalingExp[x] for x in self.directionPivot]
@property
def rescalingExpMarginal(self):
return [self.rescalingExp[x] for x in self.directionMarginal]
@property
def scaleFactorPivot(self):
return [self.scaleFactor[x] for x in self.directionPivot]
@property
def scaleFactorMarginal(self):
return [self.scaleFactor[x] for x in self.directionMarginal]

Event Timeline