Average in Adjusted cosine Similarity - cosine-similarity

what is the denominator in average rating of a user in Adjusted cosine similarity? (Item Based Collaborative Filtering)
Is it number all Items in system?? Or Just number of rated items by user??
and
is there a function in MatLab for Adjusted Cosine?
thanks

Question 1: Is it number all Items in system?? Or Just number of rated items by
user??
Answer 1: Neither
If you see this formula:
in the denominator you need to calculate the rooted sum for each Rating of user u for item i minus the average rating of this User (mean rating) and this subtraction is squared then it is the same thing for item j which you have to multiply together.
Question 2: is there a function in MatLab for Adjusted Cosine?
Answer 2: By default no. But it should be relatively easy to write it your self given that you have the formula.

Related

How to find Lagrange Multiplier word problem constraint and objective function?

What would the objective and constraint be in this word problem?
A company manufactures x units of one item and y units of another. The total cost in dollars, C, of producing these two items is approximated by the function C=6x^2+3xy+7y^2+900.
If the production quota for the total number of items (both types combined) is 220, find the minimum production cost.

How is the Bollinger Oscillator Calculated?

The Upperband is calculated: Middleband + (D + sqrt(((close - Middle band)^2)/n))
And I know how to calculate the lower bollinger band and middle bollinger bands.
But there is an elusive indicator called the bollinger oscillator which I find combines the bollinger bands into a single oscillating indicator. Please explain how to calculate it.
Use SQL if possible assume fields contain relevant values.
Find the 9-day moving average average (n1 + n2 ... + n9)/9
Find the standard deviation of the 9-days
Subtract 9-day Moving average from the current ruling price
Take the answer devide by the standard deviation
Answer is the BOS (Bollinger Oscillator)

Knapsack (multi-criteria)

If I have a knapsack where weight w have two values v1 and v2 and capacity is m. How will I find the total values for v1 and v2 where the weight does not exceed capacity m?
Ok, so your problem is defined as following. First some (variable definitions with sample values):
int N = 4; // number of items to choose from
int m = 6; // maximum weight in knapsack
// weight for an item[i] to be summed up, upper limited = m
int weight[N] = {5,2,4,3};
// two values for each items:
int values[2][N] = {
{1,3,5,2},
{6,3,2,4}
};
The knapsack is to be filled with the items, without exceeding weight "m" for the sum of weight for all items in the knapsack. Where you have 2 values for each item. We could regard this problem like:
I want to go on vacation by plane with my girlfriend. And we have one suitecase (=knapsack) and N items to choose from. Each item has a weight and the sum of the weight may not be too height (e.g. weight limit air line is 25 kg and suirecase is 1kg, so we have m=24 kg as a limit for items). For each item we have 2 values. The values[1][N] are the values for me (for having item n in the knapsack on our tour). The values[2][N] are the values for my girlfriend, who has different preferences. We also assume, that every item can be put only once into the knapsack and that the overall value of the knapsack is the sum of their values for me added to the sum of their values for her.
This problem can easily converted to the standard knapsack problem by just adding up the values-list. So an item gets an overall value (e.g. for me and her together) and we only have one value for one item:
int value[N] = {(1+6),(3+3),(5+2),(2+4)};
Or just:
int value[N] = {7, 6, 7, 5};
Now you have only -one- value for each item. Which is the normal knapsack problem.
How to solve the usual knapsack problem optimally is described on Wikipedia. Have a look at http://en.wikipedia.org/wiki/Knapsack_problem -- If English is not your mother tongue, also take a look at a version in your language (choose language from the menu there).
If you need further assistance, just ask.

How to calculate average velocity for different acceleration?

I want to calculate average speed of the distance traveled using gps signals.
Is this formula calculates correct avg speed?
avgspeed = totalspeed/count
where count is the no.of gps signals.
If it is wrong,please any one tell me the correct formula.
While that should work, remember that GPS signals can be confused easily if you're in diverse terrain. Therefore, I would not use an arithmetic mean, but compute the median, so outliers (quick jumps) would not have such a big effect on the result.
From Wikipedia (n being the number of signals):
If n is odd then Median (M) = value of ((n + 1)/2)th item term.
If n is even then Median (M) = value of [((n)/2)th item term + ((n)/2
+ 1)th item term ]/2

Lucence SweetSpotSimilarity lengthNorm

http://lucene.apache.org/java/2_3_0/api/org/apache/lucene/misc/SweetSpotSimilarity.html
Implemented as: 1/sqrt( steepness * (abs(x-min) + abs(x-max) - (max-min)) + 1 ) .
This degrades to 1/sqrt(x) when min and max are both 1 and steepness is 0.5
Can anyone explain this formula for me? How steepness is decided and what is exactly referring to?
Any help is appreciated.
With the DefaultSimilarity, the shorter the field in terms of number of tokens, the higher the score.
e.g. if you have two docs, with indexed field values of "the quick brown fox" and "brown fox", respectively, the latter would score higher in a query for "fox".
SweetSpotSimilarity lets you define a "sweet spot" for the length of a field in terms of a range defined by min and max. Field lengths within the range will score equally, and field lengths outside the range will score lower, depending on the distance the length is form the range boundary. "steepness" determines how quickly the score degrades as a function of distance.