public static < T extends Trainable , TP extends Parameterizable > T create ( TP trainingParameters , Configuration configuration ) { try { Class < T > aClass = ( Class < T > ) trainingParameters . getClass ( ) . getEnclosingClass ( ) ; Constructor < T > constructor = aClass . getDeclaredConstructor ( trainingParameters . getClass ( ) , Configuration . class ) ; constructor . setAccessible ( true ) ; return constructor . newInstance ( trainingParameters , configuration ) ; } catch ( InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException ex ) { throw new RuntimeException ( ex ) ; } }
Creates a new algorithm based on the provided training parameters .