Go to Post An innovative strategy based off of good scouting beats a #1 alliance any day. - rufu5 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Old 01-01-2017, 18:17
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,994
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
fast OPR computation with R using sparse matrix technology


Thread created for discussion of this paper.


Reply With Quote
  #2   Spotlight this post!  
Old 01-01-2017, 19:27
brennonbrimhall brennonbrimhall is offline
Free Agent
AKA: Brennon Brimhall
no team
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Clifton Park, NY
Posts: 222
brennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to all
Re: fast OPR computation with R using sparse matrix technology

Thanks for posting this Ether. Out of curiosity, have you quantified the time savings?
__________________
Team 20, 2012-2014: 4 blue banners, 5 medals, and 9 team awards.
Church of Jesus Christ of Latter-day Saints, 2014-2016: Missionary, Colorado Denver South Mission.
Reply With Quote
  #3   Spotlight this post!  
Old 01-01-2017, 20:40
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,994
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: fast OPR computation with R using sparse matrix technology

Quote:
Originally Posted by brennonbrimhall View Post
Thanks for posting this Ether. Out of curiosity, have you quantified the time savings?
Look at the timings in the log file in the ZIP file.

Then compare those to this.


Reply With Quote
  #4   Spotlight this post!  
Unread 04-01-2017, 11:56
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,994
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: fast OPR computation with R using sparse matrix technology


Any questions?


Reply With Quote
  #5   Spotlight this post!  
Unread Yesterday, 13:27
Caleb Sykes's Avatar
Caleb Sykes Caleb Sykes is offline
Registered User
FRC #4536 (MinuteBots)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2009
Location: St. Paul, Minnesota
Posts: 1,029
Caleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond repute
Re: fast OPR computation with R using sparse matrix technology

Quote:
Originally Posted by Ether View Post

Any questions?


I don't have any experience with R (on my to do list though). Here is what I think is going on, please correct me if I am wrong.

Stacy Irwin used Rs "solve" method to calculate season OPRs, more info here. She created functions to generate the A and b matrices and used R's "solve" method to get OPRs. I'm having trouble finding good documentation on this method, the best I could get was this. The problem is that this method requires A to be square, which it isn't. This method seems to use LU decomposition. Solving for OPRs after creating the A and b matrices took approximately 3 seconds.

You used the sparseM package to calculate season OPRs. The key difference from Stacy's method was that you converted the A matrix into a sparse matrix and then used the slm method to get OPRs. This method uses Cholesky decomposition. Solving for OPRs after creating the A and b matrices took approximately 0.50 seconds.

These results are roughly in line with the fact that Cholesky decomposition is around twice as fast as LU decomposition.

Quote:
from Wikipedia

The [Cholesky decomposition] algorithms described below all involve about (n^3)/3 FLOPs, where n is the size of the matrix A. Hence, they are half the cost of the LU decomposition, which uses (2n^3)/3 FLOPs (see Trefethen and Bau 1997).
Reply With Quote
  #6   Spotlight this post!  
Unread Yesterday, 18:48
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,994
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: fast OPR computation with R using sparse matrix technology

Quote:
Originally Posted by Caleb Sykes View Post
The problem is that this method requires A to be square, which it isn't.
Stacy created N = A'A, which is square. See below.


Quote:
you converted the A matrix into a sparse matrix
No. I created a sparse matrix representation of the design matrix A directly from the raw qual score data, in one pass through the raw data, with no nested loops, and with no intermediate dense matrix. This is where the bulk of the time savings is. The b and T vectors are created in the same single pass that creates the sparse design matrix. See below.


Let A be the 17842-by-2696 dichotomous (ones and zeros) design matrix of the overdetermined linear system
corresponding to the raw qual match data (alliances & scores) in the file "8col Hill.dat".

Let b be the 17842-by-1 column vector of alliance scores

Let N be the 2696-by-2696 matrix of the coefficients of the normal equations N=A'A

Let d be A'b

Using Stacy's R code as a dense matrix performance baseline, it takes 10 seconds to create the N matrix and d vector, and another 3 seconds to compute the OPR from Nx=d

Using sparse matrix technology, it takes 0.68 seconds to create the b column vector and the sparse matrix A, and 0.27 seconds to compute OPR from Ax=b.



Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:40.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi