Exemplo n.º 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 + "}"
Exemplo n.º 2
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 + "}"
Exemplo n.º 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") + "}"
Exemplo n.º 4
0
    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") + "}"
Exemplo 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 + "}"
Exemplo n.º 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 + "}"
Exemplo n.º 7
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 + "}"
Exemplo n.º 8
0
    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 + "}"
Exemplo n.º 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 + "}"
Exemplo n.º 10
0
    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 + "}"
Exemplo n.º 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 + "}"
Exemplo n.º 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") + "}"
Exemplo n.º 13
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") + "}"
Exemplo n.º 14
0
    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 + "}"
Exemplo n.º 15
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 in dir(self):
            attrValue = self.__getattribute__(attrName)
            serializationString += ju.parseAttribute(attrValue, attrName)

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

        return "{" + s + "}"
Exemplo n.º 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 + "}"
Exemplo n.º 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 + "}"
Exemplo n.º 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 + "}"
Exemplo n.º 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"