AWS Personalize Duplicate Recommendations - amazon-personalize

I'm using AWS Personalize to recommend some products. There are 2 test users with totally different impressions data. Yet they are getting the same Recommendations (duplicate).
Anyone come across this issue? The 2 Users in this case have very different product impressions, so there should not be any overlap.
Thanks!

I had the same issue in the past. When recommendations are being the same for different users, then the issue is that your interactions events are being ignored/not recognised correctly.
AWS Personalize has a fixed recommendations set for users, that haven't interacted with the items dataset yet. You can test it yourself, by trying to get recommendations for non-existing user (generate uuid for example). Recommended items will be the same as for users, that you spotted the issue for.
In our case, what we find out, was that all of the interactions were not correctly recognised by Personalize. If you are using PutEvents API to save events in realtime, it might fail silently, if you set sessionId to 'null', instead of omitting this parameter. You will get 200 OK response from Personalize API, however event won't be saved.
You can find out more about this in this GitHub issue, which was indeed closed and not resolved: https://github.com/aws/aws-sdk-js/issues/3371
If that's not the case for you, then I would strongly advise to take a closer look into other PutEvents params, since they could be also causing similar behaviour. Try to experiment with minimal PutEvents API call and be sure that it works (recommendations should be changing immediately for this user). When you are sure, that your API call succeeds, then try adding more stuff from the call, that you are using normally, until it breaks, so you would know, which exactly parameter is causing problems.

Related

How exactly does backend work from a developer perspective?

Theres a ton of videos and websites trying to explain backend vs frontend, but unfortunately none of them explains it in a way that you know how to develop a backend - driven website (at least I haven't found anything good).
So, I wanted to ensure that I understood it and kindly ask you to confirm or correct me on this topic.
Example:
I wanted to build Mini - Google. I have a Database containing 1000 stored websites.
Assumption #1:
Everytime I type something into the search bar, the autofill suggestions change. This means, everytime i type, another website / API gets called returning the current autofill suggestions. On a developer site, this means the website e.g. is a Python script which gets called with the current word typed in as a Parameter and is returning all suggestions as e.g. JSON:
// Client Side Script
function ontype(input):
suggestions = get("https://api.googlemini.com/suggestions?q=" + str(input))
show(suggestions)
Assumption #2:
This also means I could manually call the website containing the Python script, providing a random word and it would always return a JSON containing the autofill suggestions for that word.
Question #1:
If A#1 turns out true but A#2 turns out false, how could I prevent a user from randomly accessing the "API" while still returning results when called by a script?
Assumption #3:
After pressing enter, my website googlemini.com/search?... would be called. As google.com/search reloads everytime searching for a new query (or going to page 2 etc.), I assume, instead of calling an API, when the server gets the client request, it first searches through its database, sorts the results and then returns a whole html as a static webpage:
// Server Side Script
#app.route("/search")
function oncall():
query = getparam("q")
results = searchdatabase(query)
html = buildhtml(results)
return html
Question #2:
Often, I hear (or at least understand it this way) that database and webserver are 2 seperate servers. How would that work? Wouldn't that mean the database server needs to be accessible to the web too (of course it would have security layers etc., but technically it would)? How could I access the database server from the webserver?
Question #3:
Are there, on a technical basis, any other ways to build backend services?
That's it. I would also appreciate any recommendations like videos, websites or others to learn how to technically setup and / or secure backend servers.
Thanks in advance.
For your first question you can yes there is a way to prevent miss use.
What you can do is add identifier to api like Auth token to identify a user and every time a user access the api you can save the count on the server n whenever the count has exceeded a limit within a time span you can reject the call. And the limit can be set in such a way that it doesn't trouble the honest user and punishes the wrong one. There are even more complex and effective methods but this is the basic idea.
For question number to let me explain you a simple concept a database is a very efficient, resourcefull and expensive data storage solution we never want it to be used in a general sense as varible store or something. We always want to access the database in call get the data process the data update the data. So we do it data way and its not necessary you make sepreate server for data base. The thing is we mostly make databse to be accessible to various platforms android, ios, windows. So its better to add some abstraction and keep data base as a separte entity.
For the last, I am not well aware about what you meant by other but I am listing some backend teechnologies, some of these might be used in isolation some of these not some other tools as well.
Django
FLask
Djnago rest
GraphQL
SQL
PHP
Node
Deno

Firestore security tester - Get function not found

I have been struggling for days now trying to get my Firestore security rules to work with basic rules - even ones copied and pasted from the docs. I have tried to spin up the development and test emulator, but it failed due to what appears to be npm conflicts.
I tried to use the rules playground, but it gives me the error that the "get" function is not recognized. I found that this problem has occurred in the past. I could really use some help in figuring out where to start with this. I am considering abandoning the firestore system all together as along with these problems, the system frequently fails to connect.
The full get statement is ...
get(/databases/$(database)/documents/users/$(request.auth.uid)).data.designer ==true
I have tried a number of variations of this with no success.
If this is a problem with the tester, how can I test my queries and figure out where the problems lie. If this is a bigger problem, what do I do?
Update : The read will work if I am querying the users collection as in the query below.
allow read : if get(/databases/$(database)/documents/users/$(request.auth.uid)).data.designer == true
The issue seems to lie in when I need to retrieve docs without knowing the specific ID of the doc in question - getting multiple docs based upon the security rule.
You are testing without a signed in user, which means that the $(request.auth.uid) expression inside your call to get() fails. To make this work you'll need a signed in user.

No perfect tag for Messenger Platform’s policies

We have a lot of doubts concerning the changes in the Messenger Platform’s policies.
There is HUMAN_AGENT tag (for which we have already asked permission) which seems to be the one that adapts the most to our processes, but 7 days is still insufficient for us. Could we answer with this “message_tag” 20 days after a user message? What can we do in this case? We have to find a way not to leave the user without an answer.
We plan on using one of the above-mentioned CONFIRMED_EVENT_UPDATE to answer all user messages outside of the 24 hour window. Are there any penalties for us doing so? If there are, what are the penalties? Are they applied at the company level or the page level? None of the messages sent by our company contain what you want to avoid (spams, special offers, discounts, etc.) so we don’t think we should recieve any penalty even when using “message_tags”.
We have thought about using the normal answer and, if the “This message is sent outside of the allowed window” error message appears, we will answer using “message_tags”. Is there any problem for using the first call on a recurrent basis giving errors or should we avoid it? Avoiding it might cause to send unnecesary “message_tags”. Could we answer all private messages using HUMAN_AGENT when it is approved (our answers are always given by a customer service agent)?
Best regards
You do not mention your actual use case, so nobody can suggest any message tags that would match that use case.
Without knowing that use case the answer to your questions can only be:
1) There is no way to extend the 7 days window for human agent tag. If you get approved for it you have a 7 days windows, not 8 and not 20. However most user actions reset that window you should follow up within that window and and make sure the user engages with your bot so the window is reset and you have another 7 days for another update.
2) Abusing tags will most likely result in your page being restricted, make sure to only use them for the allowed use cases as listed in the docs: https://developers.facebook.com/docs/messenger-platform/send-messages/message-tags/

Facebook Insights - Event Data Missing

I'm having a problem with the events I'm sending to Facebook Insights. I've got about 15 custom events I'm sending, and they all carry a data object that is pretty consistent between all the events. 10 of the events show up with the data object working fine (see graphic User Logged In/Out events), and for the rest, I'm getting "No data is available for the current selection." (see graphic Story Played/Selected events).
I believe with one event I shortened the Event Type, and the data started displaying properly. I tried this with other events, and that didn't fix the problem. Has anyone had this sort of problem before, and could you please comment about your solution?
I'm using Adobe AIR for mobile, running on Android, using the Milkman Games GoViral ANE. Another important factor here is that I'm sending these exact same events to a different analytics service - Mixpanel. All the events look correct on Mixpanel, so I'm pretty sure I'm sending them out properly. My assumption at the moment is that Facebook doesn't like something specific about some of my events.
I'm interested in any comments about this general kind of issue, regardless of platform or implementation, to see if I can figure out what's going wrong. I know my app setup is not so common, so for the sake of this question I'd like to ignore that for the time being.
Thanks in advance for any help you might provide.
I answered my own question. It turns out Facebook Insights events have a limit of 10 properties per event. Once I reduced the data being sent, the other events started tracking properly.

Attempting to Create a User Login for Clojure / Korma / PostgreSQL site

I am completely stuck on where to start with getting a log-in area for a Clojure site I am building (for fun).
I've looked at several resources, which I'll post below, mercilessly copy/pasted code, and the closest I can get is one of two situations:
The login page takes the login but says that the login failed, though, as far as I can tell, the login matches.
Or I get this error: No method in multimethod '->sql' for dispatch value: null
I'm not sure how to interpret the above error: is this specifying that I need a multi-method or is it specifying that I need to check for null? The null requirement makes no sense at all. I'm not really asking but if anyone wants to give an explanation, that is great.
I tested the output by comparing the results-to-select queries from raw non-hashed data, I've went through 5 variations on this theme, using everything from page-to-page calls to creating new defpartials, multi-methods, defn, etc.
Sources I have used (unfortunately, I can't list all of them being a first-time poster):
This one uses Clojure -> Korma -> PostgreSQL, but the code doesn't seem to work for multiple users?
http://www.vijaykiran.com/2012/01/17/web-application-development-with-clojure-part-2/
This one shows how to use Noir and PostgreSQL (Yes, I am using Noir):
https://yogthos.net:11794/blog/23-Noir+tutorial+-+part+2
The 4Clojure site, but that one uses CongoMongo:
The Heroku Twitter clone, but no mention of how to create logins for one person, much less several.
I also bought Programming Clojure from O'Reilly Press, but once again, nothing about how to create a log-in area.
FIRST EDIT: I was asked to create a github repository of a stand-alone site. This includes a working "Account Creation" area that is found in the welcome.clj file and only a form of the Login area in login.clj.
I was attempting to get some of the same errors working as I had last night and also attempting to get this working before I uploaded the files. I don't have any reasonable starting points yet, thus there is no beginning implementation as of yet. I'm seriously embarrassed at the solutions I've been coming up with, thus I don't want to post them. I get conceptually what I should do, but for some reason, I can't seem to translate this. This is my first github account: my background is Python, Scheme a'la SICP, and some Python + PostgreSQL marketing program I built.
SECOND EDIT: Ack! I can't seem to get the thing to work at all... Yeah, I spent well over 20 minutes (hours) on this one, so I have just have to admit that I don't yet have the requisite knowledge to accomplish this, no matter how many sources I look to. I committed the updated files and all the odd things I tried, including all the variations on login box to running raw SQL. The closest I can come is getting it so that I don't get any errors, but no evidence at all that someone is logged in. Thanks so much for the help and suggestions. I'll most certainly return to this later.
https://github.com/dt1/noirKormaLogin
There are a couple of issues that I see. First, in datapass.clj, you're creating an entity with no content. I'm not sure how Korma handles that. It's trying to thread results as inputs to other functions, so I could see how nil gets introduced there.
Secondly, you'll need something to handle the login post. (defpage ...) only handles GET requests by default. You'll need a separate defpage to handle the post. Something along these lines:
(defpage [:post "/login"] {:keys [user-name pwd]}
(if-let [user (db/find-user user)]
(if (noir.util.crypt/compare pwd (:password user))
(do
(noir.session/put! :some-key some-value)
(noir.response/redirect "/success"))
noir.response/redirect "/failed-to-login"))
(noir.response/redirect "/failed-to-login"))
session/put! is how you put data into the session. The default is to use an in-memory store. You'll need to add Ring middleware to use persistent sessions (look at Session Stores).
Also, as luck would have, someone just posted an authentication app for Noir... you may want to take a look: https://github.com/xavi/noir-auth-app