How to extract input data just knowing the output values?

I would like to inquire, how may i extract input data from a given dataset (I guess it is similar to data decomposition).
The goal is to decompose a dataset to extract the features?

For example: Extract individual components of the volume of rectangle prism (without the knowledge of the individual features like length, width, height).

Please do recommend best practice to carry out such operation.
Also, do suggest any learning material (book or article) which can lead me in right direction.

The example code for the analysis:

using DataFrames
mutable struct rect
    length
    breadth
    height
end
r = rect(rand(Int, 40), rand(Int, 40), rand(Int, 40))
volume(rect) = rect.length .* rect.breadth .* rect.height
volume_val = volume(r)
df = DataFrame(:length => r.length, :width=> r.width, :height=> r.height, :volume => volume_val)

# For this df dataframe, I would like to extract length, width and height from volume without the use of volume equation

Thanks in advance!

I’m not sure I understand the question - you have a single number (volume) which is the product of three other numbers (length, breadth, width) and you want to figure out which numbers were multiplied together to create the single number? This sounds to me like you’re trying to solve one equation with three unknowns?

3 Likes

Thanks for the response, Yes, indeed this is what I am trying to do!
Is there any approach you have in mind which can be applied to such operation ? (given I have an array of volume).

Perhaps it is easier to think about a simpler case. Consider two rectangles, 1 \times 4 and 2 \times 2. Both have area 4, and there are others too. Since there is more than one combination of side-lengths that can produce area 4, what answer would you like to get?

I’m guessing that perhaps you want to query the data frame using a particular output value (volume in this case) or range of output values in order to obtain the corresponding input data.

DataFrames provides the filter function, for example:

filter(:volume => >(500), df)

Will give rows of df where :volume>500 and similarly

filter(:volume => ==(500), df)

gives rows where :volume==500.

See the DataFrames tutorial for more details.

In addition, @where in DataFramesMeta provides similar functionality and Query provides many more options.

1 Like