[98867e]: / exp / nb_denoiser.py

Download this file

14 lines (11 with data), 412 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: dev_nb/denoiser.ipynb
from sklearn.decomposition import TruncatedSVD
def denoise(data):
svd = TruncatedSVD(n_components=1, n_iter=7, random_state=0)
svd.fit(data)
pc = svd.components_
data -= data.dot(pc.T) * pc
return data