Logic for recommender application - database

I am developing an application - which would have users answer maybe 10 questions - which would have 3-4 options for each question. At the end of the 10th question, based on the responses, it would need to suggest a certain solution. Since there are 100's of permutation and combinations - what's the logic that would be required to use and the database design,
thanks
EDIT some more detailed explanation
if my application is used to recommend a data plan from various mobile operators - based on the user answering questions like the time spent on the internet, the type of files being downloaded and so on. So, if the response to question 1 was a and question 2 was c, etc - then it would be a certain plan. If the response to question 1 was b and for question 2 it was c, then it would recommend a certain plan. So, if there were 10 questions - then the combinations can be quite large. So is there a certain algorithm that can handle this?

I. what would be the logic?
If I understand correctly, you would define "rules" such as
If the answer to question 5. is either A or B then the suggested plan would be planB, otherwise execute the rest of the rules.
So you would use a rule engine e.g.: http://www.jboss.org/drools/
II. what would be the database design?
This is quite simple:
USERS table,
QUESTIONS table and
ANSWERS table which would refer to the two others
Possibly there would be a QUESTIONNAIRE table as well, and the QUESTIONS table would refer to it.

Just a 'quick' comment, consider letting the user see changes in what company they could be recommended as they answer every question.
For example, if I am most interested in price that would be the question I would answer first and immediately see the 3 cheapest plans/products recommended to me.
The second question could be coverage and if I then could see the 3 plans with best coverage (in my area) that would be interesting too.
When I answer the third question about smart phone features and I say I want internet, then the first question should spit out the 3 cheapest plans/products that include internet, obviously they could change.
And so on...
Maybe it also could be a good idea to let the user "dive into" each question and see the full range of options for that answer. As a user I would appreciate that.
Above comments is just how I would appreciate if a form was made for me, I don't want to answer 10 questions about stuff I'm not really putting any value on, each user is different and will prefer to make their choice on their questions.
So, based on above it would be like a check list where the top answers would be the plans/products with the most fitting check marks. And to give immediate responses (as the user answer/alter each question), here AJAX would probably be your choice.

Related

Query Table Based on Variable Number of Selection Criteria

I need to query a table in SQL Server based on a number of criteria, any of which could be null. Criteria are:
SaleId
City
ZipCode
County
JudgementAmountMin
JudgementAmountMax
AssessedValueMin
AssessedValueMax
Saledatestart
Saledateend
All of these can be used to filter a selection or just come of them or none of them. I came up with a solution, which broke, and after posting a question asking for help, the responses I received all told me my solution was crap. OK, great, my solution was crap, even though I used a book on stored procedures to guide me and copied most of my solution from the example printed in the text. So how do I build a solution that isn't crap?
Keep in mind that I am should be considered a fairly new SQL Server practitioner and that I would need more than a two line terse response referring to some general process that can be narrowed down to provide a solution by those who already experienced. I am willing to learn and work at finding a solution, but ask that the response be more newbie friendly than being told that my solution is not any good and questioning why anyone would do it that way. Maybe because they followed an example in a book and didn't know any better. Examples are very helpful!
Remember everyone has to start somewhere. I am deaf, so going to classes is not an option that has worked for me. I really am trying, I just need some help.
Regards
Tom

what should be database schema for online voting app

I want to develop an app where Events/Question would be posted by admin and user will vote or answer. Here question can be of three different type and each type can have different option.Admin can view reports about each question
E.g
WHQuestion: What is right age for marriage? (1) >20 (2)=20 (3)20<
Voting:Who is best captain (1)ABC (2)PQR n so on......
YesNoQuestion: Is Dhoni a good captain? (1)Yes (2)No
So I am confused here about the database schema and tables. How should i manage them?
All questions are multiple choice with one or zero correct answers. So: One question, some answers, one optional correct answer.
Question: question_no, text
Answer: question_no, answer_no, text
As to how to store which answer per question is correct, there are two options:
Store the answer_no in the question record. I consider this the better option. A dbms featuring deferred Constraints (so a question record can reference an answer record and vice versa) would be a good thing to have here. If there is no correct answer the answer_no is null.
Have a flag in the answers table and then mark one answer per question as correct and the others as incorrect. This would be appropriate if there were multiple correct answers per question possible. For one correct answer, however, this would be the worse option of the two. To guarantee data consistency you would apply some special check, which can be a bit complicated (for instance a function index to guarantee uniqueness). For no correct answer you could store the same value or even null for all answers. However, you must see the answers to find out that this is a vote question. So again, option 1 is the better choice where you see this immediately in the question record.

sql, product inventory module

I have been tasked with creating a product inventory module. After reading all the posts I can find on Stack Overflow, I have decided the best way is to not keep a separate, running ‘balance’, but to create one on the fly. I have attached a representation of the tables involved.
Actually, it seems like I don't have enough reputation points to include a picture, so here is a link to a dropbox file:
So I have two questions, which are somewhat related, so it seem like I should include them in the same question posting, though I am not a frequent poster and a sql noob. So please excuse me if I am displaying my ignorance with posting or sql.
First, does this look correct (I named all the columns as non-opaque as possible)? I have to create reports that show the current inventory balance for all the products and for products individually as well as a ‘Transaction Register’ with running balance.
Second, provided the first answer is yes, is this a good candidate for creating a view?
Complex question. Difficult to answer without understanding the full scope of the project. One point - I see there is no Current On-hand table. I agree that the running balance at any point in time is best to use a calculated table. It is however common practice to keep a current on-hand table. This gives you the on hand inventory and values with-out having to sum up the transaction. This is the approach in Microsoft Axapta, and other products I have worked with.

FAQ section - Algorithm for showing

I'm writing this website with an FAQ-section. I've been fiddling abit with how the different questions are scored, in order to display the question, that most people wonder about, on top.
At the moment, I have created a counter that is incremented each time someone presses the question, and the list of questions is sorted in descending order.
My question is: Is there a better way to score these FAQ-questions? For example a combined counter and rating or something like that?
The rating should play no role in the FAQ algorithm. The rating is feedback for you: if a question/answer pair is repeatedly rated poorly, you should improve its quality.
The FAQ questions should be the ones that your visitors ask most often, so a simple hit counter is a good place to start. You should also consider ways to include questions that you often receive via phone or email or other feedback methods.
A lot of sites rely on manual maintenance of the FAQ, but I prefer an automated or partially automated approach for several reasons:
Staff is not always involved in the question/answer process, especially if you have a robust set of questions/answers online.
Manually-maintained lists become tedious and therefore receive less attention than they should.
Automated metrics often reveal customer behavior that isn't noticed or expected by staff.
What if you let the support staff arrange the FAQs. Because they get the extra phone calls and know the most popular questions.
So i would like the FAQs to be arranged manually by the support staff.

Dynamic Multiple Choice (Like a Wizard) - How would you design it? (e.g. Schema, AI model, etc.)

This question can probably be broken up into multiple questions, but here goes...
In essence, I'd like to allow users to type in what they would like to do and provide a wizard-like interface to ask for information which is missing to complete a requested query. For example, let's say a user types: "What is the weather like in Springfield?"
We recognize the user is interested in weather, but it could be Springfield, Il or Springfield in another state. A follow-up question would be:
What Springfield did you want weather for?
1 - Springfield, Il
2 - Springfield, Wi
You can probably think of a million examples where a request is missing key data or its ambiguous. Make the assumption the gist of what the user wants can be understood, but there are missing pieces of data required to complete the request.
Perhaps you can take it as far back as asking what the user wants to do and "leading" them to a query.
This is not AI in the sense of taking any input and truly understanding it. I'm not referring to having some way to hold a conversation with a user. It's about inferring what a user wants, checking to see if there is an applicable service to be provided, identifying the inputs needed and overlaying that on top of what's missing from the request, then asking the user for the remaining information. That's it! :-)
How would you want to store the information about services? How would you go about determining what was missing from the input data?
My thoughts:
Use regex expressions to identify clear pieces of information. These will be matched to the parameters of a service. Figure out which parameters do not have matching data and look up the associated question for those parameters. Ask those questions and capture answers. Re-run the service passing in the newly captured data. These would be more free-form questions.
For multiple choice, identify the ambiguity and search for potential matches ranked in order of likelihood (add in user history/preferences to help decide). Provide the top 3 as choices.
Thoughts appreciated.
Cheers,
Henry
This is not AI in the sense of taking any input and truly understanding it.
It most certainly is! You follow this up by stating exactly that:
I'm not referring to having some way to hold a conversation with a user. It's about inferring what a user wants, checking to see if there is an applicable service to be provided, identifying the inputs needed and overlaying that on top of what's missing from the request, then asking the user for the remaining information. That's it! :-)
Inference is at the heart of any topics in AI. What did the user mean? What did the user want? What information should I fetch? How do I parse that information and decide what the answer is?
You're essentially trying to design a state-of-the-art AI system, that uses a combination of NLP techniques to parse natural language queries and then using (maybe) a learning algorithm to determine how to perform the search, possibly hitting a knowledge base, or maybe Google (which also requires a process to parse the returned data to find the answer).
If there is any way you can constrain how input is entered (i.e. how the query is asked), that will help. But then you'll essentially be building a Web form... which has been done a million times over.
In short, you're attempting to create a very complex system but you explicitly don't want to use any of the relevant techniques. If you're attempting to use regexs to do all of this, good luck to you. Because that's one heck of a deep and dark rabbit hole into which I would not want to fall.
But if you insist, start by finding a good book on NLP, because that's where you'll have to start anyway.

Resources