elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Curso de javascript por TickTack


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  (IA) Perceptron . . .
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: (IA) Perceptron . . .  (Leído 3,228 veces)
**Aincrad**


Desconectado Desconectado

Mensajes: 668



Ver Perfil WWW
(IA) Perceptron . . .
« en: 3 Octubre 2017, 21:27 pm »

hola a todos, abro este tema para al que le interese.  ;D

bueno empecemos.

que es un (AI)?

Inteligencia artificial, o AI. La inteligencia artificial (Artificial Intelligence, o AI) es la simulación de procesos de inteligencia humana por parte de máquinas, especialmente sistemas informáticos.

que es Perceptron?

El perceptrón multicapa es una red neuronal artificial (RNA) formada por múltiples capas, esto le permite resolver problemas que no son linealmente separables, lo cual es la principal limitación del perceptrón (también llamado perceptrón simple). El perceptrón multicapa puede ser totalmente o localmente conectado.

En pocas palabras el perceptron es la simulación de una neurona humana.



EN ESTE ESQUEMA DE PERCEPTOM SIMPLI SE PUEDE APRECIAR . QUE SE INCLUYE LA PARTE SENSORIAL.

con esta parte podemos apreciar que el desarrollo de una IA nunca estara completa si no tiene como sentir.  ya que muchos Psicólogos  han demostrado que por medio de las experiencias sensiorales el cerebro aprende.

ejemplo de perceptron :  

bach

Código
  1. @echo off
  2. rem Perceptron en batch
  3. rem por S4L
  4. rem 14/04/12
  5. color a
  6. setlocal EnableDelayedExpansion
  7. setlocal EnableExtensions
  8. set me=%0
  9. cscript.exe //H:cscript
  10. :::::::::::::::::::::::::::::::::::
  11. set Fgh=fghijklmnopqrstuvwxz
  12. set T=0.5
  13. set Alpha=0.1
  14. set iNn=3
  15. set oNut=1
  16. set TSName="NAND Gate"
  17. set TxSet=4
  18. set TySet=4
  19. set TSet.1=1,0,0,1
  20. set TSet.2=1,0,1,1
  21. set TSet.3=1,1,0,1
  22. set TSet.4=1,1,1,0
  23. set WxSet=1
  24. set WySet=3
  25. set WSet.1=0
  26. set WSet.2=0
  27. set WSet.3=0
  28. :::::::::::::::::::::::::::::::::::
  29.  
  30. echo Randomize>eval.vbs
  31. echo set objArgs = WScript.Arguments>>eval.vbs
  32. echo wscript.echo eval(objArgs(0))>>eval.vbs
  33. set Run=True
  34. rem for /l %%a in (1,1,%WySet%) do (
  35. rem call:SetEv WSet.%%a Rnd
  36. rem )
  37. set /a Tf=2+%iNn%+%oNut%
  38. set vfIn=%%%%g
  39. for /l %%a in (2,1,%iNn%) do (
  40. set vfIn=!vfIn!,%%%%!Fgh:~%%a,1!
  41. )
  42. set /a vfOut_ini=1+%iNn%
  43. set /a fOut=%vfOut_ini%-%oNut%
  44. set vfOut=%%%%!Fgh:~%vfOut_ini%,1!
  45. for /l %%a in (%vfOut_ini%,1,%fOut%) do (
  46. set vfOut=!vfout!,%%%%!Fgh:~%%a,1!
  47. )
  48. set str=Fo
  49. find "%str%r1"<%me%>stFor.bat
  50. echo set In.%%%%f=%vfIn%>>stFor.bat
  51. echo set Out.%%%%f=%vfOut%>>stFor.bat
  52. echo ^)>>stFor.bat
  53. call stFor
  54. echo --Training Started--
  55. :train
  56. set Run=False
  57. for /l %%a in (1,1,%TySet%) do (
  58. echo.
  59. (set/p av=Training.)<nul
  60. call:pre_Sum %%a
  61. call:UpdateW %%a
  62. )
  63. if %Run%==True goto:train
  64. :test
  65. echo.
  66. echo --%TSName% network succesfully trained!--
  67. echo --Testing--
  68. for /l %%a in (1,1,%iNn%) do (
  69. set /p iNn%%a=Input %%a ^(1/0^)?
  70. )
  71. call:PSum
  72. echo Network output=%out%
  73. set /p cnt=Continue testing ^(y/n^)?
  74. if %cnt%'==y' goto:test
  75. if %cnt%'==Y' goto:test
  76. goto:eof
  77.  
  78. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  79.  
  80. :UpdateW
  81. set /a error=!Out.%1!-%out%
  82. if not %error%==0 set Run=True
  83. call:SetEv C %error%*%Alpha%
  84. (set/p av=.)<nul
  85. (set/p av="  E=%error% W1=%WSet.1% W2=%WSet.2% W3=%WSet.3%")<nul
  86. for /l %%b in (1,1,%WySet%) do (
  87. call:SetEv WSet.%%b !WSet.%%b!+!iNn%%b!*!C!
  88. )
  89. goto:eof
  90.  
  91. :pre_Sum
  92. set str2=I
  93. set In.>In.
  94. find "%str2%n.%1"<In.>aIn.
  95. find "%str%r2"<%me%>stFor_In.bat
  96. for /l %%a in (1,1,%iNn%) do (
  97. echo set iNn%%a=%%%%!Fgh:~%%a,1!>>stFor_In.bat
  98. (set/p av=.)<nul
  99. )
  100. (set/p av=.)<nul
  101. echo ^)>>stFor_In.bat
  102. call stFor_In
  103. call:PSum %1
  104. goto:eof
  105.  
  106. :PSum
  107. set sum=0
  108. for /l %%a in (1,1,%iNn%) do (
  109. call:SetEv sum !sum!+!iNn%%a!*!WSet.%%a!
  110. )
  111. if /I %sum% gtr %T% (
  112. set out=1
  113. ) else (
  114. set out=0
  115. )
  116. goto:eof
  117.  
  118. :SetEv
  119. for /f %%i in ('eval //nologo "%2"') do set %1=%%i
  120. goto:eof
  121.  
  122. for /f "tokens=2-%Tf% delims=.,=" %%f in ('set TSet.') do ( %For1%
  123. for /f "tokens=2-%Tf% delims=.,=" %%f in (aIn.) do ( %For2%

para los de c++ les dejo el link:

https://www.facebook.com/TutorialesKatana/?sk=app_190322544333196

http://www.mundoprogramacion.com/colabora/puntoNET/jlopezi_RedNeuronal.htm


  si se preguntan todavía que finalidad tiene este tema. ni yo mismo lo se . jajaja.

bueno abrí este tema para los que esten desarrollando alguna AI O los quieran desarrollar.
                        
  COMENTEN sus aporte sobre IA un este tema


« Última modificación: 4 Octubre 2017, 19:46 pm por **Aincrad** » En línea



<Trocutor>

Desconectado Desconectado

Mensajes: 72


Ver Perfil
Re: (IA) Perceptron . . .
« Respuesta #1 en: 3 Octubre 2017, 22:36 pm »

Estuve un tiempo informandome sobre estos temas y me interesan muchoo... ;)

Por aqui te dejo como aprendi yo en Python 3

https://www.exabyteinformatica.com/uoc/Inteligencia_artificial/Inteligencia_artificial_avanzada/Inteligencia_artificial_avanzada_(Modulo_1).pdf


En línea

**Aincrad**


Desconectado Desconectado

Mensajes: 668



Ver Perfil WWW
Re: (IA) Perceptron . . .
« Respuesta #2 en: 4 Octubre 2017, 13:16 pm »

Interesante . bueno en python encontre este chatbot . en idioma ingles. se supone que aprende las palabras mientras tu hablas con el .

code:

Código
  1. import re
  2. import sqlite3
  3. from collections import Counter
  4. from string import punctuation
  5. from math import sqrt
  6.  
  7. # initialize the connection to the database
  8. connection = sqlite3.connect('chatbot.sqlite')
  9. cursor = connection.cursor()
  10.  
  11. # create the tables needed by the program
  12. create_table_request_list = [
  13.    'CREATE TABLE words(word TEXT UNIQUE)',
  14.    'CREATE TABLE sentences(sentence TEXT UNIQUE, used INT NOT NULL DEFAULT 0)',
  15.    'CREATE TABLE associations (word_id INT NOT NULL, sentence_id INT NOT NULL, weight REAL NOT NULL)',
  16. ]
  17. for create_table_request in create_table_request_list:
  18.    try:
  19.        cursor.execute(create_table_request)
  20.    except:
  21.        pass
  22.  
  23. def get_id(entityName, text):
  24.    """Retrieve an entity's unique ID from the database, given its associated text.
  25.    If the row is not already present, it is inserted.
  26.    The entity can either be a sentence or a word."""
  27.    tableName = entityName + 's'
  28.    columnName = entityName
  29.    cursor.execute('SELECT rowid FROM ' + tableName + ' WHERE ' + columnName + ' = ?', (text,))
  30.    row = cursor.fetchone()
  31.    if row:
  32.        return row[0]
  33.    else:
  34.        cursor.execute('INSERT INTO ' + tableName + ' (' + columnName + ') VALUES (?)', (text,))
  35.        return cursor.lastrowid
  36.  
  37. def get_words(text):
  38.    """Retrieve the words present in a given string of text.
  39.    The return value is a list of tuples where the first member is a lowercase word,
  40.    and the second member the number of time it is present in the text."""
  41.    wordsRegexpString = '(?:\w+|[' + re.escape(punctuation) + ']+)'
  42.    wordsRegexp = re.compile(wordsRegexpString)
  43.    wordsList = wordsRegexp.findall(text.lower())
  44.    return Counter(wordsList).items()
  45.  
  46.  
  47. B = 'Hello!'
  48. while True:
  49.    # output bot's message
  50.    print('B: ' + B)
  51.    # ask for user input; if blank line, exit the loop
  52.    H = raw_input('H: ').strip()
  53.    if H == '':
  54.        break
  55.    # store the association between the bot's message words and the user's response
  56.    words = get_words(B)
  57.    words_length = sum([n * len(word) for word, n in words])
  58.    sentence_id = get_id('sentence', H)
  59.    for word, n in words:
  60.        word_id = get_id('word', word)
  61.        weight = sqrt(n / float(words_length))
  62.        cursor.execute('INSERT INTO associations VALUES (?, ?, ?)', (word_id, sentence_id, weight))
  63.    connection.commit()
  64.    # retrieve the most likely answer from the database
  65.    cursor.execute('CREATE TEMPORARY TABLE results(sentence_id INT, sentence TEXT, weight REAL)')
  66.    words = get_words(H)
  67.    words_length = sum([n * len(word) for word, n in words])
  68.    for word, n in words:
  69.        weight = sqrt(n / float(words_length))
  70.        cursor.execute('INSERT INTO results SELECT associations.sentence_id, sentences.sentence, ?*associations.weight/(4+sentences.used) FROM words INNER JOIN associations ON associations.word_id=words.rowid INNER JOIN sentences ON sentences.rowid=associations.sentence_id WHERE words.word=?', (weight, word,))
  71.    # if matches were found, give the best one
  72.    cursor.execute('SELECT sentence_id, sentence, SUM(weight) AS sum_weight FROM results GROUP BY sentence_id ORDER BY sum_weight DESC LIMIT 1')
  73.    row = cursor.fetchone()
  74.    cursor.execute('DROP TABLE results')
  75.    # otherwise, just randomly pick one of the least used sentences
  76.    if row is None:
  77.        cursor.execute('SELECT rowid, sentence FROM sentences WHERE used = (SELECT MIN(used) FROM sentences) ORDER BY RANDOM() LIMIT 1')
  78.        row = cursor.fetchone()
  79.    # tell the database the sentence has been used once more, and prepare the sentence
  80.    B = row[1]
  81.    cursor.execute('UPDATE sentences SET used=used+1 WHERE rowid=?', (row[0],))
En línea



bajo0123

Desconectado Desconectado

Mensajes: 16


en aprendizaje


Ver Perfil
Re: (IA) Perceptron . . .
« Respuesta #3 en: 18 Abril 2018, 09:40 am »

Realmente aprende el bot ?
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Necesito orientacion :: Perceptron simple (ANN - RNA). Desde cero. xD
Programación General
Hadess_inf 5 5,863 Último mensaje 31 Agosto 2010, 18:13 pm
por [D4N93R]
Perceptron simple
Programación General
morgane 3 3,308 Último mensaje 17 Septiembre 2012, 01:47 am
por [Case]
Perceptron Simple en C (Redes Neuronales)
Programación C/C++
Dext3rCode 2 8,934 Último mensaje 15 Diciembre 2015, 19:54 pm
por 0xFer
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines