Skip to content

Commit

Permalink
Merge pull request #8 from JuliaTrustworthyAI/fix-docstrings
Browse files Browse the repository at this point in the history
updated project
  • Loading branch information
pat-alt authored Nov 13, 2024
2 parents 926f37c + 202ee77 commit 063f74e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Version [1.0.2] - 2024-11-13

### Added

- Improved some docstrings.

## Version [1.0.1] - 2024-10-26

### Added
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "EnergySamplers"
uuid = "f446124b-5d5e-4171-a6dd-a1d99768d3ce"
authors = ["Patrick Altmeyer and contributors"]
version = "1.0.1"
version = "1.0.2"

[deps]
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Expand Down
6 changes: 3 additions & 3 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ end
@doc raw"""
_energy(f, x, y::Int; agg=mean)
Computes the energy for conditional samples $x \sim p_{\theta}(x|y)$: $E(x)=- f_{\theta}(x)[y]$. $DOC_Grathwohl
Computes the energy for conditional samples $x \sim p_{\theta}(x|y)$: $E(x)=- f_{\theta}(x)[y]$. Here `f` is the model, `x` is the input and `y` is the **index** of the target label. $DOC_Grathwohl
"""
function _energy(f, x, y::Int; agg=mean)
if f isa Flux.Chain
Expand All @@ -52,7 +52,7 @@ end
@doc raw"""
energy_differential(f, xgen, xsampled, y::Int; agg=mean)
Computes the energy differential between a conditional sample ``x_{\text{gen}} \sim p_{\theta}(x|y)`` and an observed sample ``x_{\text{sample}} \sim p(x|y)`` as ``E(x_{\text{sample}}|y) - E(x_{\text{gen}}|y)`` with ``E(x|y) = -f_{\theta}(x)[y]``. $DOC_Grathwohl
Computes the energy differential between a conditional sample ``x_{\text{gen}} \sim p_{\theta}(x|y)`` and an observed sample ``x_{\text{sample}} \sim p(x|y)`` as ``E(x_{\text{sample}}|y) - E(x_{\text{gen}}|y)`` with ``E(x|y) = -f_{\theta}(x)[y]``. Here `f` is the model, `xgen` are the generated samples, `xsampled` are the observed training samples and `y` is the **index** of the target label. $DOC_Grathwohl
"""
function energy_differential(f, xgen, xsampled, y::Int; agg=mean)
neg_loss = _energy(f, xgen, y; agg=agg) # negative loss associated with generated samples
Expand All @@ -64,7 +64,7 @@ end
@doc raw"""
energy_penalty(f, xgen, xsampled, y::Int; agg=mean)
Computes the a Ridge penalty for the overall energies of the conditional samples ``x_{\text{gen}} \sim p_{\theta}(x|y)`` and an observed sample ``x_{\text{sample}} \sim p(x|y)``. $DOC_Grathwohl
Computes the a Ridge penalty for the overall energies of the conditional samples ``x_{\text{gen}} \sim p_{\theta}(x|y)`` and an observed sample ``x_{\text{sample}} \sim p(x|y)``. Here `f` is the model, `xgen` are the generated samples, `xsampled` are the observed training samples and `y` is the **index** of the target label. $DOC_Grathwohl
"""
function energy_penalty(f, xgen, xsampled, y::Int; agg=mean, p=1)
neg_loss = _energy(f, xgen, y; agg=agg) # negative loss associated with generated samples
Expand Down

2 comments on commit 063f74e

@pat-alt
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/119324

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.2 -m "<description of version>" 063f74eea08e41d4bf225bd09245175390d33dbe
git push origin v1.0.2

Please sign in to comment.