{"id":13658755,"url":"https://github.com/tensorflow/neural-structured-learning","last_synced_at":"2025-05-14T01:08:16.129Z","repository":{"id":37514753,"uuid":"204796113","full_name":"tensorflow/neural-structured-learning","owner":"tensorflow","description":"Training neural models with structured signals.","archived":false,"fork":false,"pushed_at":"2025-01-29T22:28:23.000Z","size":30216,"stargazers_count":990,"open_issues_count":1,"forks_count":190,"subscribers_count":46,"default_branch":"master","last_synced_at":"2025-04-03T07:05:51.007Z","etag":null,"topics":["adversarial-learning","graph-learning","keras","neural-networks","regularization","structured-signals","tensorflow"],"latest_commit_sha":null,"homepage":"https://www.tensorflow.org/neural_structured_learning","language":"Python","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":"2019-08-27T21:48:16.000Z","updated_at":"2025-03-31T01:43:44.000Z","dependencies_parsed_at":"2024-06-18T13:59:54.898Z","dependency_job_id":"523cd450-3c43-476e-9e62-239f9f1b7c9e","html_url":"https://github.com/tensorflow/neural-structured-learning","commit_stats":{"total_commits":490,"total_committers":38,"mean_commits":"12.894736842105264","dds":0.7102040816326531,"last_synced_commit":"87eb37d6fffe8e13becab6c27e87ecbc3c1ebb06"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorflow%2Fneural-structured-learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorflow%2Fneural-structured-learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorflow%2Fneural-structured-learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorflow%2Fneural-structured-learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tensorflow","download_url":"https://codeload.github.com/tensorflow/neural-structured-learning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248224820,"owners_count":21068075,"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":["adversarial-learning","graph-learning","keras","neural-networks","regularization","structured-signals","tensorflow"],"created_at":"2024-08-02T05:01:02.347Z","updated_at":"2025-04-10T13:09:40.425Z","avatar_url":"https://github.com/tensorflow.png","language":"Python","readme":"# Neural Structured Learning in TensorFlow\n\n![](g3doc/images/nsl_overview.png)\n\n**Neural Structured Learning (NSL)** is a new learning paradigm to train neural\nnetworks by leveraging structured signals in addition to feature inputs.\nStructure can be explicit as represented by a graph [1,2,5] or implicit as\ninduced by adversarial perturbation [3,4].\n\nStructured signals are commonly used to represent relations or similarity among\nsamples that may be labeled or unlabeled. Leveraging these signals during neural\nnetwork training harnesses both labeled and unlabeled data, which can improve\nmodel accuracy, particularly when **the amount of labeled data is relatively\nsmall**. Additionally, models trained with samples that are generated by\nadversarial perturbation have been shown to be **robust against malicious\nattacks**, which are designed to mislead a model's prediction or classification.\n\nNSL generalizes to Neural Graph Learning [1] as well as to Adversarial Learning\n[3]. The NSL framework in TensorFlow provides the following easy-to-use APIs and\ntools for developers to train models with structured signals:\n\n*   **Keras APIs** to enable training with graphs (explicit structure) and\n    adversarial perturbations (implicit structure).\n\n*   **TF ops and functions** to enable training with structure when using\n    lower-level TensorFlow APIs\n\n*   **Tools** to build graphs and construct graph inputs for training\n\nThe NSL framework is designed to be flexible and can be used to train any kind\nof neural network. For example, feed-forward, convolution, and recurrent neural\nnetworks can all be trained using the NSL framework. In addition to supervised\nand semi-supervised learning (a low amount of supervision), NSL can in theory be\ngeneralized to unsupervised learning. Incorporating structured signals is done\nonly during training, so the performance of the serving/inference workflow\nremains unchanged. Please check out our tutorials for a practical introduction\nto NSL.\n\n## Getting started\n\nYou can install the prebuilt NSL pip package by running:\n\n```bash\npip install neural-structured-learning\n```\n\nFor more detailed instructions on how to install NSL as a package or to build it\nfrom source in various environments, please see the\n[installation guide](g3doc/install.md)\n\nNote that NSL requires a TensorFlow version of 1.15 or higher. NSL also supports\nTensorFlow 2.x with the exception of v2.1, which contains a bug that is\nincompatible with NSL.\n\n## Videos and Colab Tutorials\n\nGet a jump-start on NSL by watching our video series on YouTube! It gives a\ncomplete overview of the framework as well as discusses several aspects of\nlearning with structured signals.\n\n\u003ca href=\"http://www.youtube.com/watch?feature=player_embedded\u0026v=N_IS3x5wFNI\"\n   target=\"_blank\"\u003e\u003cimg src=\"http://img.youtube.com/vi/N_IS3x5wFNI/0.jpg\"\n                        alt=\"Overall Framework\" width=\"180\"  border=\"2\" /\u003e\u003c/a\u003e\n\u003ca href=\"http://www.youtube.com/watch?feature=player_embedded\u0026v=pJRRdtJ-rPU\"\n   target=\"_blank\"\u003e\u003cimg src=\"http://img.youtube.com/vi/pJRRdtJ-rPU/0.jpg\"\n                        alt=\"Natural Graphs\" width=\"180\" border=\"2\" /\u003e\u003c/a\u003e\n\u003ca href=\"http://www.youtube.com/watch?feature=player_embedded\u0026v=3RQqTTOY0U0\"\n   target=\"_blank\"\u003e\u003cimg src=\"http://img.youtube.com/vi/3RQqTTOY0U0/0.jpg\"\n                        alt=\"Synthetic Graphs\" width=\"180\" border=\"2\" /\u003e\u003c/a\u003e\n\u003ca href=\"http://www.youtube.com/watch?feature=player_embedded\u0026v=Js2WJkhdU7k\"\n   target=\"_blank\"\u003e\u003cimg src=\"http://img.youtube.com/vi/Js2WJkhdU7k/0.jpg\"\n                        alt=\"Adversarial Learning\" width=\"180\" border=\"2\" /\u003e\u003c/a\u003e\n\nWe've also created hands-on colab-based tutorials that will allow you to\ninteractively explore NSL. Here are a few:\n\n*   [training with natural graphs](https://github.com/tensorflow/neural-structured-learning/blob/master/g3doc/tutorials/graph_keras_mlp_cora.ipynb)\n*   [training with synthesized graphs](https://github.com/tensorflow/neural-structured-learning/blob/master/g3doc/tutorials/graph_keras_lstm_imdb.ipynb)\n*   [adversarial learning](https://github.com/tensorflow/neural-structured-learning/blob/master/g3doc/tutorials/adversarial_keras_cnn_mnist.ipynb)\n\nYou can find more examples and tutorials under the\n[examples](neural_structured_learning/examples) directory.\n\n## Contributing to NSL\n\nContributions are welcome and highly appreciated - there are several ways to\ncontribute to TF Neural Structured Learning:\n\n*   Case studies: If you are interested in applying NSL, consider wrapping up\n    your usage as a tutorial, a new dataset, or an example model that others\n    could use for experiments and/or development. The [examples](examples)\n    directory could be a good destination for such contributions.\n\n*   Product excellence: If you are interested in improving NSL's product\n    excellence and developer experience, the best way is to clone this repo,\n    make changes directly on the implementation in your local repo, and then\n    send us pull request to integrate your changes.\n\n*   New algorithms: If you are interested in developing new algorithms for NSL,\n    the best way is to study the implementations of NSL libraries, and to think\n    of extensions to the existing implementation (or alternative approaches). If\n    you have a proposal for a new algorithm, we recommend starting by staging\n    your project in the [research](research) directory and including a colab\n    notebook to showcase the new features. If you develop new algorithms in your\n    own repository, we would be happy to feature pointers to academic\n    publications and/or repositories using NSL from this repository.\n\nPlease be sure to review the [contribution guidelines](CONTRIBUTING.md).\n\n## Research\n\nSee our [research](research) directory for research projects in Neural\nStructured Learning:\n\n*   [Low-Dimensional Hyperbolic Knowledge Graph Embeddings](research/kg_hyp_emb)\n*   [A2N: Attending to Neighbors for Knowledge Graph Inference](research/a2n)\n*   [GAM: Graph Agreement Models for Semi-Supervised Learning](research/gam)\n*   [Neural Clustering Processes](research/neural_clustering)\n*   [CARLS: Cross-platform Asynchronous Representation Learning System](research/carls)\n*   [Denoised Smoothing: A Provable Defense for Pretrained Classifiers](research/third_party/denoised_smoothing)\n\n## Featured Usage\n\nPlease see the [usage page](usage.md) to learn more about how NSL is being\ndiscussed and used in the open source community.\n\n## Issues, Questions, and Feedback\n\nPlease use\n[GitHub issues](https://github.com/tensorflow/neural-structured-learning/issues)\nto file issues, bugs, and feature requests. For questions, please direct them to\n[Stack Overflow](https://stackoverflow.com) with the\n[\"nsl\"](https://stackoverflow.com/questions/tagged/nsl) tag. For feedback,\nplease fill this\n[form](https://docs.google.com/forms/d/1AQEcPSgmwWBJj3H2haEytF4C_fr1aotWaHjCEXpPm2A);\nwe would love to hear from you.\n\n## Release Notes\n\nPlease see the [release notes](RELEASE.md) for detailed version updates.\n\n## References\n\n[[1] T. Bui, S. Ravi and V. Ramavajjala. \"Neural Graph Learning: Training Neural\nNetworks Using Graphs.\" WSDM 2018](https://research.google/pubs/pub46568.pdf)\n\n[[2] T. Kipf and M. Welling. \"Semi-supervised classification with graph\nconvolutional networks.\" ICLR 2017](https://arxiv.org/pdf/1609.02907.pdf)\n\n[[3] I. Goodfellow, J. Shlens and C. Szegedy. \"Explaining and harnessing\nadversarial examples.\" ICLR 2015](https://arxiv.org/pdf/1412.6572.pdf)\n\n[[4] T. Miyato, S. Maeda, M. Koyama and S. Ishii. \"Virtual Adversarial Training:\na Regularization Method for Supervised and Semi-supervised Learning.\" ICLR\n2016](https://arxiv.org/pdf/1704.03976.pdf)\n\n[[5] D. Juan, C. Lu, Z. Li, F. Peng, A. Timofeev, Y. Chen, Y. Gao, T. Duerig, A.\nTomkins and S. Ravi \"Graph-RISE: Graph-Regularized Image Semantic Embedding.\"\nWSDM 2020](https://arxiv.org/abs/1902.10814)\n","funding_links":[],"categories":["Python (144)","Python","Tensorflow实用程序","其他_机器学习与深度学习","Other 💛💛💛💛💛\u003ca name=\"Other\" /\u003e"],"sub_categories":["神经结构化学习"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftensorflow%2Fneural-structured-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftensorflow%2Fneural-structured-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftensorflow%2Fneural-structured-learning/lists"}