class SOMTestAgent(Agent):
    """
    A simple agent that receives 2D points and trains a kohonen SOM
    and a Growing Neural Gas with them.  It produces no meanigful
    actions (i.e. it always emits 0).
    """
    def __init__(self, **args):

        # Call the superclass constructor
        super(SOMTestAgent, self).__init__(**args)

        # instantiate a SOM
        self.som = SOM()

        # intialize SOM training
        N = SOMTestEnvironment.num_samples_per_distr * 5
        self.som.init_training(radius_0=max(self.som.xdim, self.som.ydim),
                               training_length=N)

        # instantiate a Growing Neural Gas
        self.gng = EquilibriumGNG()

    def __call__(self, sensation, reward=None):

        # On receiving input train the SOM and GNG.
        self.som.train(sensation)
        self.gng.train(sensation)

        # Return 0 for the action.
        return 0
Ejemplo n.º 2
0
class SOMTestAgent(Agent):
    """
    A simple agent that receives 2D points and trains a kohonen SOM
    and a Growing Neural Gas with them.  It produces no meanigful
    actions (i.e. it always emits 0).
    """
    def __init__(self,**args):

        # Call the superclass constructor
        super(SOMTestAgent,self).__init__(**args)

        # instantiate a SOM
        self.som = SOM()

        # intialize SOM training
        N = SOMTestEnvironment.num_samples_per_distr * 5        
        self.som.init_training(radius_0 = max(self.som.xdim,self.som.ydim),
                               training_length = N)

        # instantiate a Growing Neural Gas
        self.gng = EquilibriumGNG()

    def __call__(self,sensation,reward=None):

        # On receiving input train the SOM and GNG.
        self.som.train(sensation)
        self.gng.train(sensation)

        # Return 0 for the action.
        return 0
    def __init__(self, **args):

        # Call the superclass constructor
        super(SOMTestAgent, self).__init__(**args)

        # instantiate a SOM
        self.som = SOM()

        # intialize SOM training
        N = SOMTestEnvironment.num_samples_per_distr * 5
        self.som.init_training(radius_0=max(self.som.xdim, self.som.ydim),
                               training_length=N)

        # instantiate a Growing Neural Gas
        self.gng = EquilibriumGNG()
Ejemplo n.º 4
0
    def __init__(self,**args):

        # Call the superclass constructor
        super(SOMTestAgent,self).__init__(**args)

        # instantiate a SOM
        self.som = SOM()

        # intialize SOM training
        N = SOMTestEnvironment.num_samples_per_distr * 5        
        self.som.init_training(radius_0 = max(self.som.xdim,self.som.ydim),
                               training_length = N)

        # instantiate a Growing Neural Gas
        self.gng = EquilibriumGNG()