|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Offensive Power Rankings for 2008
To build on what others have said about the shortcommings of the OPR, watching the actual matches is a ton better than just looking at the OPR. The OPR attempts to predict how well a team scores per match, and is just decent at it. Relying on only the OPR is like a weatherman predicting the weather simply looking at on the month's average weather, instead of actually looking at the weather patterns, air pressure and all the other stuff weather people look at when making the forcast. By looking at the averages I'll know tommorrow it will be fairly warm, but won't tell me if I should bring a jacket, umbrella or sunglasses. OPR is nice because it gives a rough or general idea about a team very quickly and easily, but to get a good idea about a team, you need to actually watch thier matches.
I would use it only in prescouting where there is no matchs online of the team. In this situation it is better than no information at all. EDIT: One of the shortcommings is that the OPR attempts to predict something that can be found--the team's contribution to thier alliance--by watching the team's matches. It is nice that is very easy to find, but its not like it is predicting something that we cannot find. Last edited by XaulZan11 : 07-04-2008 at 13:53. |
|
#2
|
|||||
|
|||||
|
Re: Offensive Power Rankings for 2008
Quote:
|
|
#3
|
|||
|
|||
|
A little off topic, but how did our team drop points, when we havn't played a regional? From 37.472 to 32.54432471???
Our last regional was GLR ?????? |
|
#4
|
|||||
|
|||||
|
Re: Offensive Power Rankings for 2008
Do you understand the math behind the rankings? Your apparent drop can be explained easily if some of the teams you played with scored more points in later regionals. The algorithm doesn't account for different strengths at different times for the same team. It would tend to overcount an improving team's contribution to earlier matches, and thus undercount its partners' contribution.
|
|
#5
|
||||
|
||||
|
Re: Offensive Power Rankings for 2008
Same thing happened to us too, that happens if you performed better at a previous regional as opposed to your last one.
|
|
#6
|
||||
|
||||
|
Re: Offensive Power Rankings for 2008
Someone (don't know if he wants to be revealed) via PM requested the algorithm I've been using, which meant I had to clean my code, which means I'm not as embarrassed to post it.
So here it is: Code:
// opr.cpp : Defines the entry point for the console application.
//
#include "stdafx.h" // if you're not using visual studio, you'll probably have to toast this line
#include <fstream>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include "jama/jama_lu.h"
using namespace std;
struct Match
{
Match()
{
memset(this,0,sizeof(Match));
}
int blue[3];
int red[3];
int blueScore;
int redScore;
};
// reads all the match data from files copy/pasted from usfirst.org into a list of Match structures
// note that week 1, 2008 files can't be read unmodified by this function
// what I've been doing is pre-processing them doing a find-replace on AM and PM and adding " X " so that they have the right number of tab-seperated values
void ReadTeamData(string strFile,vector<Match>& lstMatches,set<int>& setTeams)
{
ifstream inFile;
inFile.open(strFile.c_str());
if(inFile.fail())
{
cout<<"Error opening file"<<endl;
return;
}
//int iTheoryMatchNum = 0;
while(!inFile.eof())
{
char buf[512];
Match aNewMatch;
inFile>>buf; // "9:20"
inFile>>buf; // "AM/PM"
inFile>>buf; // match number
inFile>>buf; // red 1
aNewMatch.red[0] = atoi(buf);
inFile>>buf; // red 2
aNewMatch.red[1] = atoi(buf);
inFile>>buf; // red 3
aNewMatch.red[2] = atoi(buf);
inFile>>buf; // blue 1
aNewMatch.blue[0] = atoi(buf);
inFile>>buf; // blue 2
aNewMatch.blue[1] = atoi(buf);
inFile>>buf; // blue 3
aNewMatch.blue[2] = atoi(buf);
inFile>>buf;
aNewMatch.redScore = atoi(buf);
inFile>>buf;
aNewMatch.blueScore = atoi(buf);
if(aNewMatch.redScore < 0 || aNewMatch.redScore > 168 || aNewMatch.blueScore < 0 || aNewMatch.blueScore > 168)
{
cout<<"Warning. Score of "<<aNewMatch.redScore<<" or of "<<aNewMatch.blueScore<<" is unexpectedly large or small. The input file may be badly formatted"<<endl;
}
if(!setTeams.count(aNewMatch.red[0])) setTeams.insert(aNewMatch.red[0]);
if(!setTeams.count(aNewMatch.red[1])) setTeams.insert(aNewMatch.red[1]);
if(!setTeams.count(aNewMatch.red[2])) setTeams.insert(aNewMatch.red[2]);
if(!setTeams.count(aNewMatch.blue[0])) setTeams.insert(aNewMatch.blue[0]);
if(!setTeams.count(aNewMatch.blue[1])) setTeams.insert(aNewMatch.blue[1]);
if(!setTeams.count(aNewMatch.blue[2])) setTeams.insert(aNewMatch.blue[2]);
lstMatches.push_back(aNewMatch);
}
}
// generates a mapping from team #s to row#s and the reverse
void GenerateTeamToRow(const set<int> setTeams,map<int,int>& mapTeamToRow,map<int,int>& mapRowToTeam)
{
int iCounter = 0;
for(set<int>::const_iterator i = setTeams.begin();i != setTeams.end();i++)
{
mapTeamToRow[*i] = iCounter;
mapRowToTeam[iCounter] = *i;
iCounter++;
}
}
// increments the symmetric points in a matrix to indicate that a pair of teams played with each other
void IncMatrix(TNT::Array2D<double>& M,map<int,int> mapTeamToRow,int iTeam1,int iTeam2)
{
int iRow1 = mapTeamToRow[iTeam1];
int iRow2 = mapTeamToRow[iTeam2];
M[iRow1][iRow2]++;
if(iRow1 != iRow2)
{
M[iRow2][iRow1]++;
}
}
// increments each team's score for all members of an alliance
void IncScore(TNT::Array1D<double>& S,map<int,int> mapTeamToRow,int aTeams[3],int iScore)
{
for(int x = 0;x < 3;x++)
{
int iRow = mapTeamToRow[aTeams[x]];
S[iRow] += iScore;
}
}
// generates our M and S data. M is an NxN matrix where each cell(i,j) represents how many times team i played with team j
void GenerateBasicMatrix(const vector<Match>& lstMatches,const map<int,int> mapTeamToRow,TNT::Array2D<double>& M,TNT::Array1D<double>& S)
{
// assertion: M should be fully zeroed at this point
for(int x = 0;x < lstMatches.size();x++)
{
Match m = lstMatches[x];
IncMatrix(M,mapTeamToRow,m.red[0],m.red[0]);
IncMatrix(M,mapTeamToRow,m.red[1],m.red[1]);
IncMatrix(M,mapTeamToRow,m.red[2],m.red[2]);
IncMatrix(M,mapTeamToRow,m.red[0],m.red[1]);
IncMatrix(M,mapTeamToRow,m.red[0],m.red[2]);
IncMatrix(M,mapTeamToRow,m.red[1],m.red[2]);
IncMatrix(M,mapTeamToRow,m.blue[0],m.blue[0]);
IncMatrix(M,mapTeamToRow,m.blue[1],m.blue[1]); // teams play with themselves too!
IncMatrix(M,mapTeamToRow,m.blue[2],m.blue[2]);
IncMatrix(M,mapTeamToRow,m.blue[0],m.blue[1]);
IncMatrix(M,mapTeamToRow,m.blue[0],m.blue[2]);
IncMatrix(M,mapTeamToRow,m.blue[1],m.blue[2]);
IncScore(S,mapTeamToRow,m.red,m.redScore);
IncScore(S,mapTeamToRow,m.blue,m.blueScore);
}
}
// zeroes out M
void InitMatrix(TNT::Array2D<double>& M)
{
for(int x = 0;x < M.dim1();x++)
{
for(int y = 0;y < M.dim2();y++)
{
M[x][y] = 0;
}
}
}
// zeroes out S
void InitS(TNT::Array1D<double>& S)
{
for(int x = 0;x < S.dim1();x++)
{
S[x] = 0;
}
}
// loads all the teams going to championships
void LoadCMPTeams(string strFile,set<int>& lstTeams)
{
ifstream inF;
inF.open(strFile.c_str());
if(inF.fail())
{
cerr<<"Failure at opening "<<strFile<<endl;
}
while(!inF.eof())
{
int iTeam;
inF>>iTeam;
lstTeams.insert(iTeam);
}
}
// reads in the list of regional files that we need to process
void ReadFileList(string strInput,vector <string>& lstFiles)
{
ifstream inF;
inF.open(strInput.c_str());
while(!inF.eof())
{
string str;
inF>>str;
lstFiles.push_back(str);
}
}
// writes the power ratings to <strFile>.out
void WritePowerRatings(string strFile,map<int,int> mapRowToTeam,Array1D<double> PowerRatings)
{
ofstream outF;
string strOutFile = strFile + ".out";
outF.open(strOutFile.c_str());
for(int x = 0;x < PowerRatings.dim();x++)
{
int iTeam = mapRowToTeam[x];
outF<<iTeam<<"\t"<<PowerRatings[x]<<endl;
}
outF.close();
}
int main(int argc, char* argv[])
{
if(argc != 2)
{
cout<<"Wrong number of arguments for scripted running, defaulting to using reglist.txt"<<endl;
argv[1] = "reglist.txt";
}
vector <string> lstFiles; // all the regional text files to process
map<int,double> mapTeamToTopScore;
map<int,double> mapTeamToLastScore;
map<int,string> mapTeamToBestReg;
map<int,string> mapTeamToLastReg;
map<int,bool> mapTeamToBestSet;
map<int,int> mapTeamToRegCount;
set<int> setAllTeams; // all teams
set <int> lstChamps; // teams going to champs
ReadFileList(argv[1],lstFiles);
LoadCMPTeams("c:\\cmpTeams.txt",lstChamps); // list of teams going to championships. If this vector has more than zero entries, then we only print out data for teams going to champs
for(int x = 0;x < lstFiles.size();x++)
{
set<int> setTeams;
map<int,int> mapTeamToRow;
map<int,int> mapRowToTeam;
vector<Match > lstMatches;
string strFile;
strFile = lstFiles[x];
ReadTeamData(strFile,lstMatches,setTeams); // reads match data
GenerateTeamToRow(setTeams,mapTeamToRow,mapRowToTeam); // maps each team to a number between 0 and N-1
TNT::Array2D<double> M(setTeams.size(),setTeams.size()); // M
TNT::Array1D<double> S(setTeams.size()); // S
InitMatrix(M);
InitS(S);
GenerateBasicMatrix(lstMatches,mapTeamToRow,M,S); // makes M from the match list data
JAMA::LU<double> aMatrixSolver(M);
Array1D<double> PowerRatings = aMatrixSolver.solve(S); // solves MO = S. PowerRatings = solved O
WritePowerRatings(strFile,mapRowToTeam,PowerRatings); // writes the output for this regional to <strFile>.out
// records a team's last and best power ratings
for(int x = 0;x < PowerRatings.dim();x++)
{
if(lstChamps.size() == 0 || lstChamps.count(mapRowToTeam[x]))
{
double dPwr = PowerRatings[x];
int iTeam = mapRowToTeam[x];
if(setAllTeams.count(iTeam) == 0) // if this team hasn't made it into our list of all teams, add it
{
setAllTeams.insert(iTeam);
}
mapTeamToRegCount[iTeam]++;
if(dPwr > mapTeamToTopScore[iTeam] || mapTeamToBestSet[iTeam] == false)
{
mapTeamToTopScore[iTeam] = dPwr;
mapTeamToBestReg[iTeam] = strFile;
mapTeamToBestSet[iTeam] =true;
}
mapTeamToLastScore[iTeam] = dPwr;
mapTeamToLastReg[iTeam] = strFile;
}
}
} // end of file loop
// this prints out a team's last OPR and where it occurred. If a team's best OPR occurred elsewhere, it prints that out
cout<<"Team\tRegional Count\tLast OPR\tLast Regional\tBest OPR\tBest Regional"<<endl;
for(set<int>::iterator i = setAllTeams.begin();i != setAllTeams.end();i++)
{
int iTeam = *i;
cout<<iTeam<<"\t"<<mapTeamToRegCount[iTeam]<<"\t"<<mapTeamToLastScore[iTeam]<<"\t"<<mapTeamToLastReg[iTeam];
cout<<"\t"<<mapTeamToTopScore[iTeam]<<"\t"<<mapTeamToBestReg[iTeam];
cout<<endl;
}
return 0;
}
-Reglist.txt - a list of regional data to be processed. One file per line. Note that it will output a file for each file in this list, and that will be the OPR for that regional -cmpteams.txt - A list of teams that you're interested in (for example, a list of teams going to championships). One team per line. -the JAMA math library (see attached file). This is from the NIST, it should be ok to redistribute. You can get the actual file here: http://math.nist.gov/tnt/download.html ------------ Licensing: None, do whatever you want with it. Feel free to give me credit or something though (but you don't have to, if it'd cramp your style). |
|
#7
|
|||||
|
|||||
|
Re: Offensive Power Rankings for 2008
http://www.thebluealliance.net/cdvid...08_matches.csv
Match dump including New York City regional. Includes column with event name and event week. Provides column with competition level (to filter out elims, if you want) and match number (probably not useful). Filters out matches with incomplete information. |
|
#8
|
|||
|
|||
|
Re: Offensive Power Rankings for 2008
With Greg's new dump, I'm proud to present: my complete OPR rankings. These include every match in the TBA system, including eliminations, broken down as follows: one sheet overall, one sheet for each week, two combined sheets (combining the weekly and overall rankings): one normal, and one with repeats in the top 50 or so color labeled.
Note: the following includes teams' overall performances as well as their weekly ones. If you wish to disregard the overall ones, subtract one from all numbers ![]() 1114 have the top 3 and 4 out of the top 10 performances overall. 233 have 2 out of the top 10, as do 2056. 330, 987, and 2056 also all have 3 in the top 20, with 39 having 2. Other notable repeats include 217 (3 performances in the 21-42 range), 67 (same), 525 (same), 1124 (2 in 21-41), 40 (same), 1625 (2 in top 50), 103 (same, including the 13th best). Here are the top 50 performances, be them weekly or overall: Code:
1114 78.07555206 5 1114 71.72841092 4 1114 66.08610526 All 233 54.83482914 5 2056 54.18143261 All 40 52.36761871 5 39 52.02981858 5 233 51.19444477 All 2056 50.85653031 5 1114 49.80987076 1 330 49.67085518 4 987 49.49921146 2 103 49.17875705 5 330 48.61508348 All 987 48.54535978 5 987 48.4036174 All 2056 48.14940049 4 39 48.05951704 All 330 47.6733788 2 525 47.50920616 5 217 47.21258553 3 79 46.85564663 3 1731 46.67751354 4 217 46.39477357 5 525 45.53997317 All 254 45.22118025 5 2171 44.91825888 4 1024 44.74816411 4 67 44.18768501 All 175 43.88978378 3 1124 43.87787986 3 27 43.73318232 5 1625 42.9666571 5 1731 42.93375969 All 67 42.26870256 5 217 42.11651285 All 1124 41.9143175 All 1717 41.6884957 4 67 41.29809056 2 25 41.18181687 5 40 40.80843761 All 525 40.68607417 1 1625 40.49393267 3 494 40.49077186 5 103 40.01593827 All 93 39.93271964 5 968 39.86958078 2 233 39.20154265 3 175 39.16106424 All 469 39.06852953 3 Enjoy ![]() |
|
#9
|
||||
|
||||
|
Re: Offensive Power Rankings for 2008
Great data... you can definitely see an improvement among teams over the weeks.
|
|
#10
|
||||||
|
||||||
|
Re: Offensive Power Rankings for 2008
Here's a theoretical and completely meaningless divisional breakdown for Championships based solely on Bongle's final OPR's and the current 339-team list (sort all teams by OPR, then go (A, C, G, N), (A, C, G, N), etc.
Even if FIRST went with this off the wall sorting system, the addition of the final few teams would skew the arrangement. Code:
330 Newton 67 Newton 103 Newton 469 Newton 1024 Newton 368 Newton 1625 Newton 93 Newton 16 Newton 1629 Newton 71 Newton 1156 Newton 45 Newton 703 Newton 1592 Newton 237 Newton 501 Newton 816 Newton 100 Newton 176 Newton 222 Newton 384 Newton 1350 Newton 364 Newton 2165 Newton 316 Newton 1 Newton 1528 Newton 1598 Newton 488 Newton 1756 Newton 2455 Newton 461 Newton 1983 Newton 116 Newton 57 Newton 503 Newton 177 Newton 107 Newton 418 Newton 312 Newton 401 Newton 2483 Newton 801 Newton 2520 Newton 1939 Newton 476 Newton 1023 Newton 499 Newton 1646 Newton 2340 Newton 120 Newton 1143 Newton 1296 Newton 701 Newton 2352 Newton 1594 Newton 302 Newton 2454 Newton 2557 Newton 2591 Newton 207 Newton 1212 Newton 1732 Newton 2237 Newton 2023 Newton 2038 Newton 2556 Newton 2410 Newton 2424 Newton 2575 Newton 1071 Newton 2354 Newton 433 Newton 228 Newton 900 Newton 599 Newton 1599 Newton 1266 Newton 752 Newton 296 Newton 677 Newton 1595 Newton 1795 Newton 233 Galileo 525 Galileo 40 Galileo 20 Galileo 1717 Galileo 968 Galileo 365 Galileo 47 Galileo 1806 Galileo 195 Galileo 27 Galileo 1065 Galileo 1574 Galileo 111 Galileo 357 Galileo 70 Galileo 2337 Galileo 179 Galileo 234 Galileo 2046 Galileo 692 Galileo 358 Galileo 1989 Galileo 2024 Galileo 2604 Galileo 292 Galileo 435 Galileo 2468 Galileo 201 Galileo 932 Galileo 1261 Galileo 1429 Galileo 1388 Galileo 236 Galileo 231 Galileo 1474 Galileo 2624 Galileo 612 Galileo 192 Galileo 2122 Galileo 180 Galileo 2638 Galileo 1902 Galileo 1503 Galileo 1094 Galileo 2518 Galileo 2335 Galileo 2668 Galileo 2344 Galileo 329 Galileo 2377 Galileo 1138 Galileo 2474 Galileo 597 Galileo 1165 Galileo 1014 Galileo 115 Galileo 1013 Galileo 1566 Galileo 1533 Galileo 1366 Galileo 548 Galileo 1323 Galileo 547 Galileo 527 Galileo 462 Galileo 122 Galileo 1868 Galileo 340 Galileo 2053 Galileo 75 Galileo 1254 Galileo 269 Galileo 457 Galileo 1033 Galileo 1398 Galileo 2543 Galileo 1739 Galileo 1577 Galileo 1522 Galileo 922 Galileo 86 Galileo 2621 Galileo 422 Galileo 509 Galileo 2056 Curie 39 Curie 1124 Curie 191 Curie 141 Curie 1126 Curie 2171 Curie 254 Curie 1477 Curie 343 Curie 41 Curie 148 Curie 121 Curie 1662 Curie 768 Curie 1540 Curie 2016 Curie 2062 Curie 341 Curie 2549 Curie 2590 Curie 555 Curie 88 Curie 386 Curie 716 Curie 375 Curie 573 Curie 288 Curie 1319 Curie 1802 Curie 2472 Curie 66 Curie 949 Curie 48 Curie 68 Curie 84 Curie 155 Curie 108 Curie 2081 Curie 65 Curie 271 Curie 1504 Curie 2609 Curie 2550 Curie 812 Curie 686 Curie 1357 Curie 425 Curie 294 Curie 1318 Curie 1699 Curie 2342 Curie 1860 Curie 1245 Curie 1305 Curie 2415 Curie 1108 Curie 1386 Curie 135 Curie 128 Curie 2564 Curie 1747 Curie 8 Curie 2614 Curie 2599 Curie 1538 Curie 587 Curie 1758 Curie 1311 Curie 1834 Curie 159 Curie 1102 Curie 2115 Curie 1941 Curie 1547 Curie 2338 Curie 226 Curie 858 Curie 4 Curie 1523 Curie 303 Curie 2429 Curie 5 Curie 203 Curie 468 Curie 1114 Archimedes 987 Archimedes 217 Archimedes 175 Archimedes 79 Archimedes 1086 Archimedes 494 Archimedes 25 Archimedes 1251 Archimedes 33 Archimedes 1418 Archimedes 171 Archimedes 126 Archimedes 1218 Archimedes 326 Archimedes 118 Archimedes 337 Archimedes 395 Archimedes 1511 Archimedes 2487 Archimedes 359 Archimedes 291 Archimedes 397 Archimedes 694 Archimedes 1736 Archimedes 1649 Archimedes 1279 Archimedes 1746 Archimedes 1987 Archimedes 1690 Archimedes 894 Archimedes 1089 Archimedes 138 Archimedes 223 Archimedes 2214 Archimedes 842 Archimedes 1816 Archimedes 1025 Archimedes 60 Archimedes 11 Archimedes 830 Archimedes 1450 Archimedes 134 Archimedes 2449 Archimedes 102 Archimedes 85 Archimedes 980 Archimedes 2630 Archimedes 832 Archimedes 486 Archimedes 2166 Archimedes 2048 Archimedes 2437 Archimedes 440 Archimedes 1714 Archimedes 173 Archimedes 1038 Archimedes 1676 Archimedes 190 Archimedes 903 Archimedes 1727 Archimedes 1379 Archimedes 614 Archimedes 1885 Archimedes 399 Archimedes 49 Archimedes 322 Archimedes 2423 Archimedes 610 Archimedes 2430 Archimedes 178 Archimedes 224 Archimedes 1502 Archimedes 839 Archimedes 1127 Archimedes 967 Archimedes 87 Archimedes 2629 Archimedes 151 Archimedes 714 Archimedes 241 Archimedes 604 Archimedes 2041 Archimedes 868 Archimedes 1576 Archimedes |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 2006 Offensive Power Ratings | sw293 | General Forum | 16 | 10-05-2006 17:04 |
| Offense/Defense rankings for 1043 teams | Bongle | General Forum | 21 | 06-04-2006 19:58 |
| best offensive play | thatphotochick | General Forum | 6 | 04-04-2006 20:35 |
| Defensive or offensive? (to you) | Andrew Blair | Rules/Strategy | 17 | 23-03-2005 15:09 |
| Best Offensive Round | archiver | 2000 | 10 | 23-06-2002 22:37 |