Data analytics is a perpetual underachiever. Every generation of tools promises us better insight and never quite delivers. So we get stuck re-platforming and re-designing, hoping the next iteration will finally get us to the intelligence utopia. Yet modern applications must provide rich experiences, offer decision support, and continuously learn and adapt to win their users. Analytics and AI are at the heart of these Intelligent Apps.
数据分析是永远的后进生。 每一代工具都可以使我们获得更好的洞察力,并且永远无法交付。 因此,我们陷入了重新平台化和重新设计的困境,希望下一次迭代将最终使我们进入智能乌托邦。 然而,现代应用程序必须提供丰富的体验,提供决策支持,并不断学习和适应以赢得用户。 分析和AI是这些智能应用程序的核心。
We decided to build an Intelligent App to demonstrate how easy it is to take advantage of ML and AI cloud services without hiring a team of data scientists. First, we built a simple e-commerce application - MongoDB SwagStore - using React and MongoDB Stitch with MongoDB Atlas on GCP. Stitch saved us hundreds of lines of code and our app was ready in days. But aside from implementing stock replenishment notifications with Stitch Triggers and Twilio, it wasn’t very intelligent... yet.
我们决定构建一个智能应用程序,以展示无需雇用数据科学家团队即可轻松利用ML和AI云服务的便利。 首先,我们在GCP上使用React和MongoDB Stitch和MongoDB Atlas构建了一个简单的电子商务应用程序MongoDB SwagStore。 Stitch为我们节省了数百行代码,而我们的应用程序几天之内就可以准备就绪。 但是除了使用Stitch Triggers和Twilio实施库存补充通知之外,它还不是很聪明。
We enabled our SwagStore with a product recommendation engine. Rather than implementing a recommendation engine from scratch, we used Google Cloud ML to train and tune a TensorFlow model that implements a WALS collaborative filtering algorithm. We then used Google Cloud Endpoints to serve up these personalized recommendations.
我们使用产品推荐引擎启用了SwagStore。 我们没有从头开始实现推荐引擎,而是使用Google Cloud ML来训练和调整可实现WALS协同过滤算法的TensorFlow模型 。 然后,我们使用Google Cloud Endpoints提供这些个性化建议。
When a user authenticates, MongoDB Stitch sends an HTTP GET request to the Google Cloud Endpoint to obtain a list of recommended products.
用户进行身份验证后,MongoDB Stitch会向Google Cloud Endpoint发送HTTP GET请求以获取推荐产品的列表。
A Stitch Function updates the recommendations array in the user document with the returned result.
缝合功能使用返回的结果更新用户文档中的建议数组。
exports = function() {
//services
const gcp = context.services.get("GoogleCloudRec");
const mongodb = context.services.get("mongodb-atlas");
//my swagstore collection
const users = mongodb.db("swagstore").collection("users");
const products = mongodb.db("swagstore").collection("products");
return users.findOne({user_id: context.user.id})
.then(user => {
if(!user.gcpId) {
return [];
}
//URL to GCP cloud endpoint
const url = `https://jfmlrecengine.appspot.com/recommendation?userId=${user.gcpId}`;
return gcp.get({ url }).then(response => {
console.log("Retrieved Recommendations");
return EJSON.parse(response.body.text());
})
.then(result => {
// Get the product info for the array of product ids
return products.find({id: {"$in": result.articles}}, {_id:0, id:1, name:1, image:1}).toArray();
})
.then(products => {
console.log(JSON.stringify(products));
// Write the products to the user document
return users.updateOne({"gcpId": user.gcpId}, { $set: { "personalized_recs" : products}})
.then(() => { return products });
});
});
};
So when Jane logs into SwagStore she will see these product recommendations:
因此,当Jane登录SwagStore时,她将看到以下产品推荐:
And Jasper - different ones:
和贾斯珀-不同的是:
By using MongoDB Stitch combined with powerful cloud services and APIs you can build a recommendation system like this very quickly and plug it right into you operational app getting your developers and data scientists to work together, operationalize insight, and deliver intelligence to your customers. Give it a try!
通过将MongoDB Stitch与强大的云服务和API结合使用,您可以快速构建一个这样的推荐系统,并将其直接插入您的运营应用程序中,从而使您的开发人员和数据科学家能够一起工作,实现见解并为您的客户提供情报。 试试看!
Stay tuned for Part 2 where SwagStore becomes even more intelligent with an AI chatbot.
请继续关注第2部分,其中SwagStore借助AI聊天机器人变得更加智能。
翻译自: https://scotch.io/tutorials/building-intelligent-apps-with-mongodb-and-google-cloud-part-1

638

被折叠的 条评论
为什么被折叠?



