weighted-average

How to add a weighted average summary to a DevExpress XtraGrid?

The DevExpress Grid (XtraGrid) allows grids and their groups to have summary calculations. The available options are Count, Max, Min, Avg, Sum, None and Custom. Has anyone got some sample code that shows how to calculate a weighted average column, based upon the weightings provided as values in another column? ...

How to calculate scores?

Hi, This question is more related to logic than any programming language. If the question is not apt for the forum please do let me know and I will delete this. I have to write a logic to calculate scores for blogs for a Blog Award website. A blog may be nominated for multiple award categories and is peer-reviewed or rated by a Jury on ...

SQL Server AVG function oddity

I am seeing some odd behavior in SQL Server AVG calcuation. On manual calculation, you get 49.277588 but SQL Server is reporting that the average is 50.9914 as shown below. Question: Can someone explain the difference and why this is happening? You can try out the query on AdventureWorks2008 Database with following query select C.P...

Adjust items chance to be selected from a list

I have a list of items. When I create the list each item has equal chance to be selected. But as an item is selected its chance goes down while the others chance goes up. If a new item is added during the process, it should have the highest chance to be selected with its chances falling off as it is selected. I am looking for a good ...

MySQL Rating/Voting system (accurratly ordering by best rated taking into account number of votes)

Let's say I have a MySQL table that is something like this: software table: id int name text votes int rating int Where votes would be the number of times someone has voted for that item and rating would be the average of those votes. Example data: id: 0 name: FooBar! votes: 5 rating: 3 Now another user comes along and rates this...

Weighted Average and Ratings

Maths isn't my strong point and I'm at a loss here. Basically, all I need is a simple formula that will give a weighted rating on a scale of 1 to 5. If there are very few votes, they carry less influence and the rating pressess more towards the average (in this case I want it to be 3, not the average of all other ratings). I've tried a...

Weighted Average with LINQ

My goal is to get a weighted average from one table, based on another tables primary key. Example Data: Table1 Key WEIGHTED_AVERAGE 0200 0 Table2 ForeignKey LENGTH PCR 0200 105 52 0200 105 60 0200 105 54 0200 105 -1 0200 47 55 I need to get ...

Compute weighted averages for large numbers

I'm trying to get the weighted average of a few numbers. Basically I have: Price - 134.42 Quantity - 15236545 There can be as few as one or two or as many as fifty or sixty pairs of prices and quantities. I need to figure out the weighted average of the price. Basically, the weighted average should give very little weight to pairs...

How would YOU compute IMDB movie rating?

I'm doing this only for learning purposes. I've no intentions of reversing the methods of IMDB. I asked myself I owned IMDB or similar website. How would I compute the movie rating? All I can think of is Weighted Average(which is nothing but Arithmetic Mean) For a movie data provided below computation would be (38591*10 + 27994*9...

Weighted Average with a negative number

Let's say you need to display a graphical representation of how well a baseball team is doing (my software problem is not related to sports but...). Let say you chose that 25% of a gauge is related to the percentage of batters who hit during the first time at bat. The next 25% related to the percentage of pitchers on the team who threw ...

How to aggregate timeseries in Python?

I have two different timeseries with partially overlapping timestamps: import scikits.timeseries as ts from datetime import datetime a = ts.time_series([1,2,3], dates=[datetime(2010,10,20), datetime(2010,10,21), datetime(2010,10,23)], freq='D') b = ts.time_series([4,5,6], dates=[datetime(2010,10,20), datetime(2010,10,22), datetime(2010...