File:Softplus.svg

Uploaded by Nbarth
Upload date 2024-07-17T03:32:58Z
MIME type image/svg+xml
Dimensions 636 × 344 px
File size 19.8 KB

Summary

Description
English: Plot of the softplus function and ramp function.
Date
Source

Own work

 
This vector image includes elements that have been taken or adapted from this file:
Logit.svg.
Author Nbarth
SVG development
InfoField
 The SVG code is valid.
 This plot was created with Matplotlib.
Source code
InfoField

Python code

Source code
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator

fig = plt.figure(figsize=(8, 5))
ax = fig.add_subplot(111)
ax.grid(which='major')
ax.grid(which='minor', linewidth=0.4)
ax.set_xlim(-3., 3)
ax.set_ylim(0., 3.)
ax.set_yticks([0, 1, 2, 3])
ax.xaxis.set_minor_locator(AutoMinorLocator(2))
ax.yaxis.set_minor_locator(AutoMinorLocator(2))
ax.set_aspect('equal')

# Softplus.
x = np.linspace(-3., 3., 100)
y = np.log(1. + np.exp(x))
ax.plot(x, y)

# Ramp, for reference.
x1 = np.linspace(-3., 0., 50)
y1 = np.zeros(50)
ax.plot(x1, y1, linestyle=(0, (5, 5)), color='black')
xy = np.linspace(0., 3., 50)
ax.plot(xy, xy, linestyle=(0, (5, 5)), color='black')

cm = 1/2.54
fig.savefig('softplus.svg', bbox_inches='tight')

# Google Colab
from google.colab import files
files.download('softplus.svg')

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Captions

Plot of the softplus function and ramp function.

Items portrayed in this file

depicts

16 July 2024

image/svg+xml

Category:Activation functions Category:CC-Zero Category:Self-published work Category:Valid SVG created with Matplotlib code Category:Vector images using elements from other vector images