Ho riprovato mettendo fra virgolette i nomi degli script: C:\...>python "setup.py" install
da lo stesso errore di C:\...>Python setup.py install Il giorno mar 22 ott 2019 alle ore 17:00 Alberto Girardi < alberto.gir...@gmail.com> ha scritto: > Ecco il file setup.py > > from distutils.core import setup > > > setup( > name = 'PyNEURONE', > version = '1.3.1', > description = 'Leggi il file .txt nella cartella', > long_description = open('FAQ_PyNeur.txt', 'r').read(), > py_modules = ['Ag_Neuron'], > author = 'Alberto Girardi', > author_email = 'alberto.gir...@gmail.com', > keywords = 'python generators distutils', > scripts = 'PyNEURONE-1.3.1.py', > platforms = 'all', > classifiers = ['Intended Audience::Education' > ] > > ) > > > Ecco anche il file che contiene la definizione delle classi. E' abbastanza > grande, spero di non intasare troppo la mail: > > import math > > class Neurone: > > def __init__(self): > self.pesi = [1, 1] > self.learning_rate = 0.4999 > self.delta_learningrate = 0.0018 > self.errore_tot = 0 > > def detPesi(self, ninputs): > pesi = [1 for i in range( ninputs)] > > def activationFunction(self, pa): > #soglia > return 1/(1 + math.exp(-pa)) > #if pa> 0.0: > # return 1.0 > # else: > # return 0.0 > > def output (self, inputs): > pa = 0 > for i in range(len(inputs)): > pa += inputs[i] * self.pesi[i] > > return self.activationFunction(pa) > > def learn(self, x, target ): > out = self.output(x) > errore = target - out > > for i, w in enumerate(self.pesi): > > self.pesi[i] += self.learning_rate * errore * x[i] > > print(' target : ', target, ' '*(15-len(str(target))),' > out:',out,' '*(22-len(str(out))),' errore:',errore) > > class Progetto(): > > def __init__(self, neurone, nome=''): > self.neuron = neurone > self.nome = nome > self.file_in = '' > self.n_dir = '' > self.x_data = [] > self.y_data = [] > self.prog_loc = ''" > > def creaProgetto(self, name, f_in): > import os > self.nome = name > > try: > > f_log = open('log_p.txt', 'r' ) > self.prog_loc = f_log.readline() > f_log.close() > > except FileNotFoundError: > > > self.prog_loc = input('\nLa cartella progetti_ML non è > presente, in che path si vuole inserire la cartella (se su Windosw usare la > \\ ):') > f_log = open('log_p.txt', 'x' ) > f_log.write(self.prog_loc) > f_log.close() > > os.mkdir('{0}\\progetti_ML\\{1}_progetto'.format(self.prog_loc, self.nome)) > > > > self.n_dir= '{0}\\progetti_ML\\{1}_progetto'.format(self.prog_loc, > self.nome) > > try: > > f_lp = > open('{0}\\progetti_ML\\lista_progetti.txt'.format(self.prog_loc), 'a') > > > f_lp.write(self.nome+'\n') > f_lp.close() > > > # except: > #f_lp.close() > # print('Problema con il file') > except: > pass > > import time > > try: > with > open('{0}\\storico_progetti.txt'.format(self.prog_loc+'\\progetti_ML'), > 'a') as f_s: > f_s.write('Progetto {0} creato il {1} alle > {2}\n'.format(self.nome, time.strftime('%d/%m/%Y'), > time.strftime('%H:%M:%S'))) > > except FileNotFoundError: > f_s = > open('{0}\\storico_progetti.txt'.format(self.prog_loc+'\\progetti_ML'), 'w') > f_s.write('Progetto {0} creato il {1}\n'.format(self.nome, > time.strftime('%d/%m/%Y alle %H:%M:%S'))) > f_s.close() > > > > self.file_in = self.n_dir+'\\f_inputs.csv' > > try: > > os.mkdir(self.n_dir) > print('\nCartella creata') > > except : > pass > > > with open(f_in,'r') as f_inp: > with open(self.file_in, 'w') as f_inpc: > > f_inpc.write(f_inp.read()) > > > with open('{}\\storico.txt'.format(self.n_dir), 'w') as f_st: > f_st.write('Progetto {0} creato il {1} alle {2}, nel percorso > "{3}".\n'.format(self.nome, time.strftime('%d/%m/%Y'), > time.strftime('%H:%M:%S'), self.n_dir)) > > print('Progetto {0} creato il {1} alle {2}, nel percorso > "{3}"\nProggetto aggiunto alla lista dei progetti.'.format(self.nome, > time.strftime('%d/%m/%Y'), time.strftime('%H:%M:%S'), self.n_dir)) > print('File inputs copiato nella cartella del progetto') > print('Progetto aggiunto allo storico') > > > > > > def mostraProgetti(self): > with open('log_p.txt', 'r' ) as f_log: > > self.prog_loc = f_log.readline() > > f = > open('{}\\progetti_ML\\lista_progetti.txt'.format(self.prog_loc)) > > with f: > print('\n\nScegliere uno fra i seguenti > progetti:\n\n',f.read()) > > > def getProgetto(self): > self.nome = input('\nChe progetto si vuole caricare: ') > > with open('log_p.txt', 'r' ) as f_log: > > self.prog_loc = f_log.readline() > > > self.n_dir = > '{0}\\progetti_ML\\{1}_progetto'.format(self.prog_loc, self.nome) > > with > open('{}\\progetti_ML\\lista_progetti.txt'.format(self.prog_loc), 'r') as > f_lp: > > if self.nome in f_lp.read(): > print('Progetto esistente e caricato correttamente\n') > > with open('{}\\storico.txt'.format(self.n_dir), 'r+') as > f_st: > import time > > print('\n', f_st.read()) > f_st.write('\n\nRiapertura progetto effettuata il > {0}\n'.format(time.strftime('%d/%m/%Y alle %H:%M:%S'))) > return 0 > > else: > print('Progetto non esistente. Riprovare') > return 1 > > > > > def getInputs_et_Pesi(self, f_in): > self.file_in = f_in > self.getData() > > with open(self.n_dir+'\\pesi.txt', 'r') as f_p: > self.neuron.pesi = [float(i) for i in > f_p.readline()[1:-1].split(', ')] > > > def getPesi(self): > self.file_in = self.n_dir+'\\f_inputs.csv' > self.getData() > > with open(self.n_dir+'\\pesi.txt', 'r') as f_p: > self.neuron.pesi = [float(i) for i in > f_p.readline()[1:-1].split(', ')] > > > > > > def getData(self): > print('Caricamento file in corso...\n') > > self.data_x = [] > self.data_y = [] > > with open(self.file_in, newline='', mode = 'r') as f_in: > > import csv > lettore = csv.reader(f_in, delimiter = ';') > > for l in lettore: > self.data_x.append([float(i) for i in l[:-1]]) > self.data_y.append(float(l[-1])) > print(l) > > > print('Caricamento dati completato\n') > > print('\n\n\n','data_x',self.data_x,'data_y', self.data_y) > > > > > > def AllenaNeurone(self, n_epoch): > import time > > > print('\n\n\t\t\t\t\t\t\tINIZIO ALLENAMENTO NEURONE\n\n\n\n') > print('x train = ',self.data_x) > print('y train = ',self.data_y) > print("\n\nL'allenamento iniziera tra 5 secondi\n") > > import time > > with open('{0}\\storico.txt'.format(self.n_dir), 'a') as f_st: > f_st.write('Allenamento progetto per {0} epoche iniziato il > {1}'.format( str(n_epoch), time.strftime('%d/%m/%Y alle %H:%M:%S') )) > > > > for i in range(5): > print(5-i) > time.sleep(0.2) > > print('\nVia!!!') > > time.sleep(0.2) > > t = time.time() > > for epoch in range(n_epoch+1): > > print('\n') > print('epoch', epoch) > > for i, x in enumerate( self.data_x): > > target = self.data_y[ i ] > self.neuron.learn(x, target) > > te=time.time()-t > > t_e = te/n_epoch > e_t = n_epoch/te > > print('\n\n\n') > print('Allenamento durato :', te) > print('Secondi per epoch :', round(t_e, 10)) > print('Epoch al secondo :', round(e_t, 10)) > > with open('{}\\storico.txt'.format(self.n_dir), 'a') as f_st: > f_st.write('.\nAllenamento durato {0} s, secondi/epoch {1}, > epoch per secondo {2}\n\n'.format(te, t_e, e_t)) > > > > > def Predici(self): > print('\n\n\nPredizione del neurone sugli input dati:\n') > > for i in self.data_x: > out = self.neuron.output(i) > > print('\tinput: ', i, ' out:', out) > > > > def conservaPesi(self): > > > f_p = open(self.n_dir+'\\pesi.txt','w') > > with f_p: > f_p.write(str(self.neuron.pesi)) > > print('\n\n\nPesi salvati correttamente in {0}\\pesi.txt > '.format(self.n_dir)) > > > Spero l'identazione sia rimasta > > > > > > Il giorno lun 21 ott 2019 alle ore 18:08 Alberto Girardi < > alberto.gir...@gmail.com> ha scritto: > >> Ah, scusate io uso questi termini, ma forse non sono corretti. >> È il classico programma di machine learning basato sul 'neurone'. >> Il neurone prende degli input, una lista (ad esempio [1.0, 0.0]), li >> moltiplica per il peso che da a ciascuna connessione (l'elemento x della >> lista), e somma questi valori, poi lo manda a una funzione di >> normalizzazione, come la sigmoide. >> C'è poi una funzione dellaclasse Neurone che datele gli input e il >> risultato che dovrebbe esserci (esempio: l'ala è larga x e lunga y allora è >> una falena di specie z) >> Iterando su una lista di questi input e output aspettati il neurone >> corregge i propri pesi, e l'errore si attenua sempre di più, tranne i casi >> in cui non converge. >> >> >> >> Il lun 21 ott 2019, 17:44 Ivo Reano <reano...@gmail.com> ha scritto: >> >>> >>> Cerco di creare una distribuzione del mio programmino con distutils, >>>> cercavo anche di compilarla con pyinstaller, per passarlo a un mio amico ed >>>> a alcuni miei parenti. >>>> >>> Questa l'avevo capita. Intendevo il progetto "neurone perceptron" >>> >>> il file che genera l'errore sarebbe utile. >>> _______________________________________________ >>> Python mailing list >>> Python@lists.python.it >>> https://lists.python.it/mailman/listinfo/python >>> >>
_______________________________________________ Python mailing list Python@lists.python.it https://lists.python.it/mailman/listinfo/python