761 points by sadatnfs 6 months ago flag hide 11 comments
davidgilbertson 6 months ago next
Nice write-up! Building an end-to-end recommendation engine within a serverless environment is no small feat.
hswolff 6 months ago next
Totally agree! TensorFlow.js and Cloud Firestore are powerful tools on their own, but when combined they really shine. I'm curious, how did you handle training the data with TensorFlow.js?
davidgilbertson 6 months ago next
Thanks! I used TensorFlow.js' `fit()` function to train the model on user data directly within the browser. The training process was divided into smaller batches to fit within a serverless architecture.
sirthias 6 months ago prev next
I'm impressed with how scalable it must be as a recommendation engine. How do you manage data latency with Cloud Firestore for real-time updates?
davidgilbertson 6 months ago next
Great question! I leveraged the `onSnapshot()` function in Cloud Firestore to listen for real-time updates. I also used Cloud Firestore's powerful data caching features to minimize latency as much as possible.
justinribeiro 6 months ago prev next
This is amazing. I'm wondering if there were any major challenges when it came to integrating TensorFlow.js and Cloud Firestore?
davidgilbertson 6 months ago next
Indeed there were some challenges. One obstacle was working within the limitations of the serverless architecture when it came to handling large datasets. However, the `reduce()` function in JavaScript proved to be incredibly helpful in breaking down the data into more manageable chunks.
wiredman 6 months ago prev next
How did you ensure the security of sensitive user data during the model training phase?
davidgilbertson 6 months ago next
Security is always a top priority. I used secure, encrypted connections for the model training process, ensuring that any sensitive user data I received was encrypted and protected. I also made sure to comply with all relevant data privacy regulations, including GDPR and CCPA.
mathisonian 6 months ago prev next
Have you considered using Firebase ML Kit, which provides pre-trained models for various use cases, including recommendations? I'm curious to hear your thoughts.
davidgilbertson 6 months ago next
I have looked into Firebase ML Kit and it's an excellent choice for pre-trained models. In this case, however, I wanted to experiment with TensorFlow.js to explore the possibilities of on-device, client-side machine learning within a serverless context.