Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RescaledZScore #289

Merged
merged 2 commits into from
Jul 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Transformations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ struct RescaledZScore{T, Z} <: AbstractNormalization
zscore :: Z
end

RescaledZScore(scale) = RescaledZScore(scale, nothing)
RescaledZScore(scale) = RescaledZScore(scale, ZScore())

compute_normalization(r::RescaledZScore, transformation, fts) =
RescaledZScore(r.scale, compute_normalization(r.zscore, transformation, fts))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a new RescaledZScore object, r.zscore == nothing causing compute_normalization to return nothing, leading to the data being untouched in line 228 where it is supposed to be normalized.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Maybe also safer to use the constructor

RescaledZScore(scale) = RescaledZScore(scale, ZScore())

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

RescaledZScore(r.scale, compute_normalization(ZScore(), transformation, fts))

function normalize!(data, normalization::RescaledZScore)
normalize!(data, normalization.zscore)
Expand Down