class SplinesDynamicModel( Modifiable,Dynamic,BasicSplinesModel ) | Source |
---|
BasicSplinesModel that is modifiable (knot locations) and dynamic (in number of knots)
Examples
knots = numpy.arange( 17, dtype=float ) * 10 # make equidistant knots from 0 to 160
csm = SplinesModel( knots=knots, order=2 )
print csm.getNumberOfParameters( )
18
# or alternatively
csm = SplinesModel( nrknots=17, order=2, min=0, max=160 ) # automatic layout of knots
print csm.getNumberOfParameters( )
18
# or alternatively
npt = 161 # to include both 0 and 160.
x = numpy.arange( npt, dtype=float ) # x-values
csm = SplinesModel( nrknots=17, order=2, xrange=x ) # automatic layout of knots
print csm.getNumberOfParameters( )
18
Attributes
- minKnots : int
minimum number of knots - maxDegree : int or None
maximum number of knots
Attributes from Modifiable
modifiable
Attributes from Dynamic
dynamic, ncomp (=degree+1), deltaNpar, minComp (=minDegree+1), maxComp (=maxDegree+1), growPrior
Attributes from SplinesModel
knots, order
Attributes from Model
npchain, parameters, stdevs, xUnit, yUnit
Attributes from FixedModel
npmax, fixed, parlist, mlist
Attributes from BaseModel
npbase, ndim, priors, posIndex, nonZero, tiny, deltaP, parNames
Limitations
Dont construct the knots so closely spaced, that there are no datapoints in between.
SplinesDynamicModel( modifiable=True, dynamic=True, growPrior=None, minKnots=2, maxKnots=None, minDistance=0.01, copy=None, **kwargs ) |
---|
Splines on a given set of knots and a given order.
The number of parameters is ( length( knots ) + order - 1 )
Parameters
- modifiable : bool
if True allow changement of the knot locations - dynamic : bool
if True allow growth and shrinkage of number of knots - minKnots : int
minimum number of knots (def=2) - maxKnots : None or int
maximum number of Knots - minDistance : float
minimum distance between knots, provided as fraction of average knot distance.
default is ( 0.01 * ( knots[-1] - knots[0] ) / nrknots ) - growPrior : None or Prior
governing the birth and death.
ExponentialPrior (scale=2) if maxDegree is None else UniformPrior - copy : PolynomialDynamicModel
model to copy
Parameters for SplinesModel
knots, order, nrknots, min, max, xrange
Raises
ValueError if not minKnots <= nrknots <= maxKnots
copy( modifiable=None, dynamic=None ) |
---|
baseName( ) |
---|
Returns a string representation of the model.
changeNComp( dn ) |
---|
grow( offset=0, rng=None, force=False, **kwargs ) |
---|
Parameters
- offset : int
index where the params of the Dynamic model start - rng : random number generator (obligatory)
to generate a new parameter. - force : bool
dont check maxKnots
Return
- bool : succes
shrink( offset=0, rng=None, **kwargs ) |
---|
Parameters
- offset : int
index where the params of the Dynamic model start - rng : random number generator
to generate a new parameter (obligatory)
Return
- bool : succes
vary( rng=None, location=None ) |
---|
varyAlt( offset=0, rng=None, **kwargs ) |
---|
Parameters
- offset : int
index where the params of the Modifiable model start - rng : RNG
random number generator - kwargs : keyword arguments
for specific implementations
Methods inherited from Modifiable, |
---|
Methods inherited from Dynamic, |
---|
- isDynamic( )
- setGrowPrior( growPrior=None, min=1, max=None, name="Comp" )
- setDynamicAttribute( name, value )
- alterParameterNames( dnp )
- alterParameterSize( dnp, offset, location=None, value=0 )
- alterParameters( param, location, dnp, offset, value=None )
- alterFitindex( findex, location, dnp, offset )
- shuffle( param, offset, np, rng )
Methods inherited from BasicSplinesModel |
---|
- makeBaseBasis( )
- makeDist( knotix )
- makePeriodicBasis( )
- normalizeBasis( basis )
- findParameters( knotix, dist, kpar=0 )
- baseResult( xdata, params )
- basePartial( xdata, params, parlist=None )
- makeKnotIndices( xdata )
- basicBlob( xdata, basis, x2k, poly )
- baseDerivative( xdata, params )
- baseParameterUnit( k )
Methods inherited from SplinesModel |
---|
Methods inherited from LinearModel |
---|
Methods inherited from Model |
---|
- chainLength( )
- isNullModel( )
- isolateModel( k )
- addModel( model )
- subtractModel( model )
- multiplyModel( model )
- divideModel( model )
- pipeModel( model )
- appendModel( model, operation )
- correctParameters( params )
- result( xdata, param=None )
- operate( res, pars, next )
- derivative( xdata, param, useNum=False )
- partial( xdata, param, useNum=False )
- selectPipe( ndim, ninter, ndout )
- pipe_0( dGd, dHdG )
- pipe_1( dGd, dHdG )
- pipe_2( dGd, dHdG )
- pipe_3( dGd, dHdG )
- pipe_4( dGdx, dHdG )
- pipe_5( dGdx, dHdG )
- pipe_6( dGdx, dHdG )
- pipe_7( dGdx, dHdG )
- pipe_8( dGdx, dHdG )
- pipe_9( dGdx, dHdG )
- shortName( )
- getNumberOfParameters( )
- numDerivative( xdata, param )
- numPartial( xdata, param )
- hasPriors( isBound=True )
- getPrior( kpar )
- setPrior( kpar, prior=None, **kwargs )
- getParameterName( kpar )
- getParameterUnit( kpar )
- getIntegralUnit( )
- setLimits( lowLimits=None, highLimits=None )
- getLimits( )
- hasLimits( fitindex=None )
- unit2Domain( uvalue, kpar=None )
- domain2Unit( dvalue, kpar=None )
- partialDomain2Unit( dvalue )
- nextPrior( )
- isMixed( )
- getLinearIndex( )
- testPartial( xdata, params, silent=True )
- strictNumericPartial( xdata, params, parlist=None )
- assignDF1( partial, i, dpi )
- assignDF2( partial, i, dpi )
- strictNumericDerivative( xdata, param )
Methods inherited from FixedModel |
---|
Methods inherited from BaseModel |
---|