SlideShare a Scribd company logo
1 of 44
Download to read offline
“Construir una App
con AI nunca fue tan fácil”
con frameworks y servicios que nos acercan la
potencia de la inteligencia artificial y el machine
learning
Rubén Chavarri Elduayen
Software Engineer en Kairos
@pekewake
David Chavarri Elduayen
Software Architect en BBVA
@dvdchavarri
MAD · NOV 24-25 · 2017
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Introduction to Artificial Intelligence
In the next years, fullstack will
not be full stack without
AI skills
‘‘
’’
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Type of
MachineLearning
algorithms
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Type of
MachineLearning
algorithms
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Type of
MachineLearning
algorithms
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Type of
MachineLearning
algorithms
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
● Neurons
● Activation Functions
● Cost Functions
● Gradient Descent and Backpropagation
How Machine Learning works
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
● Neurons in ML called Perceptrons
How Machine Learning works
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
● Neurons in ML called Perceptrons
How Machine Learning works
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
● Activation Functions: method which calculate the output
How Machine Learning works
ReLUTanhLinear Sigmoid
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
● Cost Functions: Method to evaluate the performance of
a neuron based on how far off we are for expected value.
○ Quadratic Cost
○ Cross Entropy
How Machine Learning works
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
● Gradient Descent: Optimization
algorithm to minimize cost function.
● Backpropagation: Calculates the error
contribution of each neuron
How Machine Learning works
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
http://playground.tensorflow.org
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
How MachineLearning can make our Apps smart?
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
How MachineLearning can make our Apps smart?
Pinterest
Spam moderation
Content discovery
Advertising monetization
Reducing churn of email
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
How MachineLearning can make our Apps smart?
Facebook
Chatbot Army
Filter out spam
Poor-quality content
Computer vision
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
How MachineLearning can make our Apps smart?
Twitter
Curated Timelines.
Real time and “scores”.
Decisions based on your
individual preferences.
Deep learning models.
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
How MachineLearning can make our Apps smart?
Spotify
Discovery Weekly
+ Collaborative Filtering
+ Natural Language Processing
+ Audio models
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
How MachineLearning can make our Apps smart?
Shazam
Fingerprint for recording
Generative models
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
How MachineLearning can make our Apps smart?
Google
DeepMind network,
the “machine that dreams”.
Natural language Processing.
Speech translation.
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Where to start?
ML as a services vs My Neuronal Network
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Best MLaaS? Source link
Amazon ML Google Cloud ML IBM Watson MS Azure
Overview Large automated platform that
applies ML algorithms to data
stored in AWS
State-of-the-art of Google algorithms
and other industry-leading apps.
Focused on production models
through REST API connectors
Long list of predefined algorithms but less
automated.
Interface Amazon ML Console
Amazon cmd line Interface
Google Cloud cmd line interface
integrated with TensorFlow
IBM graphical analysis
API connectors enable users to
build 3rd data science apps
Azure ML Studio drag-and-drop env.
R & Python packages
Algorithms Regression, Classification, multi
class classification
Video, Image & Text Analysis, Speech
recognitions, Translation
Links to Apache Spark’s MLib
IBM Data Science workbench
Scale boosted decision tree
Bayesian recommendation sys.
Multicass & binary classification
Regression clustering
Suggestions Yes Yes No No
Pricing $0.42/h Data analysis y model
$0,10 per thousand predictions
$0.49/h Model Training
$0.10 per thousand predictions
Free tier for 5k predictions & 5h
$0.45 computer hour
$0.50 per thousands predics
Limited free tier for devs
$0.99 user/month
$1.00 Studio experiment hour
Extras Data Storage extra fees Google account required IBM SPSS Modeler or Data
Science experience required.
Bluemix account required
Azure or Microsoft account required
Others Automatic data transf. tool Little abstraction. Steep learning curve Focus on Backend ML with API Visual interface, limited insight
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Machine Learning hands on - FiendlyChat
https://codelabs.developers.google.com/codelabs/firebase-cloud-functions/
Google Codelab
Cloud function & AI Moderation
+
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Machine Learning hands on - FiendlyChat diagram
Safe
Detection
Blur image
when violent
Write
Location
Push
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
https://cloud.google.com/vision/docs/drag-and-drop
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Show me the Code - ML Api Call
exports.blurOffensiveImages = functions.storage.object().onChange(event => {
const object = event.data;
const image = { source: {imageUri: `gs://${object.bucket}/${object.name}`} };
// Check the image content using the Cloud Vision API.
return vision.safeSearchDetection(image).then(batchAnnotateImagesResponse => {
const safeSearchResult = batchAnnotateImagesResponse[0].safeSearchAnnotation;
const Likelihood = Vision.types.Likelihood;
if (Likelihood[safeSearchResult.adult] >= Likelihood.LIKELY ||
Likelihood[safeSearchResult.violence] >= Likelihood.LIKELY) {
console.log('The image', object.name, 'has been detected as inappropriate.');
return blurImage(object.name, object.bucket);
} else {
console.log('The image', object.name,'has been detected as OK.');
}
});
});
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Machine Learning hands on - FiendlyChat Code
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Where to start?
ML as a services vs My Neuronal Network
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
(2015-2016)
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
My first neuronal network - TensorDraw
Repo: https://github.com/Twiinlab/codemotion2017 inspired by: https://quickdraw.withgoogle.com/
Main Tools
TensorFlow & App Engine
+
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Python data science libraries
Numpy: Numerical processing
Pandas: Data Analysis
MatPlotLib: Visualization
SciKit: Processing machine learning data sets
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
pre-processing training evaluate
load / split / images CNN network check accuracy
model
TensorFlow
Training
save
bucle
Data source: https://quickdraw.withgoogle.com/data
Show me the Code - Training
# Imports libraries
# layers configuration
...
# Optimizer
...
# Loss Function
...
# image helper
fileList = ['smile','car','pencil','burger','moon','hand','tornado','scissors','mug','sock']
class SketchImageHelper():
# init training images
def set_up_images(self):
sampleSize = self.pos_end - self.pos_begin
for i in range(len(self.fileList)):
partialImages = np.array(np.load(fileList[i])[self.pos_begin:self.pos_end])
self.images.append( partialImages / 255)
self.labels.append(np.full((sampleSize,10), one_hot_encode(i)))
def next_batch(self, batch_size):
for i in range(len(self.fileList)):
x = np.array((self.images[i])[self.position:self.position+batch_size])
y = np.array((self.labels[i])[self.position:self.position+batch_size])
self.position = (self.position + batch_size)
return x, y
Show me the Code - Training
...
# init test images
sih = SketchImageHelper()
sih.set_up_images()
saver = tf.train.Saver()
with tf.Session() as sess:
steps = 3000
sess.run(init)
for j in range(steps):
batch_x , batch_y = sih.next_batch(100)
sess.run(train,feed_dict={x:batch_x,y_true:batch_y,hold_prob:0.5})
if j%50 == 0:
# Validate the Train Model
matches = tf.equal(tf.argmax(y_pred,1),tf.argmax(y_true,1))
acc = tf.reduce_mean(tf.cast(matches,tf.float32))
print(sess.run(acc,feed_dict={x:test_x,y_true:test_y,hold_prob:1.0}))
saver.save(sess, savefile)
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Show me the Code - Network configuration
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
pre-processing
/prediction
restore
model
TensorFlow
Prediction
result : [ prob1,
prob2,
…
prob10]
APP
ENGINE
prediction
grey scale
resize image
Show me the Code - Prediction
sess = tf.InteractiveSession()
sess.run(tf.global_variables_initializer())
saver = tf.train.Saver()
saver.restore(sess, "./STORED_model/my_trained_model.json")
def readGrayImageFromData(data):
imageToPredict = rgba2rgb(data)
return rgb2grey(imageToPredict)
def simplifyImage(originalImage):
partialResizeImage = tform.resize(originalImage, (28, 28), order=5)
return (1 - np.reshape(partialResizeImage,newshape=(1,784)))
def predictFromDataImage(data):
imageData = readGrayImageFromData(data)
imageSimple = simplifyImage(imageData)
feed_dict = {x: imageSimple, y_true: np.zeros((1, 10)), hold_prob : 0.5 }
return sess.run(tf.nn.softmax(y_pred), feed_dict)
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
try here: https://tensorweb-af554.firebaseapp.com/
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
The Future of MachineLearning
What’s next in machine learning trends?
Machines That Learn More Effectively
Automation of Cyberattack Countermeasures
Convincing Generative Models
Better Machine Learning Training
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Thanks!
Any question?
Rubén Chavarri Elduayen
@pekewake
David Chavarri elduayen
@dvdchavarri
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
Special Thanks to
Jorge del Val Juantomas García Gema Parreño Codemotion
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
The Future of MachineLearning
What’s next in machine learning trends?
Machines That Learn More Effectively
Automation of Cyberattack Countermeasures
Convincing Generative Models
Better Machine Learning Training
Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
RESOURCES:
Código fuente:
Demo: ML as a service
https://codelabs.developers.google.com/codelabs/firebase-web/
Demo: my neuronal network
https://github.com/Twiinlab/codemotion2017
Recomended course:
https://www.tensorflow.org/tutorials/
https://www.udemy.com/complete-guide-to-tensorflow-for-deep-learning-with-python/
AI - ML - DeepLearning
https://www.datascience.com/blog/machine-learning-and-deep-learning-what-is-the-difference
https://blogs.nvidia.com/blog/2016/07/29/whats-difference-artificial-intelligence-machine-learning-deep-learning-ai/
Real apps
http://www.wordstream.com/blog/ws/2017/07/28/machine-learning-applications
https://blog.twitter.com/engineering/en_us/topics/insights/2017/using-deep-learning-at-scale-in-twitters-timelines.html
https://hackernoon.com/spotifys-discover-weekly-how-machine-learning-finds-your-new-music-19a41ab76efe
https://www.toptal.com/algorithms/shazam-reconocimiento-de-algoritmos-de-m%C3%BAsica-huellas-dactilares-y-procesamiento/es
Machine Learning framework comparison
https://blog.paperspace.com/which-ml-framework-should-i-use/
https://project.inria.fr/deeplearning/files/2016/05/DLFrameworks.pdf

More Related Content

Similar to Construir una App con AI nunca fue tan fácil

Azure | Digital Transformation with Azure Overview - 16/11/2017
Azure | Digital Transformation with Azure Overview - 16/11/2017Azure | Digital Transformation with Azure Overview - 16/11/2017
Azure | Digital Transformation with Azure Overview - 16/11/2017Pablo Ariel Di Loreto
 
Responsive Web Design, ventaja, inconvenientes y recomendaciones
Responsive Web Design, ventaja, inconvenientes y recomendacionesResponsive Web Design, ventaja, inconvenientes y recomendaciones
Responsive Web Design, ventaja, inconvenientes y recomendacionesXavi Cardet
 
Herramientas y recurrsos digitales
Herramientas y recurrsos digitalesHerramientas y recurrsos digitales
Herramientas y recurrsos digitalesNadiaRenataSnchezVil
 
QCObjects 2021 Cloud Computing - Evento Cloud Rocket Summit
QCObjects 2021 Cloud Computing - Evento Cloud Rocket SummitQCObjects 2021 Cloud Computing - Evento Cloud Rocket Summit
QCObjects 2021 Cloud Computing - Evento Cloud Rocket SummitJean Machuca
 
Integrando Machine Learning y Microservicios
Integrando Machine Learning y MicroserviciosIntegrando Machine Learning y Microservicios
Integrando Machine Learning y MicroserviciosRafa Hidalgo
 
Frameworks y herramientas de desarrollo ágil para emprendedores y startups
Frameworks y herramientas de desarrollo ágil para emprendedores y startupsFrameworks y herramientas de desarrollo ágil para emprendedores y startups
Frameworks y herramientas de desarrollo ágil para emprendedores y startupsMario Jose Villamizar Cano
 
OpenSouthCode 2018: Taller Xamarin
OpenSouthCode 2018: Taller XamarinOpenSouthCode 2018: Taller Xamarin
OpenSouthCode 2018: Taller XamarinJavier Suárez Ruiz
 
Android camp 2017 google cloud platform + firebase + android
Android camp 2017   google cloud platform + firebase + androidAndroid camp 2017   google cloud platform + firebase + android
Android camp 2017 google cloud platform + firebase + androidSergio Antonio Ochoa Martinez
 
Usando azure para escalar tu producto
Usando azure para escalar tu productoUsando azure para escalar tu producto
Usando azure para escalar tu productoMauro Parra-Miranda
 
Planificando el Camino azure migracion
Planificando el Camino azure migracionPlanificando el Camino azure migracion
Planificando el Camino azure migracionIvan Martinez
 
Arquitectura xamarin - Nuestra primera app
Arquitectura xamarin - Nuestra primera appArquitectura xamarin - Nuestra primera app
Arquitectura xamarin - Nuestra primera appBorja García Cueto
 
Recursos digitales lorna yanez 3 b2
Recursos digitales lorna yanez 3 b2Recursos digitales lorna yanez 3 b2
Recursos digitales lorna yanez 3 b2loyanez
 

Similar to Construir una App con AI nunca fue tan fácil (20)

Azure | Digital Transformation with Azure Overview - 16/11/2017
Azure | Digital Transformation with Azure Overview - 16/11/2017Azure | Digital Transformation with Azure Overview - 16/11/2017
Azure | Digital Transformation with Azure Overview - 16/11/2017
 
Carolina
CarolinaCarolina
Carolina
 
Responsive Web Design, ventaja, inconvenientes y recomendaciones
Responsive Web Design, ventaja, inconvenientes y recomendacionesResponsive Web Design, ventaja, inconvenientes y recomendaciones
Responsive Web Design, ventaja, inconvenientes y recomendaciones
 
Herramientas y recurrsos digitales
Herramientas y recurrsos digitalesHerramientas y recurrsos digitales
Herramientas y recurrsos digitales
 
LAS APPS
LAS APPSLAS APPS
LAS APPS
 
De la A a la Z: ¿Cómo idear una app?
De la A a la Z: ¿Cómo idear una app?De la A a la Z: ¿Cómo idear una app?
De la A a la Z: ¿Cómo idear una app?
 
QCObjects 2021 Cloud Computing - Evento Cloud Rocket Summit
QCObjects 2021 Cloud Computing - Evento Cloud Rocket SummitQCObjects 2021 Cloud Computing - Evento Cloud Rocket Summit
QCObjects 2021 Cloud Computing - Evento Cloud Rocket Summit
 
Integrando Machine Learning y Microservicios
Integrando Machine Learning y MicroserviciosIntegrando Machine Learning y Microservicios
Integrando Machine Learning y Microservicios
 
Frameworks y herramientas de desarrollo ágil para emprendedores y startups
Frameworks y herramientas de desarrollo ágil para emprendedores y startupsFrameworks y herramientas de desarrollo ágil para emprendedores y startups
Frameworks y herramientas de desarrollo ágil para emprendedores y startups
 
MBaaS - Parse
MBaaS - ParseMBaaS - Parse
MBaaS - Parse
 
Google
GoogleGoogle
Google
 
Google sites colombia
Google sites colombiaGoogle sites colombia
Google sites colombia
 
Tarea 2 xd
Tarea 2 xdTarea 2 xd
Tarea 2 xd
 
Herramientas de diseño UI
Herramientas de diseño UIHerramientas de diseño UI
Herramientas de diseño UI
 
OpenSouthCode 2018: Taller Xamarin
OpenSouthCode 2018: Taller XamarinOpenSouthCode 2018: Taller Xamarin
OpenSouthCode 2018: Taller Xamarin
 
Android camp 2017 google cloud platform + firebase + android
Android camp 2017   google cloud platform + firebase + androidAndroid camp 2017   google cloud platform + firebase + android
Android camp 2017 google cloud platform + firebase + android
 
Usando azure para escalar tu producto
Usando azure para escalar tu productoUsando azure para escalar tu producto
Usando azure para escalar tu producto
 
Planificando el Camino azure migracion
Planificando el Camino azure migracionPlanificando el Camino azure migracion
Planificando el Camino azure migracion
 
Arquitectura xamarin - Nuestra primera app
Arquitectura xamarin - Nuestra primera appArquitectura xamarin - Nuestra primera app
Arquitectura xamarin - Nuestra primera app
 
Recursos digitales lorna yanez 3 b2
Recursos digitales lorna yanez 3 b2Recursos digitales lorna yanez 3 b2
Recursos digitales lorna yanez 3 b2
 

More from Ruben Chavarri

Block chain lets kill the hype
Block chain lets kill the hypeBlock chain lets kill the hype
Block chain lets kill the hypeRuben Chavarri
 
T3chCoin: dando forma al mundo a base de tokens
T3chCoin: dando forma al mundo a base de tokensT3chCoin: dando forma al mundo a base de tokens
T3chCoin: dando forma al mundo a base de tokensRuben Chavarri
 
BitCoin, BlockChain, más criaturas fantásticas, y donde utilizarlas
BitCoin, BlockChain, más criaturas fantásticas, y donde utilizarlasBitCoin, BlockChain, más criaturas fantásticas, y donde utilizarlas
BitCoin, BlockChain, más criaturas fantásticas, y donde utilizarlasRuben Chavarri
 
Angular2 + New Firebase in Action
Angular2 + New Firebase in ActionAngular2 + New Firebase in Action
Angular2 + New Firebase in ActionRuben Chavarri
 
The cognitive side of IoT (TechSummit 2016)
The cognitive side of IoT (TechSummit 2016)The cognitive side of IoT (TechSummit 2016)
The cognitive side of IoT (TechSummit 2016)Ruben Chavarri
 
Introduccion WebComponents y Visual Studio
Introduccion WebComponents y Visual StudioIntroduccion WebComponents y Visual Studio
Introduccion WebComponents y Visual StudioRuben Chavarri
 
PartyRocking: Jugando con Javascript y Websockets
PartyRocking: Jugando con Javascript y WebsocketsPartyRocking: Jugando con Javascript y Websockets
PartyRocking: Jugando con Javascript y WebsocketsRuben Chavarri
 

More from Ruben Chavarri (7)

Block chain lets kill the hype
Block chain lets kill the hypeBlock chain lets kill the hype
Block chain lets kill the hype
 
T3chCoin: dando forma al mundo a base de tokens
T3chCoin: dando forma al mundo a base de tokensT3chCoin: dando forma al mundo a base de tokens
T3chCoin: dando forma al mundo a base de tokens
 
BitCoin, BlockChain, más criaturas fantásticas, y donde utilizarlas
BitCoin, BlockChain, más criaturas fantásticas, y donde utilizarlasBitCoin, BlockChain, más criaturas fantásticas, y donde utilizarlas
BitCoin, BlockChain, más criaturas fantásticas, y donde utilizarlas
 
Angular2 + New Firebase in Action
Angular2 + New Firebase in ActionAngular2 + New Firebase in Action
Angular2 + New Firebase in Action
 
The cognitive side of IoT (TechSummit 2016)
The cognitive side of IoT (TechSummit 2016)The cognitive side of IoT (TechSummit 2016)
The cognitive side of IoT (TechSummit 2016)
 
Introduccion WebComponents y Visual Studio
Introduccion WebComponents y Visual StudioIntroduccion WebComponents y Visual Studio
Introduccion WebComponents y Visual Studio
 
PartyRocking: Jugando con Javascript y Websockets
PartyRocking: Jugando con Javascript y WebsocketsPartyRocking: Jugando con Javascript y Websockets
PartyRocking: Jugando con Javascript y Websockets
 

Recently uploaded

ÉTICA, NATURALEZA Y SOCIEDADES_3RO_3ER TRIMESTRE.pdf
ÉTICA, NATURALEZA Y SOCIEDADES_3RO_3ER TRIMESTRE.pdfÉTICA, NATURALEZA Y SOCIEDADES_3RO_3ER TRIMESTRE.pdf
ÉTICA, NATURALEZA Y SOCIEDADES_3RO_3ER TRIMESTRE.pdfluisantoniocruzcorte1
 
La evolucion de la especie humana-primero de secundaria
La evolucion de la especie humana-primero de secundariaLa evolucion de la especie humana-primero de secundaria
La evolucion de la especie humana-primero de secundariamarco carlos cuyo
 
PLANIFICACION ANUAL 2024 - INICIAL UNIDOCENTE.docx
PLANIFICACION ANUAL 2024 - INICIAL UNIDOCENTE.docxPLANIFICACION ANUAL 2024 - INICIAL UNIDOCENTE.docx
PLANIFICACION ANUAL 2024 - INICIAL UNIDOCENTE.docxJUANSIMONPACHIN
 
Fisiologia.Articular. 3 Kapandji.6a.Ed.pdf
Fisiologia.Articular. 3 Kapandji.6a.Ed.pdfFisiologia.Articular. 3 Kapandji.6a.Ed.pdf
Fisiologia.Articular. 3 Kapandji.6a.Ed.pdfcoloncopias5
 
Estrategia de Enseñanza y Aprendizaje.pdf
Estrategia de Enseñanza y Aprendizaje.pdfEstrategia de Enseñanza y Aprendizaje.pdf
Estrategia de Enseñanza y Aprendizaje.pdfromanmillans
 
DECÁGOLO DEL GENERAL ELOY ALFARO DELGADO
DECÁGOLO DEL GENERAL ELOY ALFARO DELGADODECÁGOLO DEL GENERAL ELOY ALFARO DELGADO
DECÁGOLO DEL GENERAL ELOY ALFARO DELGADOJosé Luis Palma
 
c3.hu3.p1.p3.El ser humano como ser histórico.pptx
c3.hu3.p1.p3.El ser humano como ser histórico.pptxc3.hu3.p1.p3.El ser humano como ser histórico.pptx
c3.hu3.p1.p3.El ser humano como ser histórico.pptxMartín Ramírez
 
Fundamentos y Principios de Psicopedagogía..pdf
Fundamentos y Principios de Psicopedagogía..pdfFundamentos y Principios de Psicopedagogía..pdf
Fundamentos y Principios de Psicopedagogía..pdfsamyarrocha1
 
TUTORIA II - CIRCULO DORADO UNIVERSIDAD CESAR VALLEJO
TUTORIA II - CIRCULO DORADO UNIVERSIDAD CESAR VALLEJOTUTORIA II - CIRCULO DORADO UNIVERSIDAD CESAR VALLEJO
TUTORIA II - CIRCULO DORADO UNIVERSIDAD CESAR VALLEJOweislaco
 
TEST DE RAVEN es un test conocido para la personalidad.pdf
TEST DE RAVEN es un test conocido para la personalidad.pdfTEST DE RAVEN es un test conocido para la personalidad.pdf
TEST DE RAVEN es un test conocido para la personalidad.pdfDannyTola1
 
BIOLOGIA_banco de preguntas_editorial icfes examen de estado .pdf
BIOLOGIA_banco de preguntas_editorial icfes examen de estado .pdfBIOLOGIA_banco de preguntas_editorial icfes examen de estado .pdf
BIOLOGIA_banco de preguntas_editorial icfes examen de estado .pdfCESARMALAGA4
 
Plan Año Escolar Año Escolar 2023-2024. MPPE
Plan Año Escolar Año Escolar 2023-2024. MPPEPlan Año Escolar Año Escolar 2023-2024. MPPE
Plan Año Escolar Año Escolar 2023-2024. MPPELaura Chacón
 
Mapa Mental de estrategias de articulación de las areas curriculares.pdf
Mapa Mental de estrategias de articulación de las areas curriculares.pdfMapa Mental de estrategias de articulación de las areas curriculares.pdf
Mapa Mental de estrategias de articulación de las areas curriculares.pdfvictorbeltuce
 
Estas son las escuelas y colegios que tendrán modalidad no presencial este lu...
Estas son las escuelas y colegios que tendrán modalidad no presencial este lu...Estas son las escuelas y colegios que tendrán modalidad no presencial este lu...
Estas son las escuelas y colegios que tendrán modalidad no presencial este lu...fcastellanos3
 
SISTEMA INMUNE FISIOLOGIA MEDICA UNSL 2024
SISTEMA INMUNE FISIOLOGIA MEDICA UNSL 2024SISTEMA INMUNE FISIOLOGIA MEDICA UNSL 2024
SISTEMA INMUNE FISIOLOGIA MEDICA UNSL 2024gharce
 
Los Nueve Principios del Desempeño de la Sostenibilidad
Los Nueve Principios del Desempeño de la SostenibilidadLos Nueve Principios del Desempeño de la Sostenibilidad
Los Nueve Principios del Desempeño de la SostenibilidadJonathanCovena1
 
LINEAMIENTOS INICIO DEL AÑO LECTIVO 2024-2025.pptx
LINEAMIENTOS INICIO DEL AÑO LECTIVO 2024-2025.pptxLINEAMIENTOS INICIO DEL AÑO LECTIVO 2024-2025.pptx
LINEAMIENTOS INICIO DEL AÑO LECTIVO 2024-2025.pptxdanalikcruz2000
 
5° SEM29 CRONOGRAMA PLANEACIÓN DOCENTE DARUKEL 23-24.pdf
5° SEM29 CRONOGRAMA PLANEACIÓN DOCENTE DARUKEL 23-24.pdf5° SEM29 CRONOGRAMA PLANEACIÓN DOCENTE DARUKEL 23-24.pdf
5° SEM29 CRONOGRAMA PLANEACIÓN DOCENTE DARUKEL 23-24.pdfOswaldoGonzalezCruz
 

Recently uploaded (20)

ÉTICA, NATURALEZA Y SOCIEDADES_3RO_3ER TRIMESTRE.pdf
ÉTICA, NATURALEZA Y SOCIEDADES_3RO_3ER TRIMESTRE.pdfÉTICA, NATURALEZA Y SOCIEDADES_3RO_3ER TRIMESTRE.pdf
ÉTICA, NATURALEZA Y SOCIEDADES_3RO_3ER TRIMESTRE.pdf
 
La evolucion de la especie humana-primero de secundaria
La evolucion de la especie humana-primero de secundariaLa evolucion de la especie humana-primero de secundaria
La evolucion de la especie humana-primero de secundaria
 
Earth Day Everyday 2024 54th anniversary
Earth Day Everyday 2024 54th anniversaryEarth Day Everyday 2024 54th anniversary
Earth Day Everyday 2024 54th anniversary
 
PLANIFICACION ANUAL 2024 - INICIAL UNIDOCENTE.docx
PLANIFICACION ANUAL 2024 - INICIAL UNIDOCENTE.docxPLANIFICACION ANUAL 2024 - INICIAL UNIDOCENTE.docx
PLANIFICACION ANUAL 2024 - INICIAL UNIDOCENTE.docx
 
Fisiologia.Articular. 3 Kapandji.6a.Ed.pdf
Fisiologia.Articular. 3 Kapandji.6a.Ed.pdfFisiologia.Articular. 3 Kapandji.6a.Ed.pdf
Fisiologia.Articular. 3 Kapandji.6a.Ed.pdf
 
Estrategia de Enseñanza y Aprendizaje.pdf
Estrategia de Enseñanza y Aprendizaje.pdfEstrategia de Enseñanza y Aprendizaje.pdf
Estrategia de Enseñanza y Aprendizaje.pdf
 
DECÁGOLO DEL GENERAL ELOY ALFARO DELGADO
DECÁGOLO DEL GENERAL ELOY ALFARO DELGADODECÁGOLO DEL GENERAL ELOY ALFARO DELGADO
DECÁGOLO DEL GENERAL ELOY ALFARO DELGADO
 
c3.hu3.p1.p3.El ser humano como ser histórico.pptx
c3.hu3.p1.p3.El ser humano como ser histórico.pptxc3.hu3.p1.p3.El ser humano como ser histórico.pptx
c3.hu3.p1.p3.El ser humano como ser histórico.pptx
 
Fundamentos y Principios de Psicopedagogía..pdf
Fundamentos y Principios de Psicopedagogía..pdfFundamentos y Principios de Psicopedagogía..pdf
Fundamentos y Principios de Psicopedagogía..pdf
 
TUTORIA II - CIRCULO DORADO UNIVERSIDAD CESAR VALLEJO
TUTORIA II - CIRCULO DORADO UNIVERSIDAD CESAR VALLEJOTUTORIA II - CIRCULO DORADO UNIVERSIDAD CESAR VALLEJO
TUTORIA II - CIRCULO DORADO UNIVERSIDAD CESAR VALLEJO
 
TEST DE RAVEN es un test conocido para la personalidad.pdf
TEST DE RAVEN es un test conocido para la personalidad.pdfTEST DE RAVEN es un test conocido para la personalidad.pdf
TEST DE RAVEN es un test conocido para la personalidad.pdf
 
BIOLOGIA_banco de preguntas_editorial icfes examen de estado .pdf
BIOLOGIA_banco de preguntas_editorial icfes examen de estado .pdfBIOLOGIA_banco de preguntas_editorial icfes examen de estado .pdf
BIOLOGIA_banco de preguntas_editorial icfes examen de estado .pdf
 
Plan Año Escolar Año Escolar 2023-2024. MPPE
Plan Año Escolar Año Escolar 2023-2024. MPPEPlan Año Escolar Año Escolar 2023-2024. MPPE
Plan Año Escolar Año Escolar 2023-2024. MPPE
 
Mapa Mental de estrategias de articulación de las areas curriculares.pdf
Mapa Mental de estrategias de articulación de las areas curriculares.pdfMapa Mental de estrategias de articulación de las areas curriculares.pdf
Mapa Mental de estrategias de articulación de las areas curriculares.pdf
 
Unidad 3 | Teorías de la Comunicación | MCDI
Unidad 3 | Teorías de la Comunicación | MCDIUnidad 3 | Teorías de la Comunicación | MCDI
Unidad 3 | Teorías de la Comunicación | MCDI
 
Estas son las escuelas y colegios que tendrán modalidad no presencial este lu...
Estas son las escuelas y colegios que tendrán modalidad no presencial este lu...Estas son las escuelas y colegios que tendrán modalidad no presencial este lu...
Estas son las escuelas y colegios que tendrán modalidad no presencial este lu...
 
SISTEMA INMUNE FISIOLOGIA MEDICA UNSL 2024
SISTEMA INMUNE FISIOLOGIA MEDICA UNSL 2024SISTEMA INMUNE FISIOLOGIA MEDICA UNSL 2024
SISTEMA INMUNE FISIOLOGIA MEDICA UNSL 2024
 
Los Nueve Principios del Desempeño de la Sostenibilidad
Los Nueve Principios del Desempeño de la SostenibilidadLos Nueve Principios del Desempeño de la Sostenibilidad
Los Nueve Principios del Desempeño de la Sostenibilidad
 
LINEAMIENTOS INICIO DEL AÑO LECTIVO 2024-2025.pptx
LINEAMIENTOS INICIO DEL AÑO LECTIVO 2024-2025.pptxLINEAMIENTOS INICIO DEL AÑO LECTIVO 2024-2025.pptx
LINEAMIENTOS INICIO DEL AÑO LECTIVO 2024-2025.pptx
 
5° SEM29 CRONOGRAMA PLANEACIÓN DOCENTE DARUKEL 23-24.pdf
5° SEM29 CRONOGRAMA PLANEACIÓN DOCENTE DARUKEL 23-24.pdf5° SEM29 CRONOGRAMA PLANEACIÓN DOCENTE DARUKEL 23-24.pdf
5° SEM29 CRONOGRAMA PLANEACIÓN DOCENTE DARUKEL 23-24.pdf
 

Construir una App con AI nunca fue tan fácil

  • 1. “Construir una App con AI nunca fue tan fácil” con frameworks y servicios que nos acercan la potencia de la inteligencia artificial y el machine learning Rubén Chavarri Elduayen Software Engineer en Kairos @pekewake David Chavarri Elduayen Software Architect en BBVA @dvdchavarri MAD · NOV 24-25 · 2017
  • 2. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Introduction to Artificial Intelligence In the next years, fullstack will not be full stack without AI skills ‘‘ ’’
  • 3. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri
  • 4. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Type of MachineLearning algorithms
  • 5. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Type of MachineLearning algorithms
  • 6. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Type of MachineLearning algorithms
  • 7. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Type of MachineLearning algorithms
  • 8. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri ● Neurons ● Activation Functions ● Cost Functions ● Gradient Descent and Backpropagation How Machine Learning works
  • 9. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri ● Neurons in ML called Perceptrons How Machine Learning works
  • 10. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri ● Neurons in ML called Perceptrons How Machine Learning works
  • 11. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri ● Activation Functions: method which calculate the output How Machine Learning works ReLUTanhLinear Sigmoid
  • 12. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri ● Cost Functions: Method to evaluate the performance of a neuron based on how far off we are for expected value. ○ Quadratic Cost ○ Cross Entropy How Machine Learning works
  • 13. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri ● Gradient Descent: Optimization algorithm to minimize cost function. ● Backpropagation: Calculates the error contribution of each neuron How Machine Learning works
  • 14. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri http://playground.tensorflow.org
  • 15. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri How MachineLearning can make our Apps smart?
  • 16. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri How MachineLearning can make our Apps smart? Pinterest Spam moderation Content discovery Advertising monetization Reducing churn of email
  • 17. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri How MachineLearning can make our Apps smart? Facebook Chatbot Army Filter out spam Poor-quality content Computer vision
  • 18. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri How MachineLearning can make our Apps smart? Twitter Curated Timelines. Real time and “scores”. Decisions based on your individual preferences. Deep learning models.
  • 19. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri How MachineLearning can make our Apps smart? Spotify Discovery Weekly + Collaborative Filtering + Natural Language Processing + Audio models
  • 20. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri How MachineLearning can make our Apps smart? Shazam Fingerprint for recording Generative models
  • 21. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri How MachineLearning can make our Apps smart? Google DeepMind network, the “machine that dreams”. Natural language Processing. Speech translation.
  • 22. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Where to start? ML as a services vs My Neuronal Network
  • 23. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Best MLaaS? Source link Amazon ML Google Cloud ML IBM Watson MS Azure Overview Large automated platform that applies ML algorithms to data stored in AWS State-of-the-art of Google algorithms and other industry-leading apps. Focused on production models through REST API connectors Long list of predefined algorithms but less automated. Interface Amazon ML Console Amazon cmd line Interface Google Cloud cmd line interface integrated with TensorFlow IBM graphical analysis API connectors enable users to build 3rd data science apps Azure ML Studio drag-and-drop env. R & Python packages Algorithms Regression, Classification, multi class classification Video, Image & Text Analysis, Speech recognitions, Translation Links to Apache Spark’s MLib IBM Data Science workbench Scale boosted decision tree Bayesian recommendation sys. Multicass & binary classification Regression clustering Suggestions Yes Yes No No Pricing $0.42/h Data analysis y model $0,10 per thousand predictions $0.49/h Model Training $0.10 per thousand predictions Free tier for 5k predictions & 5h $0.45 computer hour $0.50 per thousands predics Limited free tier for devs $0.99 user/month $1.00 Studio experiment hour Extras Data Storage extra fees Google account required IBM SPSS Modeler or Data Science experience required. Bluemix account required Azure or Microsoft account required Others Automatic data transf. tool Little abstraction. Steep learning curve Focus on Backend ML with API Visual interface, limited insight
  • 24. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Machine Learning hands on - FiendlyChat https://codelabs.developers.google.com/codelabs/firebase-cloud-functions/ Google Codelab Cloud function & AI Moderation +
  • 25. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Machine Learning hands on - FiendlyChat diagram Safe Detection Blur image when violent Write Location Push
  • 26. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri https://cloud.google.com/vision/docs/drag-and-drop
  • 27. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Show me the Code - ML Api Call exports.blurOffensiveImages = functions.storage.object().onChange(event => { const object = event.data; const image = { source: {imageUri: `gs://${object.bucket}/${object.name}`} }; // Check the image content using the Cloud Vision API. return vision.safeSearchDetection(image).then(batchAnnotateImagesResponse => { const safeSearchResult = batchAnnotateImagesResponse[0].safeSearchAnnotation; const Likelihood = Vision.types.Likelihood; if (Likelihood[safeSearchResult.adult] >= Likelihood.LIKELY || Likelihood[safeSearchResult.violence] >= Likelihood.LIKELY) { console.log('The image', object.name, 'has been detected as inappropriate.'); return blurImage(object.name, object.bucket); } else { console.log('The image', object.name,'has been detected as OK.'); } }); });
  • 28. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Machine Learning hands on - FiendlyChat Code
  • 29. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Where to start? ML as a services vs My Neuronal Network
  • 30. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri (2015-2016)
  • 31. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri My first neuronal network - TensorDraw Repo: https://github.com/Twiinlab/codemotion2017 inspired by: https://quickdraw.withgoogle.com/ Main Tools TensorFlow & App Engine +
  • 32. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Python data science libraries Numpy: Numerical processing Pandas: Data Analysis MatPlotLib: Visualization SciKit: Processing machine learning data sets
  • 33. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri pre-processing training evaluate load / split / images CNN network check accuracy model TensorFlow Training save bucle Data source: https://quickdraw.withgoogle.com/data
  • 34. Show me the Code - Training # Imports libraries # layers configuration ... # Optimizer ... # Loss Function ... # image helper fileList = ['smile','car','pencil','burger','moon','hand','tornado','scissors','mug','sock'] class SketchImageHelper(): # init training images def set_up_images(self): sampleSize = self.pos_end - self.pos_begin for i in range(len(self.fileList)): partialImages = np.array(np.load(fileList[i])[self.pos_begin:self.pos_end]) self.images.append( partialImages / 255) self.labels.append(np.full((sampleSize,10), one_hot_encode(i))) def next_batch(self, batch_size): for i in range(len(self.fileList)): x = np.array((self.images[i])[self.position:self.position+batch_size]) y = np.array((self.labels[i])[self.position:self.position+batch_size]) self.position = (self.position + batch_size) return x, y
  • 35. Show me the Code - Training ... # init test images sih = SketchImageHelper() sih.set_up_images() saver = tf.train.Saver() with tf.Session() as sess: steps = 3000 sess.run(init) for j in range(steps): batch_x , batch_y = sih.next_batch(100) sess.run(train,feed_dict={x:batch_x,y_true:batch_y,hold_prob:0.5}) if j%50 == 0: # Validate the Train Model matches = tf.equal(tf.argmax(y_pred,1),tf.argmax(y_true,1)) acc = tf.reduce_mean(tf.cast(matches,tf.float32)) print(sess.run(acc,feed_dict={x:test_x,y_true:test_y,hold_prob:1.0})) saver.save(sess, savefile)
  • 36. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Show me the Code - Network configuration
  • 37. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri pre-processing /prediction restore model TensorFlow Prediction result : [ prob1, prob2, … prob10] APP ENGINE prediction grey scale resize image
  • 38. Show me the Code - Prediction sess = tf.InteractiveSession() sess.run(tf.global_variables_initializer()) saver = tf.train.Saver() saver.restore(sess, "./STORED_model/my_trained_model.json") def readGrayImageFromData(data): imageToPredict = rgba2rgb(data) return rgb2grey(imageToPredict) def simplifyImage(originalImage): partialResizeImage = tform.resize(originalImage, (28, 28), order=5) return (1 - np.reshape(partialResizeImage,newshape=(1,784))) def predictFromDataImage(data): imageData = readGrayImageFromData(data) imageSimple = simplifyImage(imageData) feed_dict = {x: imageSimple, y_true: np.zeros((1, 10)), hold_prob : 0.5 } return sess.run(tf.nn.softmax(y_pred), feed_dict)
  • 39. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri try here: https://tensorweb-af554.firebaseapp.com/
  • 40. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri The Future of MachineLearning What’s next in machine learning trends? Machines That Learn More Effectively Automation of Cyberattack Countermeasures Convincing Generative Models Better Machine Learning Training
  • 41. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Thanks! Any question? Rubén Chavarri Elduayen @pekewake David Chavarri elduayen @dvdchavarri
  • 42. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri Special Thanks to Jorge del Val Juantomas García Gema Parreño Codemotion
  • 43. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri The Future of MachineLearning What’s next in machine learning trends? Machines That Learn More Effectively Automation of Cyberattack Countermeasures Convincing Generative Models Better Machine Learning Training
  • 44. Rubén y David · Contruir una App con AI nunca fue tan facil · @pekewake @dvdchavarri RESOURCES: Código fuente: Demo: ML as a service https://codelabs.developers.google.com/codelabs/firebase-web/ Demo: my neuronal network https://github.com/Twiinlab/codemotion2017 Recomended course: https://www.tensorflow.org/tutorials/ https://www.udemy.com/complete-guide-to-tensorflow-for-deep-learning-with-python/ AI - ML - DeepLearning https://www.datascience.com/blog/machine-learning-and-deep-learning-what-is-the-difference https://blogs.nvidia.com/blog/2016/07/29/whats-difference-artificial-intelligence-machine-learning-deep-learning-ai/ Real apps http://www.wordstream.com/blog/ws/2017/07/28/machine-learning-applications https://blog.twitter.com/engineering/en_us/topics/insights/2017/using-deep-learning-at-scale-in-twitters-timelines.html https://hackernoon.com/spotifys-discover-weekly-how-machine-learning-finds-your-new-music-19a41ab76efe https://www.toptal.com/algorithms/shazam-reconocimiento-de-algoritmos-de-m%C3%BAsica-huellas-dactilares-y-procesamiento/es Machine Learning framework comparison https://blog.paperspace.com/which-ml-framework-should-i-use/ https://project.inria.fr/deeplearning/files/2016/05/DLFrameworks.pdf