-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nb=0 #1172
base: dev
Are you sure you want to change the base?
nb=0 #1172
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1050,22 +1050,24 @@ def computing_indicator(Y, A_in, b, C, f, nb, method, dims, min_size, max_size, | |
px = (np.sum(dist_indicator, axis=1) > 0) | ||
not_px = ~px | ||
|
||
if nb>1: | ||
f = NMF(nb, init='nndsvda').fit(np.maximum(Y[not_px, :], 0)).components_ | ||
else: | ||
if Y.shape[-1] < 30000: | ||
f = Y[not_px, :].mean(0) | ||
if nb > 0: | ||
if nb > 1: | ||
f = NMF(nb, init='nndsvda').fit(np.maximum(Y[not_px, :], 0)).components_ | ||
else: | ||
print('estimating f') | ||
f = 0 | ||
for xxx in np.where(not_px)[0]: | ||
f += Y[xxx] | ||
f /= not_px.sum() | ||
|
||
f = np.atleast_2d(f) | ||
|
||
Y_resf = np.dot(Y, f.T) | ||
b = np.maximum(Y_resf, 0) / (np.linalg.norm(f)**2) | ||
if Y.shape[-1] < 30000: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may want to consider making this threshold overridable or at least less magical |
||
f = Y[not_px, :].mean(0) | ||
else: | ||
print('estimating f') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a few print statements in here -- in final draft convert to logger info or debug statements? |
||
f = 0 | ||
for xxx in np.where(not_px)[0]: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we give this variable a better name? |
||
f += Y[xxx] | ||
f /= not_px.sum() | ||
f = np.atleast_2d(f) | ||
Y_resf = np.dot(Y, f.T) | ||
b = np.maximum(Y_resf, 0) / (np.linalg.norm(f)**2) | ||
else: | ||
f = np.empty((0, Y.shape[-1]), dtype='float32') | ||
b = np.empty((Y.shape[0], 0), dtype='float32') | ||
C = np.maximum(csr_matrix(dist_indicator_av.T).dot( | ||
Y) - dist_indicator_av.T.dot(b).dot(f), 0) | ||
A_in = scipy.sparse.coo_matrix(A_in.astype(np.float32)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,7 +197,8 @@ def update_temporal_components(Y, A, b, Cin, fin, bl=None, c1=None, g=None, sn=N | |
|
||
A = scipy.sparse.hstack((A, b)).tocsc() | ||
S = np.zeros(np.shape(Cin)) | ||
Cin = np.vstack((Cin, fin)) | ||
if fin is not None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a comment explaining how this works? |
||
Cin = np.vstack((Cin, fin)) | ||
C = Cin.copy() | ||
nA = np.ravel(A.power(2).sum(axis=0)) + np.finfo(np.float32).eps | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the
selem
keyword was deprecated at scikit learn, and we still have it, it might be nice to define what it means in this function: e.g., in the docs for it maybe just mention it stands for 'structuring element'There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean skimage? I remember playing with this years ago, it means something like the "where stuff is multiplier" =S
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes oops scikitimage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this explains selem, the structuring element https://scikit-image.org/docs/stable/auto_examples/applications/plot_morphology.html