tensorflow / skflow

Simplified interface for TensorFlow (mimicking Scikit Learn) for Deep Learning
Apache License 2.0
3.18k stars 439 forks source link

Add example accessing of weights #111

Closed dvbuntu closed 8 years ago

dvbuntu commented 8 years ago

It wasn't clear how to access weights using classifier.get_tensor_value('foo') syntax. This adds some examples for the CNN model. They were figured out by logging the training as though for using TensorBoard, and then running strings on the logfile to look for the right namespace.

Is there a better way to access these weights? Or to learn their names? The logging must walk through the graph and record these names. Maybe if there were a way to quickly list all the names, that'd be enough for advanced users to figure it out.

googlebot commented 8 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


dvbuntu commented 8 years ago

Cool, I signed the CLA. Thanks for making a great wrapper on TF.

googlebot commented 8 years ago

CLAs look good, thanks!

codecov-io commented 8 years ago

Current coverage is 90.70%

Merging #111 into master will not affect coverage as of b77898d

@@            master   #111   diff @@
=====================================
  Files           27     27       
  Stmts         1044   1044       
  Branches       159    159       
  Methods          0      0       
=====================================
  Hit            947    947       
  Partial         46     46       
  Missed          51     51       

Review entire Coverage Diff as of b77898d

Powered by Codecov. Updated on successful CI builds.

terrytangyuan commented 8 years ago

I am not sure if this is the best place to put it. @ilblackdragon What do you think? Maybe a separate example?

ilblackdragon commented 8 years ago

Yeah, let's do a separate example or one of the iris_custom_model ones. Because the MNIST model is for comparison with examples from tensorflow, so it would be good to keep functionality similar.

dvbuntu commented 8 years ago

I'd prefer a different example to the iris ones. Those models only use limited customization, and figuring out how to extract the convolutional layers was the most unintuitive aspect of it. So maybe a new custom MNIST model would make sense; it doesn't actually have to be a good model, just demonstrate how to get at the weights.

terrytangyuan commented 8 years ago

That makes sense. Just make a separate example using MNIST and add a link to the README.md. Thanks! (It would be also great if you can squash your commits)

dvbuntu commented 8 years ago

Ok, I pushed an example in a separate file. I hope you don't mind that it's otherwise identical. I did change the script docstring and added a little more information on how to find the incantation for a given model.

terrytangyuan commented 8 years ago

Thanks! @dvbuntu