コード例 #1
0
    def toJson(self):
        """
        @return: a string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        attrName = "_ASGCKnowledge__alphas"
        attrValue = self.__getattribute__(attrName)
        serializationString += ju.parseAttribute(attrValue, attrName)

        attrName = "_ASGCKnowledge__grids"
        attrValue = self.__getattribute__(attrName)
        serializationString += ju.parseAttribute(attrValue, attrName)

        attrName = "_ASGCKnowledge__iteration"
        attrValue = self.__getattribute__(attrName)
        serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        # print "j-------------------------------------------"
        # print "{" + s + "}"
        # print "j-------------------------------------------"

        return "{" + s + "}"
コード例 #2
0
ファイル: ASGCKnowledge.py プロジェクト: pfluegdk/SGpp
    def toJson(self):
        """
        @return: a string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        attrName = "_ASGCKnowledge__alphas"
        attrValue = self.__getattribute__(attrName)
        serializationString += ju.parseAttribute(attrValue, attrName)

        attrName = "_ASGCKnowledge__grids"
        attrValue = self.__getattribute__(attrName)
        serializationString += ju.parseAttribute(attrValue, attrName)

        attrName = "_ASGCKnowledge__iteration"
        attrValue = self.__getattribute__(attrName)
        serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        # print "j-------------------------------------------"
        # print "{" + s + "}"
        # print "j-------------------------------------------"

        return "{" + s + "}"
コード例 #3
0
    def toJson(self):
        """
        Returns a string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        # serialize
        for attrName in ('_name', '_value', '_trans'):
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        # serialize dist
        if self.isUncertain():
            attrName = "_dist"
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        return "{" + serializationString.rstrip(",\n") + "}"
コード例 #4
0
ファイル: Parameter.py プロジェクト: ABAtanasov/Sparse-Grids
    def toJson(self):
        """
        Returns a string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        # serialize
        for attrName in ('_name', '_value'):
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        # serialize dist
        if self.isUncertain():
            attrName = "_dist"
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        return "{" + serializationString.rstrip(",\n") + "}"
コード例 #5
0
    def toJson(self):
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        for attrName in dir(self):
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        return "{" + s + "}"
コード例 #6
0
    def toJson(self):
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        for attrName in ["_Lognormal__mu", "_Lognormal__sigma", "_Lognormal__a", "_Lognormal__b"]:
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        return "{" + s + "}"
コード例 #7
0
ファイル: MultivariateNormal.py プロジェクト: pfluegdk/SGpp
    def toJson(self):
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        for attrName in dir(self):
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        return "{" + s + "}"
コード例 #8
0
ファイル: ASGCSampler.py プロジェクト: jsgphd/Sparse-Grids
    def toJson(self):
        """
        @return: string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'
        for attrName in dir(self):
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        for attrName in dir(self.__specification):
            attrValue = self.__specification.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        # print "j-------------------------------------------"
        # print "{" + s + "}"
        # print "j-------------------------------------------"

        return "{" + s + "}"
コード例 #9
0
    def toJson(self):
        """
        Returns a string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        for attrName in ("_LinearTransformation__a", "_LinearTransformation__b"):
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        return "{" + s + "}"
コード例 #10
0
ファイル: Uniform.py プロジェクト: ABAtanasov/Sparse-Grids
    def toJson(self):
        """
        Returns a string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        for attrName in dir(self):
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        return "{" + s + "}"
コード例 #11
0
    def toJson(self):
        """
        Returns a string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        attrName = "_dist"
        attrValue = self._dist
        serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        return "{" + s + "}"
コード例 #12
0
    def toJson(self):
        """
        Returns a string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        # serialize
        for attrName in ('_Sample__activeUnit', '_Sample__activeProb',
                         '_Sample__expandedUnit', '_Sample__expandedProb'):
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        return "{" + serializationString.rstrip(",\n") + "}"
コード例 #13
0
ファイル: Sample.py プロジェクト: ABAtanasov/Sparse-Grids
    def toJson(self):
        """
        Returns a string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        # serialize
        for attrName in ('_Sample__activeUnit',
                         '_Sample__activeProb',
                         '_Sample__expandedUnit',
                         '_Sample__expandedProb'):
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        return "{" + serializationString.rstrip(",\n") + "}"
コード例 #14
0
ファイル: NatafDist.py プロジェクト: pfluegdk/SGpp
    def toJson(self):
        """
        Returns a string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        for attrName, attrValue in [
            ("bounds", self.bounds),
            ("params", self.params),
        ]:
            serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        return "{" + s + "}"
コード例 #15
0
ファイル: Beta.py プロジェクト: jsgphd/Sparse-Grids
    def toJson(self):
        """
        Returns a string that represents the object

        Arguments:

        Return A string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        for attrName in dir(self):
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        return "{" + s + "}"
コード例 #16
0
    def toJson(self):
        """
        @return: string that represents the object
        """
        raise NotImplementedError()
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'
        for attrName in dir(self):
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        # print( "j-------------------------------------------" )
        # print( "{" + s + "}" )
        # print( "j-------------------------------------------" )

        return "{" + s + "}"
コード例 #17
0
    def toJson(self):
        """
        Returns a string that represents the object

        Arguments:

        Return A string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        for attrName, attrValue in [
            ("_KDEDist__kernelType", str(self.dist.getKernel().getType())),
            ("_KDEDist__bandwidths", self.getBandwidths()),
            ("_KDEDist__trainData", self.trainData),
            ("_KDEDist__bounds", self.bounds)
        ]:
            serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        return "{" + s + "}"
コード例 #18
0
    def toJson(self):
        """
        Returns a string that represents the object

        Arguments:

        Return A string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        for attrName, attrValue in [("_SGDEdist__grid", self.grid),
                                    ("_SGDEdist__alpha", self.alpha),
                                    ("_SGDEdist__trainData", self.trainData),
                                    ("_SGDEdist__config", self.config),
                                    ("_SGDEdist__bounds", self.bounds),
                                    ("_SGDEdist__unitIntegrand", self.unitIntegrand), ]:
            serializationString += ju.parseAttribute(attrValue, attrName)

        s = serializationString.rstrip(",\n")

        return "{" + s + "}"
コード例 #19
0
    def toJson(self):
        """
        Returns a string that represents the object

        Arguments:

        Return A string that represents the object
        """
        serializationString = '"module" : "' + \
                              self.__module__ + '",\n'

        for attrName, attrValue in [("_JointTransformation__ixs", self.__ixs),
                                    ("_JointTransformation__n", self.__n)]:
            serializationString += ju.parseAttribute(attrValue, attrName)

        # serialize transformations
        attrName = "_JointTransformation__trans"
        attrValue = self.__getattribute__(attrName)
        x = [trans.toJson() for trans in attrValue]
        x = ['"' + str(i) + '": ' + str(xi) for i, xi in enumerate(x)]
        serializationString += '"' + attrName + '": {' + ', '.join(x) + '}'

        return "{" + serializationString + "} \n"