Add Scaled Sigmoid Link and Generic Inverse#80
Draft
simon-hirsch wants to merge 3 commits intomainfrom
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces two new scaled sigmoid link functions and a generic inverse link to facilitate function inversion.
- Added ScaledInverseSigmoidLink and ScaledSigmoidLink in sigmoidlinks.py with methods for the link, its inverse, and corresponding derivatives.
- Introduced a GenericInverseLink in generic.py to swap the link functions and derivatives.
- Updated init.py files to expose the new link functions and the GenericInverseLink.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/rolch/link/sigmoidlinks.py | Added implementations for two scaled sigmoid links with their respective methods. |
| src/rolch/link/generic.py | Added a GenericInverseLink class to invert provided link functions. |
| src/rolch/link/init.py | Updated module exports to include the new sigmoid links and generic inverse link. |
| src/rolch/init.py | Updated package exports to include the new link functions. |
Comments suppressed due to low confidence (2)
src/rolch/link/sigmoidlinks.py:38
- In ScaledInverseSigmoidLink.inverse_derivative, the multiplication by (self.upper - self.lower) and subsequent division by (self.upper - self.lower) cancel each other out. Simplify the expression to 'sigmoid(x) * (1 - sigmoid(x))' for clarity.
* (1 - sigmoid(x)) / (self.upper - self.lower)
src/rolch/link/sigmoidlinks.py:80
- In ScaledSigmoidLink.link_derivative, the factor (self.upper - self.lower) is multiplied then divided by the same term, resulting in redundancy. Consider simplifying the derivative to eliminate the unnecessary operations.
* (1 - sigmoid(x)) / (self.upper - self.lower)
BerriJ
reviewed
May 7, 2025
|
|
||
| Args: | ||
| link_function (LinkFunction): The Link function to invert | ||
| link_support (Tuple): The support of the link function |
Collaborator
There was a problem hiding this comment.
This is misleading, we want to pass the support of the inverted link function here, right?
Suggested change
| link_support (Tuple): The support of the link function | |
| link_support (Tuple): The support of the inverted link function |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Collaborator
|
This is a great Idea! However, before merging this I'd like to make the following changes:
For now, we should move this into the draft stage IMHO. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.