def akaike_info_criterion(log_likelihood, n_params, n_samples):
 if ((n_samples / float(n_params)) >= 40.0):
  aic = (2.0 * (n_params - log_likelihood))
 else:
  aic = ((2.0 * (n_params - log_likelihood)) + (((2.0 * n_params) * (n_params + 1.0)) / ((n_samples - n_params) - 1.0)))
 return aic

def akaike_info_criterion ( log_likelihood , n_params , n_samples ) : if ( ( n_samples / float ( n_params ) ) >= 40.0 ) : aic = ( 2.0 * ( n_params - log_likelihood ) ) else : aic = ( ( 2.0 * ( n_params - log_likelihood ) ) + ( ( ( 2.0 * n_params ) * ( n_params + 1.0 ) ) / ( ( n_samples - n_params ) - 1.0 ) ) ) return aic
computes the akaike information criterion .