Skip to content

Conversation

@aedpluto
Copy link

Description

Issue Solved

Type of Change

  • Adding a new entry

Checklist

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • I have linked any issues that are relevant to this PR in the Issues Solved section.

@CLAassistant
Copy link

CLAassistant commented Dec 16, 2025

CLA assistant check
All committers have signed the CLA.

@mamtawardhani mamtawardhani self-assigned this Dec 17, 2025
Updated the title to '.sigmoid()' and clarified the description of the sigmoid function.
Copy link
Collaborator

@mamtawardhani mamtawardhani left a comment

Choose a reason for hiding this comment

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

Hey @aedpluto, I've requested some changes in this entry, could you please check and tag me once those are done? Thank you! 😄

@@ -0,0 +1,45 @@
---
Title: '.sigmoid()'
Description: 'The sigmoid function is an S-shaped curve typically used in binary classification problems'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Description should always start with a verb, and this description is slightly incorrect. A correct example description could be: "Applies the sigmoid activation to each element of a tensor, mapping values to a range between 0 and 1."

Comment on lines 22 to 24
A **`.sigmoid()`** function is an S-shaped curve which maps any real-valued input to a bounded output, typically between 0 and 1. Sigmoid functions are regularly used as activation functions in non-linear classification problems, for example in neural networks, where the probability of a binary outcome is required.

Although there are a range of sigmoid functions, in the field of AI the sigmoid function is usually synonymous with the logistic function, which is bound between 0 and 1.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this be made better? It is modtly correct, but it needs a small adjustment for precision and tone, especially since this is about PyTorch’s .sigmoid() and not sigmoid functions in general. Example:

"The .sigmoid() function applies the sigmoid (logistic) function to each element of a tensor, producing an S-shaped curve that maps any real-valued input to a value between 0 and 1.

In machine learning, sigmoid is commonly used as an activation function in binary classification tasks, where outputs represent probabilities."

The formula for the sigmoid function is given by:
$$σ(x) = 1 / (1 + e^(-x))$$

## Examples
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
## Examples
## Example

x = torch.linspace(-10, 10, steps=400)
y = torch.sigmoid(x)

plt.plot(x.numpy(), y.numpy()
Copy link
Collaborator

Choose a reason for hiding this comment

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

The parenthesis are not closing and that will give an error, please fix that

plt.xlabel("x")
plt.ylabel("σ(x)")
plt.show()
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please attach the image of the output here, and I also suggest to add one more example that shows practical uses, example Applying .sigmoid() to a Tensor

Copy link
Author

Choose a reason for hiding this comment

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

Here's the image of the output.
sigmoid

@aedpluto
Copy link
Author

Hey @aedpluto, I've requested some changes in this entry, could you please check and tag me once those are done? Thank you! 😄

Many thanks - I've now updated the file with the changes. I just wanted to double check whether I tag you in a comment like this when I reupload the file or do I tag you somewhere else? (I'm very new to collaborating on GitHub so wanted to double check)

@aedpluto
Copy link
Author

@mamtawardhani I've tried to rebase onto the latest branch and pushed the updated commit. Please let me know if anything else is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants