-
Notifications
You must be signed in to change notification settings - Fork 8
Deber de comparacion del tiempo de ordenamiento entre bubble sort e i… #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
30218e6
812911a
0673b0f
7b28925
539938e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| class perceptron: | ||
|
|
||
| def insert_matriz(self): | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Recomendaría que no cargue elemento a elemento los datos. Esto esta bien para ejemplos tipo toy como AND y OR y XOR, pero si tengo cientos de datos? Preferible que cargue la matriz de datos X desde afuera y mas bien extraiga de la misma las filas y columnas para disponer del numero de muestras y del numero de componentes |
||
| # La mas sencilla e intuitiva | ||
| self.numero_filas=2 | ||
| numero_columnas=2 | ||
| matriz = [] | ||
| for i in range(numero_filas): | ||
| matriz.append([]) | ||
| for j in range(numero_columnas): | ||
| print("Ingrese elemento:") | ||
| matriz[i].append(input()) | ||
| print(matriz) | ||
|
|
||
| def insert_arreglo(self): | ||
| arr = [] | ||
| self.numero_filas = 2 | ||
| for i in range(self.numero_filas): | ||
| print("Ingrese elemento:") | ||
| arr.append(input()) | ||
| print(arr) | ||
| def learn1(self): | ||
| return learn_rate=0.1 | ||
| def learn2(self): | ||
| return learn_rate=0.01 | ||
| def learn3(self): | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seguramente en esta parte Pycharm te pinta un warning, ya que este método al no utilizar self pasa a ser una funcion cualquiera y no es necesario que este dentro de la clase. Revisar |
||
| return learn_rate=0.001 | ||
| def numbers_learn(self,argument): | ||
| switcher = { | ||
| 0: self.learn1, | ||
| 1: self.learn2, | ||
| 2: self.learn3, | ||
| } | ||
| return switcher.get(argument,lambda: "Invalid") | ||
|
|
||
| def signo(self,net): | ||
| fsigno = [1. if elem >=0 else -1. for elem in net] | ||
| return fsigno | ||
| def paso(self,net): | ||
| fpaso = [1. if elem >= 0 else 0. for elem in net] | ||
| return fpaso | ||
| def sigmoide(self,net): | ||
| fsigmoide=1/(1+np.exp(elem) for elem in net) | ||
| return fsigmoide | ||
| def tanhip(self,net): | ||
| ftanhip=((np.exp(elem)-np.exp(-elem))/(np.exp(elem)+np.exp(-elem)) for elem in net ) | ||
| return ftanhip | ||
|
|
||
| def funcion(self,argumento): | ||
| switcher = { | ||
| 1: self.signo(), | ||
| 2: self.paso(), | ||
| 3: self.sigmoide(), | ||
| 4: self.tanhip(), | ||
| } | ||
| # Get the function from switcher dictionary | ||
| return switcher.get(argumento, lambda: "Invalid") | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Las clases por convención se declaran con Mayúsculas, esto es Perceptron