com.linkedin.dagli.tester.TransformerViewTestBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
DAG-oriented machine learning framework for bug-resistant, readable, efficient, maintainable and trivially deployable models in Java and other JVM languages
package com.linkedin.dagli.tester;
import com.linkedin.dagli.transformer.PreparedTransformer;
import com.linkedin.dagli.view.TransformerView;
import java.util.Collection;
/**
* Tests a {@link TransformerView}.
*
* @param the type of result produced by the {@link TransformerView}
* @param the type of {@link PreparedTransformer} viewed by this {@link TransformerView} (its "input")
*/
public final class TransformerViewTestBuilder, T extends TransformerView>
extends AbstractChildTestBuilder> {
/**
* Creates a new instance that will test the provided Dagli node.
*
* @param testSubject the primary test subject
*/
public TransformerViewTestBuilder(T testSubject) {
super(testSubject);
}
/**
* Adds an input (a prepared transformer to be viewed by the tested {@link TransformerView}).
*
* @param preparedTransformer the prepared transformer to be viewed
* @return this instance
*/
public TransformerViewTestBuilder input(N preparedTransformer) {
return addInput(preparedTransformer);
}
/**
* Adds multiple inputs (prepared transformers to be viewed by the tested {@link TransformerView}). Equivalent to
* calling {@link #input(PreparedTransformer)} for each element in inputs
.
*
* @param inputs the collection of inputs to add
* @return
*/
public TransformerViewTestBuilder allInputs(Collection extends N> inputs) {
return addAllInputs(inputs);
}
@Override
public void test() {
super.test();
checkInputsAndOutputsForAll((subject, viewed) -> subject.internalAPI().prepare(viewed));
checkInputsAndOutputsFor(withPlaceholderInputs(_testSubject),
(subject, viewed) -> subject.internalAPI().prepare(viewed));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy