Exemplo n.º 1
0
    def __init__(
        self,
        steps='1',
        alpha=0.001,
        clVerbosity=0,
        implementation=None,
    ):

        # Convert the steps designation to a list
        self.steps = steps
        self.stepsList = eval("[%s]" % (steps))
        self.alpha = alpha
        self.verbosity = clVerbosity

        # Initialize internal structures
        self._claClassifier = CLAClassifierFactory.create(
            steps=self.stepsList,
            alpha=self.alpha,
            verbosity=self.verbosity,
            implementation=implementation,
        )
        self.learningMode = True
        self.inferenceMode = False

        self._initEphemerals()
Exemplo n.º 2
0
    def __init__(self,
                 steps='1',
                 alpha=0.001,
                 clVerbosity=0,
                 implementation=None,
                 maxCategoryCount=None):

        # Convert the steps designation to a list
        self.steps = steps
        self.stepsList = eval("[%s]" % (steps))
        self.alpha = alpha
        self.verbosity = clVerbosity

        # Initialize internal structures
        self._claClassifier = CLAClassifierFactory.create(
            steps=self.stepsList,
            alpha=self.alpha,
            verbosity=self.verbosity,
            implementation=implementation,
        )
        self.learningMode = True
        self.inferenceMode = False
        self.maxCategoryCount = maxCategoryCount
        self.recordNum = 0
        self._initEphemerals()

        # Flag to know if the compute() function is ever called. This is to
        # prevent backward compatibilities issues with the customCompute() method
        # being called at the same time as the compute() method. Only compute()
        # should be called via network.run(). This flag will be removed once we
        # get to cleaning up the clamodel.py file.
        self._computeFlag = False
Exemplo n.º 3
0
  def __init__(self,
               steps='1',
               alpha=0.001,
               clVerbosity=0,
               implementation=None,
               maxCategoryCount=None
               ):

    # Convert the steps designation to a list
    self.steps = steps
    self.stepsList = eval("[%s]" % (steps))
    self.alpha = alpha
    self.verbosity = clVerbosity

    # Initialize internal structures
    self._claClassifier = CLAClassifierFactory.create(
      steps=self.stepsList,
      alpha=self.alpha,
      verbosity=self.verbosity,
      implementation=implementation,
    )
    self.learningMode = True
    self.inferenceMode = False
    self.maxCategoryCount = maxCategoryCount
    self.recordNum = 0
    self._initEphemerals()

    # Flag to know if the compute() function is ever called. This is to 
    # prevent backward compatibilities issues with the customCompute() method
    # being called at the same time as the compute() method. Only compute() 
    # should be called via network.run(). This flag will be removed once we 
    # get to cleaning up the clamodel.py file.
    self._computeFlag = False
Exemplo n.º 4
0
  def readFromProto(cls, proto):
    """Read state from proto object.

    proto: CLAClassifierRegionProto capnproto object
    """
    instance = cls()

    instance.classifierImp = proto.classifierImp
    instance.steps = proto.steps
    instance.alpha = proto.alpha
    instance.verbosity = proto.verbosity
    instance.maxCategoryCount = proto.maxCategoryCount

    instance._claClassifier = CLAClassifierFactory.read(proto)

    return instance
Exemplo n.º 5
0
    def read(cls, proto):
        """Read state from proto object.

    proto: PyRegionProto capnproto object
    """
        regionImpl = proto.regionImpl.as_struct(CLAClassifierRegionProto)

        instance = cls()

        instance.classifierImp = regionImpl.classifierImp
        instance.steps = regionImpl.steps
        instance.alpha = regionImpl.alpha
        instance.verbosity = regionImpl.verbosity
        instance.maxCategoryCount = regionImpl.maxCategoryCount

        instance._claClassifier = CLAClassifierFactory.read(regionImpl)

        return instance
Exemplo n.º 6
0
  def read(cls, proto):
    """Read state from proto object.

    proto: PyRegionProto capnproto object
    """
    regionImpl = proto.regionImpl.as_struct(CLAClassifierRegionProto)

    instance = cls()

    instance.classifierImp = regionImpl.classifierImp
    instance.steps = regionImpl.steps
    instance.alpha = regionImpl.alpha
    instance.verbosity = regionImpl.verbosity
    instance.maxCategoryCount = regionImpl.maxCategoryCount

    instance._claClassifier = CLAClassifierFactory.read(regionImpl)

    return instance
Exemplo n.º 7
0
  def __init__(self,
               steps='1',
               alpha=0.001,
               clVerbosity=0,
               implementation=None,
               ):

    # Convert the steps designation to a list
    self.steps = steps
    self.stepsList = eval("[%s]" % (steps))
    self.alpha = alpha
    self.verbosity = clVerbosity

    # Initialize internal structures
    self._claClassifier = CLAClassifierFactory.create(
        steps=self.stepsList,
        alpha=self.alpha,
        verbosity=self.verbosity,
        implementation=implementation,
        )
    self.learningMode = True
    self.inferenceMode = False

    self._initEphemerals()