Advertisement

Need to implement something unusual, in JS

Started by February 03, 2010 03:32 AM
11 comments, last by Predictor 14 years, 8 months ago
Hi, I've got an unusual AI problem that I need to find a solution for; This is not related to game development, but game developers are so crazy that I'm sure somebody will have a solution. I need to implement some user behaviour interpretation, in &#106avascript. Basically, this will gather keystroke frequency data as the user types. The theory is that as they type it logs their typing speed, and the average pause between words or sentences, and then decides whether they have "finished" typing. This will be used to decide when the user has finished answering a question, and advance a "questionnaire" form (in the browser) to the next question. The biggest potential problem that I can think of is that anomolies in the data will prevent the system from making any kind of accurate predictions. I can process the data in PHP when the page loads, but the rest needs to be in real time, in &#106avascript. I'm already pretty adept at making &#106avascript do things that even google wouldn't attempt, so the language is not the issue, although I may find that speed is a problem. Does anybody have any ideas for how I can do this?
Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!
The engine would need to spend considerable time with the user in order to gather the data for learning the typing patterns. The actual analysis would be somewhat standard statistics. However, even if you had the time:

-Each user has different habits, so you'd need to train the AI for each user separately in order to get even nearly accurate analysis results.

-Habits may change wildly within the context of one user, if he/she is tired, under influence of some substance, angry, in a hurry etc. etc.

-The user will not type all letters or words at the same pace. If it is an unfamiliar word (or even a single alphabet), it takes longer to write than a familiar one.

-The user could make a mistake (typing or factual) and would want to correct it before advancing.

-Even though the engine would consist of actual human processing the patterns, it wouldn't still be accurate due to all the reasons above.

These are just scratching the surface. Therefore, I recommend settling for the standard approach of using the tab key to switch control focus.

Niko Suni

Advertisement
Quote: Original post by Nik02
The engine would need to spend considerable time with the user in order to gather the data for learning the typing patterns. The actual analysis would be somewhat standard statistics. However, even if you had the time:

-Each user has different habits, so you'd need to train the AI for each user separately in order to get even nearly accurate analysis results.

-Habits may change wildly within the context of one user, if he/she is tired, under influence of some substance, angry, in a hurry etc. etc.

-The user will not type all letters or words at the same pace. If it is an unfamiliar word (or even a single alphabet), it takes longer to write than a familiar one.

-The user could make a mistake (typing or factual) and would want to correct it before advancing.

-Even though the engine would consist of actual human processing the patterns, it wouldn't still be accurate due to all the reasons above.

These are just scratching the surface. Therefore, I recommend settling for the standard approach of using the tab key to switch control focus.


I'm aware of all these problems, what I need are solutions. Ive not got a choice; I wanted to use an "im done" button for each question, but i've been told to do it this way.

Failing this, I need somebody with credentials to tell my bosses *why* its not feasible, so they can reassess their (and therefore my) goals.

[Edited by - speciesUnknown on February 3, 2010 5:52:22 AM]
Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!
I would like to help you on that, but my credentials are not in the AI field even though I have done some research on it over the years.

You will lose years of your life on this project if you go on with it. You could even succeed in the project if you think out of the box far enough, but I can't think of any current technology that could accurately tackle the problem. Skynet-level AI technology is not yet complete (as far as I know), let alone a JS implementation.

Do note that you might get some results in a manageable time by sacrificing accuracy, but then each and every one of your users will get pissed off. In conjunction, consider that real-life managers sometimes get pissed off by their secretaries for similar tasks.

Niko Suni

As a user, be assured I would be *pissed off* if the questionnaire advanced without me saying I'm done with the current question. Sorry, but this idea goes against everything that's holy in UI design. Work *with* your user, not *against* him!

Two reasons why such an approach is a bad idea:

(a) it causes psychological pressure (come on, answer, the form might change at any moment!)

(b) it will never be reliable. Reach for your coffee and the form will advance before you are finished. Some comes to talk to you and the form will advance before you are finished. Your phone rings and the form advances before you are finished.

Sadly, management sometimes is blissfully cut off from reality so it's your job to convince them this would be a bad idea (at one point, a manager suggested implementing a FAQ using a neural network. Excuse me, what? :) ) If everything fails, make sure to add some indication that the form is about to change and give the user the chance to *cancel* this (and ideally turn the feature off altogether). Don't try to go for complex solutions, it won't work. Go for simple rules:

(a) don't advance if the user hasn't typed anything.

(b) display a 3-5 second timer once the user stops timing (with a prominent cancel button and a next button). If the timer ends, advance. If the user clicks next, advance. If the user clicks cancel, stop the timer but keep the next button.

(c) reset the timer immediately as soon as the user types or clicks on the text box.

(d) make sure the user can go back and edit any answer without issues.

Anything more complex will soon become completely unreliable.

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]

Let's see.

Having a "Next" button to advance the questionnaire: a few seconds or minutes, bug-free.

Developing complex user behaviour analysis, testing it with synthetic benchmark data, performing in-vivo tests (which probably require an ethics analysis), putting it to use, and then dealing with bugs and statistical outliers: a few months or even years in development, continuing support drama.

Seriously, this is supposed to be for a web questionnaire? There's only so Web 2.0 you can get before crossing the line.
Advertisement
I know you can't tell your bosses that their idea is of dubious value and maybe, just maybe they do have a good reason for wanting something like that. But have they thought what if someone leaves the computer for 30 seconds to get a glass of water or go to the bathroom? Go to next page? Unless it is for a very specific application that I cannot think of right now (maybe a specialized typing test or something), this is the strangest idea for web based user interface I've ever heard. Do your bosses want to make use of the software intentionally inconvenient? Sorry, ending my rant here. You should try to politely figure out if they have thought about these things if you don't already know they have, and have chosen to ignore it.

That put aside, I'd just try to think simpler. Check if all fields are filled and if they are, then you can wait for t=(average pause time of user when switching between form fields * some other multiplier) seconds using timer. This should ensure that if user doesn't want to fix anything, he/she would be taken to next form. It shouldn't exactly be CPU intensive either if you just capture field focus events and measure time since last one + add a timer that checks periodically if more time has been passed once all fields have been filled.
The user's habit might be to check the page in its entirety after filling the fields but before advancing to the next page. You just don't know what the user is actually doing or going to do. Even if the machine would be able to perform a full psychological profiling on the user (which is not possible at all, regardless of processing power), there would still be uncertainty due to random events.

Niko Suni

Markov Chains?
1. What is the purpose of this form? Although this would be horrendous on a "normal" website, I could see some value for a psychological experiment, maybe.

2. Have you tried the simple idea first (along the lines of mrjones's)? Just have a countdown timer that is triggered when the user first starts typing, and is reset each time the user does something -- or has time added to it in different amounts for different actions (e.g., switching form fields adds more time than typing character -- though perhaps typing a space could add more time than other characters). If what you want is quick, decent results, this is the approach I'd probably take.

3. My first, probably overcomplicated (but academically interesting(?)) thought was along the lines of Steadtler's: Model the user as a Markov chain and use the Viterbi algorithm to determine what state they're in; if it's the "done" state with high enough probability, move on. To do this you'd have to have people spend some time doing the surveys to generate statistics on the edge transition probabilities. If what you want out of this is an academic publication, this might be what I'd do.

This topic is closed to new replies.

Advertisement