Closed ulupo closed 4 years ago
Another "solution" would be to make the outputs of transform
in the code for transform_plot
into dictionaries with the single key sample
(which could be non-zero). Not sure if more or less elegant! It would at least remove the need for sample_orig
completely...
Another "solution" would be to make the outputs of
transform
in the code fortransform_plot
into dictionaries with the single keysample
(which could be non-zero). Not sure if more or less elegant! It would at least remove the need forsample_orig
completely...
I don't understand why you wouldn't need sample_orig
. Wouldn't you need to pass the key to the VectorisationTransformer.plot
method anyway?
@wreise to make it clearer, this is the proposed fix: the code for transform_plot
would be
Xt = self.transform(X[sample:sample+1])
self.plot({sample: Xt[0]}, sample=sample, **plot_params).show()
return Xt
Then you have to change nothing else, I claim. At least in the majority of cases...
@wreise to make it clearer, this is the proposed fix: the code for
transform_plot
would beXt = self.transform(X[sample:sample+1]) self.plot({sample: Xt[0]}, sample=sample, **plot_params).show() return Xt
IMO, this looks better, even though we feed a dict instead of a ndarray
. The "problem" appears only when joining transform
on a single sample and plot, and it should be fixed there.
Then you have to change nothing else, I claim. At least in the majority of cases...
Maybe I can test that?
Maybe I can test that?
Oh please!! :) Feel free to take over this PR. I'm happy to proceed with the dict route.
Reference issues/PRs Fixes a bug introduced in #453.
Types of changes
Description In #453, automatic titles were introduced for several (but not all)
plot
methods. However, this leads to incorrectly reported sample indices when coming fromtransform_plot
of the latter's internal logic. This PR keeps titles but fixes them by modifying thetransform_plot
method ofPlotterMixin
s so thatplot
is called not on an array of length 1 but on a dictionary with a single key:becomes
Checklist
flake8
to check my Python changes.new andexisting tests passed. I usedpytest
to check this on Python tests.