Skip to content
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

Create Sparsennetdemo.py #453

Merged
merged 5 commits into from
May 17, 2021
Merged

Create Sparsennetdemo.py #453

merged 5 commits into from
May 17, 2021

Conversation

karalleyna
Copy link
Collaborator

@karalleyna karalleyna commented May 10, 2021

Closes #210

I have implemented iterative soft-thresholding algorithm in order to obtain Figure 13.21(b) in the book.

indir

I have just changed the data synthesis part of the original code. Could you please review it? @murphyk @mjsML

Copy link
Member

@murphyk murphyk left a comment

Choose a reason for hiding this comment

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

It's not clear this is resulting in a sparse NN.
It seems we will need to play with lambda to get a sparse estimate that still fits reasonably.
It would be great to find a way to visualize the graph structure, perhaps using graphviz.
In the meantime, you can use this block to see if the parameter were sparse
'''
for p in params:
if len(p)==0: continue
p = p[0].flatten()
print(['{:0.2f}'.format(x) for x in p])
'''

@karalleyna
Copy link
Collaborator Author

I changed the data synthesis considering the original code and also added the code related to the diagram of sparse neural network. Figures I obtained are
Neural Network gv
indir

@karalleyna karalleyna requested a review from murphyk May 12, 2021 00:14
@murphyk
Copy link
Member

murphyk commented May 12, 2021

I cannot reproduce your example - it seems there is some non-determinism somwhere. Maybe just use jax RNG exclusively, and not mix with np.random.

@karalleyna
Copy link
Collaborator Author

I cannot reproduce your example - it seems there is some non-determinism somwhere. Maybe just use jax RNG exclusively, and not mix with np.random.

I removed all np.random in generate_data.

@murphyk murphyk merged commit db8521a into probml:master May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert sparseNnetDemo to python
2 participants