|
Posted by TristaSD on 05/06/06 07:57
I'm following you.
However, I don't understand how I would tie in the second question
about the importance of gas mileage.
Suppose I have the field 'mileage' in the database. All vehicles are
scored on the 10-point scale depending on how gas-guzzling they are.
So a Cav is 7, Focus is 7, Civic is 8, Prius is 10, VW TDI is 10, Aveo
and Echo are 9, Ford F-150 is 2, Humscalade is 1, etc.
How would I tie that question in with the logic is the question asks
"important" or "not important"? But even before that, what values do I
give to each radio button of each question?
Thanks again.
> The logic is that of scoring and weighing.
>
> First, you assign attribute scores to each vehicle (let's say, you have
> three scores: reliability, fuel economy, and price, all on a scale from
> 1 to 10, with 1 being "extremely poor" and 10 being "excellent"). So
> you have a table in a database with fields like this:
>
> id (int)
> make (varchar)
> model (varchar)
> year (int)
> reliability (int)
> economy (int)
> price (int)
>
> Then, you use user responses to elicit which score is most important to
> a particular user (each question can add points to relative importance
> of one or more scores). How you weigh the results is entirely up to
> you. You can use raw points or simply give a weight of 3 to the most
> important score, 2 to the next in order of importance, and 1 to the
> least important.
>
> Let's say you decided to store reliability, economy, and price weights
> in three variables, $w_reliability, $w_economy, and $w_price. Now you
> can form your query, execute it, and display results:
>
> $year = '2007';
> $query = <<<EOQ
> SELECT make, model,
> ($w_reliability * reliability +
> $w_economy * economy +
> $w_price * price) AS composite_score
> FROM vehicles
> WHERE year = $year
> ORDER BY composite_score DESC
> LIMIT 5
> EOQ;
> $result = mysql_query($query);
> echo "Your responses indicate that you might be interested in: \r\n";
> while ($record = mysql_fetch_array($result)) {
> echo $record['make'], ' ', $record['model'], "\r\n";
> }
>
> Cheers,
> NC
Navigation:
[Reply to this message]
|