MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Slow performance gathering property data from fitted

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101076] Re: Slow performance gathering property data from fitted
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Tue, 23 Jun 2009 07:07:00 -0400 (EDT)
  • References: <200906200803.EAA16775@smc.vnet.net> <h1l40h$2c8$1@smc.vnet.net>

and

Timing[rsquares2 = (#["RSquared"]) & /@ models;] is 10% faster than

Timing[rsquares = Through[models@"RSquared"];]

though arguably less elegant.

Cheers -- Sjoerd

On Jun 21, 1:02 pm, DrMajorBob <btre... at austin.rr.com> wrote:
> Did you do something equivalent to this?
>
> data := Table[{3 + i + RandomReal[{-3, 7}],
>     i + RandomReal[{-2, 5}]}, {i, 1, 20}]
>
> Timing[models = Array[LinearModelFit[data, x, x] &, 70000];]
>
> {90.2283, Null}
>
> Timing[rsquares = Through[models@"RSquared"];]
>
> {40.3059, Null}
>
> ListPlot@rsquares
>
> Notice, the RSquare values came out faster than the model fitting.
>
> Bobby
>
> On Sat, 20 Jun 2009 03:03:15 -0500, Todd Allen <genesplice... at yahoo.com> 
> wrote:
>
>
>
>
>
> > Hi All,
>
> >    During some recent research I asked Mathematica to calculate 70, 000  
> > simple linear regression fits to 70,000 small datasets.  This worked 
> > well and resulted in a list of 70,000 fitted model objects being  
> > finished in under 5 minutes.
>
> >   My next step was to collect the RSquared property for each of the 
> > 70,000 fits contained in the list, and Mathematica took over 3 hours to
> > accomplish this.  This seems horrendously slow simply to gather values  
> > from a list.  Has anyone ran into a similar problem?  Any suggestions  
> > how I might be able to significantly speed the gathering of properties 
> > from large lists of fitted model objects?
>
> >   The snippet of code I was using to gather the RSquared values is below:
>
> > piedlrRsquared =
> >   Table[piedlrmodels[[i]]["RSquared"], {i, 1, Length[piedlrmodels]}] //
> >     Timing;
>
> >    Thanks for any advice you might have!
>
> > Todd
>
> --
> DrMajor... at bigfoot.com



  • Prev by Date: Re: Needs[], BeginPackage[], filename
  • Next by Date: Re: Putting an If in my function
  • Previous by thread: Re: Slow performance gathering property data from fitted
  • Next by thread: Re: Slow performance gathering property data from fitted objects