{"id":13780557,"url":"https://github.com/tensorflow/tcav","last_synced_at":"2025-04-08T02:41:39.166Z","repository":{"id":33496176,"uuid":"139618618","full_name":"tensorflow/tcav","owner":"tensorflow","description":"Code for the TCAV ML interpretability project","archived":false,"fork":false,"pushed_at":"2024-07-30T21:34:45.000Z","size":640,"stargazers_count":634,"open_issues_count":17,"forks_count":151,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-03-12T23:02:20.724Z","etag":null,"topics":["interpretability","machine-learning","tcav"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tensorflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-03T17:45:35.000Z","updated_at":"2025-03-08T17:47:26.000Z","dependencies_parsed_at":"2023-01-15T01:09:55.449Z","dependency_job_id":"4b9d66b4-6b0c-4bd1-86fa-3b2e83704387","html_url":"https://github.com/tensorflow/tcav","commit_stats":{"total_commits":115,"total_committers":20,"mean_commits":5.75,"dds":0.817391304347826,"last_synced_commit":"b922c44bcc64c6bdddb8f661d732fa2145c99d95"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorflow%2Ftcav","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorflow%2Ftcav/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorflow%2Ftcav/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorflow%2Ftcav/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tensorflow","download_url":"https://codeload.github.com/tensorflow/tcav/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767232,"owners_count":20992538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["interpretability","machine-learning","tcav"],"created_at":"2024-08-03T18:01:17.216Z","updated_at":"2025-04-08T02:41:39.149Z","avatar_url":"https://github.com/tensorflow.png","language":"Jupyter Notebook","readme":"# Interpretability Beyond Feature Attribution: Quantitative Testing with Concept Activation Vectors (TCAV) \n\nBeen Kim, Martin Wattenberg, Justin Gilmer, Carrie Cai, James Wexler, Fernanda\nViegas, Rory Sayres\n\nICML Paper: https://arxiv.org/abs/1711.11279\n\n## What is TCAV?\n\nTesting with Concept Activation Vectors (TCAV) is a new interpretability method\nto understand what signals your neural networks models uses for prediction.\n\n### What's special about TCAV compared to other methods?\n\nTypical interpretability methods show importance weights in each input feature\n(e.g, pixel). TCAV instead shows importance of high level concepts (e.g., color,\ngender, race) for a prediction class - this is how humans communicate!\n\nTypical interpretability methods require you to have one particular image that\nyou are interested in understanding. TCAV gives an explanation that is generally\ntrue for a class of interest, beyond one image (global explanation).\n\nFor example, for a given class, we can show how much race or gender was\nimportant for classifications in InceptionV3. Even though neither race nor\ngender labels were part of the training input!\n\n### Cool, where do these concepts come from?\n\nTCAV learns concepts from examples. For instance, TCAV needs a couple of\nexamples of female, and something not female to learn a \"gender\" concept. We\nhave tested a variety of concepts: color, gender, race, textures and many\nothers.\n\n### Why use high level concepts instead of input features?\n\nHumans think and communicate using concepts, and not using numbers (e.g.,\nweights to each feature). When there are lots of numbers to combine and reason\nabout (many features), it becomes harder and harder for humans to make sense of\nthe information they are accounting for. TCAV instead delivers explanations in\nthe way humans communicate to each other.\n\n### The consumer of the explanation may not know machine learning too well. Can they understand the explanation?\n\nYes. TCAV is designed to make sense to everyone - as long as they can understand\nthe high level concept!\n\n### Sounds good. Do I need to change my network to use TCAV?\nNo. You don't need to change or retrain your network to use TCAV.\n\n## Installation\n\nTensorflow must be installed to use TCAV. But it isn't included in the TCAV pip\npackage install_requires as a user may wish to use it with either the tensorflow\nor tensorflow-gpu package. So please pip install tensorflow or tensorflow-gpu as\nwell as the tcav package.\n\n\u003e pip install tcav\n\n### Requirements\n\nSee requirements.txt for a list of python dependencies used in testing TCAV.\nThese will all be installed during pip installation of tcav with the exception\nof tensorflow, as mentioned above.\n\n## How to use TCAV\n\nSee Run TCAV.ipynb for step by step guide, after pip installing the tcav\npackage.\n\n```python\nmytcav = tcav.TCAV(sess,\n                   target,\n                   concepts,\n                   bottlenecks,\n                   act_gen,\n                   alphas,\n                   cav_dir=cav_dir,\n                   num_random_exp=2)\n\nresults = mytcav.run()\n```\n\n## TCAV for discrete models\n\nWe provide a simple example of how to run TCAV on models trained on discrete,\nnon-image data. Please see\n\n```\ncd tcav/tcav_examples/discrete/\n```\n\nYou can also find a Jupyter notebook for a model trained on KDD99 in here:\n\n```\ntcav/tcav_examples/discrete/kdd99_discrete_example.ipynb.\n```\n\n## Requirements\n\n-   tensorflow\n-   numpy\n-   Pillow\n-   matplotlib\n-   scikit-learn\n-   scipy\n\n## How to run unit tests\n\n`python -m tcav.cav_test`\n\n`python -m tcav.model_test`\n\n`python -m tcav.tcav_test`\n\n`python -m tcav.utils_test`\n\n## How to create a new version of the pip package\n\n1.  Ensure the version in setup.py has been updated to a new version.\n2.  Run `python setup.py bdist_wheel --python-tag py3` and `python setup.py\n    bdist_wheel --python-tag py2`.\n3.  Run `twine upload dist/*` to upload the py2 and py3 pip packages to PyPi.\n    \n","funding_links":[],"categories":["模型的可解释性","Python Libraries(sort in alphabeta order)","Technical Resources"],"sub_categories":["Evaluation methods","Open Source/Access Responsible AI Software Packages"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftensorflow%2Ftcav","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftensorflow%2Ftcav","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftensorflow%2Ftcav/lists"}