Rede Neural Artifical Evolucionária
Project description
RNAE
Rede Neural Artificial Evolucionária
Instalation
$ pip install rnea
ou
$ python setup.py install
Utilização
from numpy.random import shuffle
from numpy import array
from pygenec import binarray2int
from rnae import RNAE
from rnae import IRIS as dados
from rnae import IRIS_NAME
#Normalização dos dados de entrada
entrada = dados[1:,0:-1].astype(float)
for k in range(entrada.shape[1]):
entrada[:, k] = ((entrada[:, k] - entrada[:, k].min()) /
(entrada[:, k].max() - entrada[:, k].min())
)
#Resultado esperado, em inteiro.
saidas = dados[1:,-1]
saidas = array([list(map(int, list("{0:2b}".format(int(s)).replace(" ", "0")))) for s in saidas])
itrain = array(list(range(saidas.shape[0])))
shuffle(itrain)
etrain = entrada[itrain,:]
esaid = saidas[itrain, :]
n = int(esaid.shape[0] * 0.90)
neurons = [4, 4, 2]
rna = RNAE(neurons)
rna.treinamento(etrain[0:n, :], esaid[0:n, :],
tpop=500, gens=1000, bits=16, pmut=0.1, pcruz=0.6, epidemia=150)
rna.salvar_modelo("./modelos/rnae_iris.txt")
rna = RNAE.carregar_modelo("./modelos/rnae_iris.txt")
pred = rna.propagacao(etrain[n:,:])
expct = esaid[n:]
expct = binarray2int(expct).reshape((expct.shape[0], 1))
pred = binarray2int(pred).reshape((expct.shape[0], 1))
print("\n")
print([IRIS_NAME[i] for i in pred.flatten().astype(int)])
print("\n")
print([IRIS_NAME[i] for i in expct.flatten().astype(int)])
print("\n")
accu = 100 * sum(pred == expct) / expct.size
print("Acuracia {} %".format(accu))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rnae-1.0.1.tar.gz
(4.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
rnae-1.0.1-py3-none-any.whl
(5.8 kB
view details)
File details
Details for the file rnae-1.0.1.tar.gz.
File metadata
- Download URL: rnae-1.0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
263bfca958c3fdb8d14205a102a8ec5f150c4d49931eceb18cd89df1093575c8
|
|
| MD5 |
bda9480abc1b248582719a868f51647c
|
|
| BLAKE2b-256 |
47d94a638dfb0170424162f4f868875f753ee8aab7aa93c2c7d1b402a10e85f2
|
File details
Details for the file rnae-1.0.1-py3-none-any.whl.
File metadata
- Download URL: rnae-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b97b15ce8ece339962d052363963a60497f1637cf2d61bc77e5d757f8bbcad7d
|
|
| MD5 |
10224489120f4fe49549f5a4895b53e5
|
|
| BLAKE2b-256 |
cb9378aa8503b606c3cf01f8411a67b9d665e2e36c7213e32d5e3dcf5047cb55
|