-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuncoesAtivacao.py
More file actions
34 lines (26 loc) · 873 Bytes
/
funcoesAtivacao.py
File metadata and controls
34 lines (26 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import numpy as np
def step(soma): # uso em problemas linearmente separaveis
if (soma >=1):
return 1
return 0
def sigmoid(soma): #problemas de logica binaria
return 1/(1+np.exp(-soma))
def tangenteHiperbolica(soma): # utilem classificação
return (np.exp(soma)-np.exp(-soma))/(np.exp(soma)+np.exp(-soma))
def relu(soma): # importante para redes neurai covolucionais
if(soma >=0):
return soma
return 0
def linear(soma): # importante para regresaão
return soma
def softmax(x): # importante para problemas de classificação com multiplas classes de dados
ex = np.exp(x)
return ex / ex.sum()
soma = 2.1
testeStep = step(soma)
testeSigmoid = sigmoid(soma)
testeHiperbolica = tangenteHiperbolica(soma)
testeRelu = relu(soma)
testeLinear = linear(soma)
valores = [1.0, 0.2, 5.3,]
print(softmax(valores ))