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

BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICABIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICAÁngel Encinas
 
Cuaderno de trabajo Matemática 3 tercer grado.pdf
Cuaderno de trabajo Matemática 3 tercer grado.pdfCuaderno de trabajo Matemática 3 tercer grado.pdf
Cuaderno de trabajo Matemática 3 tercer grado.pdfNancyLoaa
 
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxTIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxlclcarmen
 
Imperialismo informal en Europa y el imperio
Imperialismo informal en Europa y el imperioImperialismo informal en Europa y el imperio
Imperialismo informal en Europa y el imperiomiralbaipiales2016
 
Dinámica florecillas a María en el mes d
Dinámica florecillas a María en el mes dDinámica florecillas a María en el mes d
Dinámica florecillas a María en el mes dstEphaniiie
 
Ley 21.545 - Circular Nº 586.pdf circular
Ley 21.545 - Circular Nº 586.pdf circularLey 21.545 - Circular Nº 586.pdf circular
Ley 21.545 - Circular Nº 586.pdf circularMooPandrea
 
proyecto de mayo inicial 5 añitos aprender es bueno para tu niño
proyecto de mayo inicial 5 añitos aprender es bueno para tu niñoproyecto de mayo inicial 5 añitos aprender es bueno para tu niño
proyecto de mayo inicial 5 añitos aprender es bueno para tu niñotapirjackluis
 
Sesión de aprendizaje Planifica Textos argumentativo.docx
Sesión de aprendizaje Planifica Textos argumentativo.docxSesión de aprendizaje Planifica Textos argumentativo.docx
Sesión de aprendizaje Planifica Textos argumentativo.docxMaritzaRetamozoVera
 
Estrategias de enseñanza-aprendizaje virtual.pptx
Estrategias de enseñanza-aprendizaje virtual.pptxEstrategias de enseñanza-aprendizaje virtual.pptx
Estrategias de enseñanza-aprendizaje virtual.pptxdkmeza
 
Qué es la Inteligencia artificial generativa
Qué es la Inteligencia artificial generativaQué es la Inteligencia artificial generativa
Qué es la Inteligencia artificial generativaDecaunlz
 
LABERINTOS DE DISCIPLINAS DEL PENTATLÓN OLÍMPICO MODERNO. Por JAVIER SOLIS NO...
LABERINTOS DE DISCIPLINAS DEL PENTATLÓN OLÍMPICO MODERNO. Por JAVIER SOLIS NO...LABERINTOS DE DISCIPLINAS DEL PENTATLÓN OLÍMPICO MODERNO. Por JAVIER SOLIS NO...
LABERINTOS DE DISCIPLINAS DEL PENTATLÓN OLÍMPICO MODERNO. Por JAVIER SOLIS NO...JAVIER SOLIS NOYOLA
 
ORGANIZACIÓN SOCIAL INCA EN EL TAHUANTINSUYO.pptx
ORGANIZACIÓN SOCIAL INCA EN EL TAHUANTINSUYO.pptxORGANIZACIÓN SOCIAL INCA EN EL TAHUANTINSUYO.pptx
ORGANIZACIÓN SOCIAL INCA EN EL TAHUANTINSUYO.pptxnandoapperscabanilla
 
Registro Auxiliar - Primaria 2024 (1).pptx
Registro Auxiliar - Primaria  2024 (1).pptxRegistro Auxiliar - Primaria  2024 (1).pptx
Registro Auxiliar - Primaria 2024 (1).pptxFelicitasAsuncionDia
 
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLAACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLAJAVIER SOLIS NOYOLA
 
Estrategia de prompts, primeras ideas para su construcción
Estrategia de prompts, primeras ideas para su construcciónEstrategia de prompts, primeras ideas para su construcción
Estrategia de prompts, primeras ideas para su construcciónLourdes Feria
 
PLAN DE REFUERZO ESCOLAR primaria (1).docx
PLAN DE REFUERZO ESCOLAR primaria (1).docxPLAN DE REFUERZO ESCOLAR primaria (1).docx
PLAN DE REFUERZO ESCOLAR primaria (1).docxlupitavic
 
Caja de herramientas de inteligencia artificial para la academia y la investi...
Caja de herramientas de inteligencia artificial para la academia y la investi...Caja de herramientas de inteligencia artificial para la academia y la investi...
Caja de herramientas de inteligencia artificial para la academia y la investi...Lourdes Feria
 

Recently uploaded (20)

BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICABIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
 
Presentacion Metodología de Enseñanza Multigrado
Presentacion Metodología de Enseñanza MultigradoPresentacion Metodología de Enseñanza Multigrado
Presentacion Metodología de Enseñanza Multigrado
 
Cuaderno de trabajo Matemática 3 tercer grado.pdf
Cuaderno de trabajo Matemática 3 tercer grado.pdfCuaderno de trabajo Matemática 3 tercer grado.pdf
Cuaderno de trabajo Matemática 3 tercer grado.pdf
 
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxTIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
 
Imperialismo informal en Europa y el imperio
Imperialismo informal en Europa y el imperioImperialismo informal en Europa y el imperio
Imperialismo informal en Europa y el imperio
 
Dinámica florecillas a María en el mes d
Dinámica florecillas a María en el mes dDinámica florecillas a María en el mes d
Dinámica florecillas a María en el mes d
 
Fe contra todo pronóstico. La fe es confianza.
Fe contra todo pronóstico. La fe es confianza.Fe contra todo pronóstico. La fe es confianza.
Fe contra todo pronóstico. La fe es confianza.
 
Ley 21.545 - Circular Nº 586.pdf circular
Ley 21.545 - Circular Nº 586.pdf circularLey 21.545 - Circular Nº 586.pdf circular
Ley 21.545 - Circular Nº 586.pdf circular
 
Unidad 3 | Metodología de la Investigación
Unidad 3 | Metodología de la InvestigaciónUnidad 3 | Metodología de la Investigación
Unidad 3 | Metodología de la Investigación
 
proyecto de mayo inicial 5 añitos aprender es bueno para tu niño
proyecto de mayo inicial 5 añitos aprender es bueno para tu niñoproyecto de mayo inicial 5 añitos aprender es bueno para tu niño
proyecto de mayo inicial 5 añitos aprender es bueno para tu niño
 
Sesión de aprendizaje Planifica Textos argumentativo.docx
Sesión de aprendizaje Planifica Textos argumentativo.docxSesión de aprendizaje Planifica Textos argumentativo.docx
Sesión de aprendizaje Planifica Textos argumentativo.docx
 
Estrategias de enseñanza-aprendizaje virtual.pptx
Estrategias de enseñanza-aprendizaje virtual.pptxEstrategias de enseñanza-aprendizaje virtual.pptx
Estrategias de enseñanza-aprendizaje virtual.pptx
 
Qué es la Inteligencia artificial generativa
Qué es la Inteligencia artificial generativaQué es la Inteligencia artificial generativa
Qué es la Inteligencia artificial generativa
 
LABERINTOS DE DISCIPLINAS DEL PENTATLÓN OLÍMPICO MODERNO. Por JAVIER SOLIS NO...
LABERINTOS DE DISCIPLINAS DEL PENTATLÓN OLÍMPICO MODERNO. Por JAVIER SOLIS NO...LABERINTOS DE DISCIPLINAS DEL PENTATLÓN OLÍMPICO MODERNO. Por JAVIER SOLIS NO...
LABERINTOS DE DISCIPLINAS DEL PENTATLÓN OLÍMPICO MODERNO. Por JAVIER SOLIS NO...
 
ORGANIZACIÓN SOCIAL INCA EN EL TAHUANTINSUYO.pptx
ORGANIZACIÓN SOCIAL INCA EN EL TAHUANTINSUYO.pptxORGANIZACIÓN SOCIAL INCA EN EL TAHUANTINSUYO.pptx
ORGANIZACIÓN SOCIAL INCA EN EL TAHUANTINSUYO.pptx
 
Registro Auxiliar - Primaria 2024 (1).pptx
Registro Auxiliar - Primaria  2024 (1).pptxRegistro Auxiliar - Primaria  2024 (1).pptx
Registro Auxiliar - Primaria 2024 (1).pptx
 
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLAACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
 
Estrategia de prompts, primeras ideas para su construcción
Estrategia de prompts, primeras ideas para su construcciónEstrategia de prompts, primeras ideas para su construcción
Estrategia de prompts, primeras ideas para su construcción
 
PLAN DE REFUERZO ESCOLAR primaria (1).docx
PLAN DE REFUERZO ESCOLAR primaria (1).docxPLAN DE REFUERZO ESCOLAR primaria (1).docx
PLAN DE REFUERZO ESCOLAR primaria (1).docx
 
Caja de herramientas de inteligencia artificial para la academia y la investi...
Caja de herramientas de inteligencia artificial para la academia y la investi...Caja de herramientas de inteligencia artificial para la academia y la investi...
Caja de herramientas de inteligencia artificial para la academia y la investi...
 

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