[Insight-users] AdvanceOneStep in Class
GradientDescentOptimizer(itkGradientDescentOptimizer.cpp)
庄吓海(Xiahai Zhuang)
arhye at 163.com
Sun May 1 05:05:26 EDT 2005
/**
* Advance one Step following the gradient direction
*/
typedef Array< double> ParametersType;
ParametersType m_currentPosition;
void
GradientDescentOptimizer
::AdvanceOneStep( void )
{
itkDebugMacro("AdvanceOneStep");
....
ScalesType scales = this-> GetScales();
..
DerivativeType transformedGradient( spaceDimension );
for(unsigned int j = 0; j < spaceDimension; j++)
{
transformedGradient[j] = m_Gradient[j] / scales[j]; //?????????????????????? why here takes a (/scales[j])
} //as in method m_CostFunction-> GetValueAndDerivative(this-> GetCurrentPosition(), m_Value, m_Gradient )m_Gradient derivative
// m_Gradient is the derivative of MutualInformation with respect to transform parameters,
// why transformedGradient[j] = m_Gradient[j] / scales[j];
ParametersType newPosition( spaceDimension );
for(unsigned int j = 0; j < spaceDimension; j++)
{
newPosition[j] = currentPosition[j] +
direction * m_LearningRate * transformedGradient[j];
}
this-> SetCurrentPosition( newPosition );
this-> InvokeEvent( IterationEvent() );
}
致
礼!
庄吓海(Xiahai Zhuang)
arhye at 163.com
2005-05-01
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20050501/ba63ad1e/attachment.htm
More information about the Insight-users
mailing list