Statistics Engine Development

Kshitiz_Indian

Executive member
Joined
Apr 9, 2006
Location
New Delhi, India
Alright then, this is the thread for the statistics team to discuss, and get new inputs from everyone. Here's the team structure.

Kshitiz_Indian (team leader)
Abhas
Harrypotter_fan

With me being a team leader for a first time, please bear with me if I'm not the best one! :p

We're firstly interested in getting some input from the Backend team I think, so we'll wait for that. In the meantime, we could all download the current SVN, which I have now done, so you can have a look at how exactly is the structure atm. Not that its filled though, its currently empty. :p But that's our job, to fill it.

If anyone has an input to make in the meantime please feel free to do so. And I wouldn't mind the thread to be stickied or else it might get lost! :)
 

Abhas

Retired Administrator
Joined
Aug 6, 2004
Location
New Delhi, India
These are the requirements for the stats team.

Statistics Team
Design
- Come up with a list of all records that will be stored
- Come up with a design for Statistics objects (that will be persisted) along with the Backend team
o Must separate FC, OD, Twenty20 stats
o Must separate International, Domestic stats
o Think about granularity when storing data (ball+by+ball vs. innings+by+innings vs. aggregate) and caching options
- Develop a design for query engine similar to StatsGuru but nowhere near as detailed
- Develop an intuitive API to fetch statistics... for example Player.Statistics.GetBattingAverage(Match.Types.FC , Match.Leagues.International) versus Player.GetTestBattingAverage() to get Test average
- Class/interface diagram of system
- Describe exception list
- Develop an API that will be used to update statistics (probably based off a Scorecard object -- discuss with Backend team)

Implementation
- Implement the design in the StatisticsEngine project

Testing
- Test engine with randomized data
- Test query engine with all possible queries
- Test queries that don't make sense, for example getting average over an impossible period
- Ensure that system works without the need for real data (should be completely modularized)

Abhas added 4 Minutes and 11 Seconds later...

I am part of both the stats, and the Backend, so i suppose, I'll be responsible for all the communication, and the integration as well.
 

Kshitiz_Indian

Executive member
Joined
Apr 9, 2006
Location
New Delhi, India
- Come up with a list of all records that will be stored

In regards to this, could someone who watches more Cricket than me help me a bit? The thing is, I'm more of a programmer, a coder, and I hardly watch Cricket, so I'm sure I would pretty much miss out things lol. :)
 

sohum

Executive member
Joined
Aug 3, 2004
Location
San Francisco, CA
Profile Flag
India
http://stats.cricinfo.com/ci/engine/current/records/index.html
I would use a subset of the records above. For example, the following at the very minimum (with each combination of match type and match league):

1. Highest/lowest team scores
2. Highest individual scores
3. Best bowling performance by innings
4. Highest aggregate of runs
5. Highest aggregate of wickets
6. Best economy
7. Best batting average
8. Best bowling average
9. Most number of 6s hit.
10. Fastest/slowest 50s.
11. Fastest/slowest 100s.
12. Best partnerships by wicket.

So each of these records would exist for 6 permutations: Domestic OD, ODI, FC, Test, Domestic T20, International T20.

I stress that you do not need to wait for the Backend team to provide you information. Rather, you have to give us the design of your object functionality and we will construct the relevant object and give it to you. You can then add a reference to the Backend project and use it. Make it as OO as possible--i.e. don't try to put all the functionality in a Statistics class.

Also, there are plenty of classes that you will have to write that will not depend on the Backend at all--such as the Statistics Engine. You will have to come up with a way to represent a query, a result set, etc. There is a lot to do without waiting for the Backend team to add your objects. ;)
 

Abhas

Retired Administrator
Joined
Aug 6, 2004
Location
New Delhi, India
hmm...
I'm getting a bit confused.. Sohum, can you please give us an example of how we are going to implement this?
 

Harrypotter_fan

Panel of Selectors
Joined
Sep 12, 2005
Location
Kolhapur, India
Online Cricket Games Owned
Lets get started guys. I think that the statistics engine will provide a function which returns a DataTable according to the arguments, right?
 

sohum

Executive member
Joined
Aug 3, 2004
Location
San Francisco, CA
Profile Flag
India
hmm...
I'm getting a bit confused.. Sohum, can you please give us an example of how we are going to implement this?
Let's say you have a statistics engine object, conveniently called StatisticsEngine. Perhaps it has a static method called Process which accepts a Scorecard object. A Scorecard object, in turn, will contain pieces such as BattingInnings and BowlingInnings.

So to add the statistics for a given match, you would do the following:

Code:
StatisticsEngine.Process(Match.Scorecard);

Now with querying, you could define a querying interface. Maybe you could have an IQuery interface and an IQueryable interface to demonstrate that a specific object can be queried. For example:

Code:
interface IQueryable {
  IQueryResultSet ExecuteQuery(IQuery query);
}

interface IQueryResultSet {
  public List<IQueryResultItem> Results { get; set; }
}

interface IQueryResultItem {
  public Integer Runs { get; }
  public Integer Balls { get; }
  public Integer Dots { get; }
  ...
}

Now imagine there is an IQuery implementation called TestStatistics. Using OOP, I should be able to do the following:

Code:
Team t = new Team(); // some random team
Tournament tm = new Tournament(); // some random tournament
Player p = new Player(); // some random player

IQueryResultSet t.ExecuteQuery(new TestStatistics()); // gets all test statistics for the team
IQueryResultSet tm.ExecuteQuery(new TestStatistics()); // gets the statistics for a test series
IQueryResultSet p.ExecuteQuery(new TestStatistics()); // gets test statistics for a player

sohummisra added 1 Minutes and 38 Seconds later...

Lets get started guys. I think that the statistics engine will provide a function which returns a DataTable according to the arguments, right?
DataTable would be a good data structure to transfer data between the StatisticsEngine and the Backend. But the StatisticsEngine should not give raw data tables to the rest of the components. It's preferable to wrap it in something such as an IQueryResultSet or some other custom data structure.
 

Kshitiz_Indian

Executive member
Joined
Apr 9, 2006
Location
New Delhi, India
I'll try and come up with a prototype DB structure to store records today. We're looking at MySQL aren't we? :)

Kshitiz_Indian added 2 Minutes and 13 Seconds later...

This is why I wanted to run away from C#! :p
Oh well, you can't win over everything in life. I'll try and get a hold of C# soon, though I am sure all this work would have hardly taken me much time to decipher! :p
 

Users who are viewing this thread

Top