Esempio n. 1
0
 def __init__(self, numero_entradas_rams, tamanho_entrada,
              numero_discriminadores):
     self.retina = retina.Retina(tamanho_entrada)
     self.discriminadores = []
     self.numero_discriminadores = numero_discriminadores
     for i in range(0, numero_discriminadores):
         self.discriminadores.append(
             discriminador.Discriminador(numero_entradas_rams,
                                         tamanho_entrada))
     self.classificacao_discriminadores = [0] * numero_discriminadores
Esempio n. 2
0
 def __init__(self, numero_entradas_rams, tamanho_entrada, score_minimo,
              intervalo_crescimento):
     self.retina = retina.Retina(tamanho_entrada)
     self.discriminadores = []
     self.numero_discriminadores = 0
     self.numero_entradas_rams = numero_entradas_rams
     self.tamanho_entrada = tamanho_entrada
     self.score_minimo = score_minimo
     self.intervalo_crescimento = intervalo_crescimento
     self.classificacao_discriminadores = []
     self.clusters = []
Esempio n. 3
0
 def __init__(self, numero_entradas_rams, tamanho_entrada, numero_discriminadores, score_minimo, intervalo_crescimento):
     self.retina = retina.Retina(tamanho_entrada)
     self.discriminadores = []
     self.numero_discriminadores = numero_discriminadores
     self.numero_entradas_rams = numero_entradas_rams
     self.tamanho_entrada = tamanho_entrada
     self.score_minimo = score_minimo
     self.intervalo_crescimento = intervalo_crescimento
     
     for i in range(0, numero_discriminadores):
         self.discriminadores.append(discriminador_cluswisard.DiscriminadorCluswisard(numero_entradas_rams, tamanho_entrada, i))
     self.classificacao_discriminadores = [0]*numero_discriminadores
Esempio n. 4
0
def init_ipy(debug=False, nb_dir=None, api_url=None):
    # get config
    for c in filter(lambda x: not x.startswith('_'), config.__dict__.keys()):
        setattr(Ipy, c, getattr(config, c))
    # set pathing
    if nb_dir and os.path.isdir(nb_dir):
        Ipy.NB_DIR = nb_dir
    else:
        Ipy.NB_DIR = os.getcwd()
    Ipy.LIB_DIR = Ipy.NB_DIR + '/lib'
    Ipy.TMP_DIR = Ipy.NB_DIR + '/tmp'
    Ipy.CCH_DIR = Ipy.NB_DIR + '/cache'
    Ipy.IMG_DIR = Ipy.NB_DIR + '/images'
    for d in (Ipy.LIB_DIR, Ipy.TMP_DIR, Ipy.IMG_DIR):
        if not os.path.isdir(d):
            os.mkdir(d)
    # set api
    if api_url is not None:
        Ipy.API_URL = api_url
    # set graphing tools
    Ipy.FL_PLOT = flotplot.FlotPlot()
    Ipy.RETINA = retina.Retina()
    Ipy.DEBUG = debug
    # load matR and extras
    ro.r('suppressMessages(library(matR))')
    ro.r('suppressMessages(library(gplots))')
    ro.r('suppressMessages(library(scatterplot3d))')
    # add tab completion from a dir - bit of a hack
    #   skip names with hyphen '-' in them, its an operator and not valid name syntax :(
    #   these are for kbase command line scripts, no .pl
    names = map(lambda x: os.path.basename(x), glob.glob(Ipy.KBASE_BIN + '/*'))
    names = filter(
        lambda x: (not x.endswith('.pl')) and (not x.endswith('.py')), names)
    Ipy.KBASE_CMDS = "\n".join(names)
    names = filter(lambda x: '-' not in x, names)
    add_tab_completion(names)
    # echo
    if Ipy.DEBUG:
        for k in filter(lambda x: not x.startswith('_'), Ipy.__dict__.keys()):
            print k, getattr(Ipy, k)
    liquid.matrix_programmable_exc_inh[
        use_retina_projections] = np.random.choice(
            [0, 1], size=np.sum(use_retina_projections))
    liquid.matrix_programmable_w[use_retina_projections] = np.random.choice(
        [0, 1, 2, 3], size=np.sum(use_retina_projections))

    liquid.program_config()
    ###### configure retina
    inputpop = pyNCS.Population('', '')
    inputpop.populate_by_id(nsetup, 'mn256r1', 'excitatory',
                            np.linspace(0, 255, 256))
    syncpop = pyNCS.Population("", "")
    syncpop.populate_by_id(nsetup, 'mn256r1', 'excitatory', [nsync])
    #reset multiplexer
    chip.configurator._set_multiplexer(0)
    retina = ret.Retina(inputpop)
    retina._init_fpga_mapper()
    retina.map_retina_sync(syncpop,
                           ncol_retina=ncol_retina_sync,
                           neu_sync=nsync)  ### neuron 255 is our sync neuron
    rr, pre, post = retina.map_retina_random_connectivity(
        inputpop, c=0.3, syntype='virtual_exc', ncol_sync=ncol_retina_sync)
    rr, pre, post = retina.map_retina_random_connectivity(
        inputpop, c=0.1, syntype='virtual_inh', ncol_sync=ncol_retina_sync)

    import RetinaInputs as ri
    win = ri.RetinaInputs(nsetup)
    #win.run(300)

    chip.load_parameters('biases/biases_reservoir_retina.biases')
Esempio n. 6
0
p = ParameterSpace({
    'noise_std':
    ParameterRange(list(10.**(numpy.linspace(-.50, 1., N_exp_noise))))
})

name = sys.argv[0].split('.')[
    0]  # name of the current script withpout the '.py' part
results = shelve.open('results/mat-' + name)
try:
    CRF = results['CRF']
except:
    # this is not mandatory but just a "easy_install progressbar" away
    # else remove all corresponding lines in this code...
    import progressbar  # see http://projects.scipy.org/pipermail/scipy-dev/2008-January/008200.html
    import retina as model
    retina = model.Retina(N)
    retina.params['snr'] = 0  # no input

    # calculates the dimension of the parameter space
    results_dim, results_label = p.parameter_space_dimension_labels()

    # creates results array with size of parameter space dimension
    CRF = numpy.empty(results_dim)

    pbar = progressbar.ProgressBar(widgets=[
        name, " ",
        progressbar.Percentage(), ' ',
        progressbar.Bar(), ' ',
        progressbar.ETA()
    ],
                                   maxval=numpy.prod(results_dim))