Skip to content

Version 0.2 Compressor: Gaussian Compression Method #94

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

Merged
merged 19 commits into from
May 12, 2025
Merged

Conversation

TongtongJin
Copy link

The pull request includes two new files:

(1) Compressors/Gaussian.jl': Includes implementation of structures and multiplication functions for Gaussian compression method.

(2) test/Compressors/Gaussian.jl: Includes the tests for the multiplication functions, the data structures and the update/complete functions.

Base automatically changed from v0.2-init to v0.2-main March 17, 2025 17:25
@vp314 vp314 added the enhancement New feature or request label Mar 24, 2025
@TongtongJin TongtongJin changed the title added Gaussian compressor and the testing file Version 0.2 Compressor: Gaussian Compression Method Apr 4, 2025
@TongtongJin TongtongJin self-assigned this Apr 4, 2025
## Returns
- A `Gaussian` object.
"""

Copy link
Contributor

Choose a reason for hiding this comment

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

No white space

Copy link

codecov bot commented Apr 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@vp314 vp314 left a comment

Choose a reason for hiding this comment

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

Overall, a nice implementation. There are a few details that need to be changed to align with SparseSign, and a few stylistic changes requested.

Copy link
Contributor

@vp314 vp314 left a comment

Choose a reason for hiding this comment

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

Minor changes. Otherwise, the PR looks good. Some of the comments are about file naming conventions that should be discussed with Nathaniel.

"""
Gaussian <: Compressor

An implementation of the Gaussian compression method. This method forms a Gaussian sketch matrix
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is beyond the allowed character limit

- `compression_dim::Int64`, the target compression dimension.
- `n_rows::Int64`, the number of rows of the compression matrix.
- `n_cols::Int64`, the number of columns of the compression matrix.
- `scale::Number`, the standard deviation of Gaussian distribution during the compression matrix generation.
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is beyond the character limit

Comment on lines 2 to 5
Gaussian <: Compressor

An implementation of the Gaussian compression method. This method forms a Gaussian sketch matrix
with number of rows or number of columns setting as the compression dimension.
Copy link
Contributor

Choose a reason for hiding this comment

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

A simple description may be better. E.g., A specification for a Gaussian compressor.

end

function Gaussian(;
cardinality::Cardinality=Left(), compression_dim::Int64=2, type::Type{<:Number}=Float64
Copy link
Contributor

Choose a reason for hiding this comment

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

The arguments should be on individual lines to stay with the Blue style.

# Check on the compression dimension
function Gaussian(cardinality, compression_dim, type)
if compression_dim <= 0
throw(ArgumentError("Field 'Compression_dim' must be positive."))
Copy link
Contributor

Choose a reason for hiding this comment

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

Compresion_dim -> compression_dim

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this file name shouldb elower case to keep with the style of sparse_sign.jl

Copy link
Author

Choose a reason for hiding this comment

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

Changed into lower case

Copy link
Contributor

Choose a reason for hiding this comment

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

Should the file name be lower case?

Copy link
Author

Choose a reason for hiding this comment

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

Changed into lower case

typeof(compressor.cardinality) == Card
end

for type in [Bool, Int16, Int32, Int64, Float16, Float32, Float64]
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably do not want to test Bool or Integers, since this should not be allowed since we cannot generate a Gaussian random variable of this type.

Copy link
Author

Choose a reason for hiding this comment

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

Deleted Bool and integers.

@vp314 vp314 merged commit e938fc2 into v0.2-main May 12, 2025
5 checks passed
@vp314 vp314 deleted the v0.2-Gaussian branch May 12, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants