artemmalykh commented on a change in pull request #5767: [ML] IGNITE-10573:
Consistent API for Ensemble training
URL: https://github.com/apache/ignite/pull/5767#discussion_r247885899
##########
File path:
modules/ml/src/main/java/org/apache/ignite/ml/trainers/DatasetTrainer.java
##########
@@ -362,4 +362,29 @@ public EmptyDatasetException() {
}
}
+ /**
+ * Returns the trainer which returns identity model.
+ *
+ * @param <I> Type of model input.
+ * @param <L> Type of labels in dataset.
+ * @return Trainer which returns identity model.
+ */
+ public static <I, L> DatasetTrainer<IgniteModel<I, I>, L>
identityTrainer() {
+ return new DatasetTrainer<IgniteModel<I, I>, L>() {
+ @Override public <K, V> IgniteModel<I, I> fit(DatasetBuilder<K, V>
datasetBuilder,
+ IgniteBiFunction<K, V, Vector> featureExtractor,
+ IgniteBiFunction<K, V, L> lbExtractor) {
+ return x -> x;
+ }
+
+ @Override protected boolean checkState(IgniteModel<I, I> mdl) {
+ return true;
+ }
+
+ @Override protected <K, V> IgniteModel<I, I>
updateModel(IgniteModel<I, I> mdl, DatasetBuilder<K, V> datasetBuilder,
Review comment:
Fixed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services