def n_feature_influence(estimators, n_train, n_test, n_features, percentile):
 percentiles = defaultdict(defaultdict)
 for n in n_features:
  print(('benchmarking with %d features' % n))
  (X_train, y_train, X_test, y_test) = generate_dataset(n_train, n_test, n)
  for (cls_name, estimator) in estimators.items():
   estimator.fit(X_train, y_train)
   gc.collect()
   runtimes = bulk_benchmark_estimator(estimator, X_test, 30, False)
   percentiles[cls_name][n] = (1000000.0 * scoreatpercentile(runtimes, percentile))
 return percentiles

def n_feature_influence ( estimators , n_train , n_test , n_features , percentile ) : percentiles = defaultdict ( defaultdict ) for n in n_features : print ( ( 'benchmarking with %d features' % n ) ) ( X_train , y_train , X_test , y_test ) = generate_dataset ( n_train , n_test , n ) for ( cls_name , estimator ) in estimators . items ( ) : estimator . fit ( X_train , y_train ) gc . collect ( ) runtimes = bulk_benchmark_estimator ( estimator , X_test , 30 , False ) percentiles [ cls_name ] [ n ] = ( 1000000.0 * scoreatpercentile ( runtimes , percentile ) ) return percentiles
estimate influence of the number of features on prediction time .