submit code

This commit is contained in:
wangshuai6
2025-04-09 11:01:16 +08:00
parent 4fbcf9bd87
commit 06499f1caa
145 changed files with 14400 additions and 0 deletions

20
tools/sigmoid.py Normal file
View File

@@ -0,0 +1,20 @@
import numpy as np
import matplotlib.pyplot as plt
def lw(x, b=0):
x = np.clip(x, a_min=0.001, a_max=0.999)
snr = x/(1-x)
logsnr = np.log(snr)
# print(logsnr)
# return logsnr
weight = 1 / (1 + np.exp(-logsnr - b))#*(1-x)**2
return weight #/weight.max()
x = np.arange(0.2, 0.8, 0.001)
print(1/(x*(1-x)))
for b in [0, 1, 2, 3]:
y = lw(x, b)
plt.plot(x, y, label=f"b={b}")
plt.legend()
plt.show()