Inverse Transforms in Neuraxle: How to Reverse a Prediction¶

This demonstrates how to make a prediction, and then to undo the prediction to get back the original inputs or an estimate of the original inputs. Not every pipeline steps have an inverse transform method, because not every operation is reversible.

import numpy as np

from neuraxle.pipeline import Pipeline
from neuraxle.steps.numpy import MultiplyByN

def main():
p = Pipeline([MultiplyByN(multiply_by=2)])

data_inputs = np.array([1, 2])
generated_outputs = p.transform(data_inputs)
regenerated_inputs = p.inverse_transform(generated_outputs)

assert np.array_equal(regenerated_inputs, data_inputs)
assert np.array_equal(generated_outputs, 2 * data_inputs)

if __name__ == "__main__":
main()


Total running time of the script: ( 0 minutes 0.052 seconds)

Gallery generated by Sphinx-Gallery