{"id":22346114,"url":"https://github.com/benjaminabt/toxicdetectorsamplemlnet","last_synced_at":"2026-05-09T01:13:05.986Z","repository":{"id":130535003,"uuid":"407943712","full_name":"BenjaminAbt/ToxicDetectorSampleMLNET","owner":"BenjaminAbt","description":"Text Sentiment Sample with .NET and ML.NET","archived":false,"fork":false,"pushed_at":"2021-09-18T18:59:46.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T10:25:37.340Z","etag":null,"topics":["classification","csharp","dotnet","machinelearning","mlnet","sentiment","tensorflow","toxic"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BenjaminAbt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2021-09-18T18:57:05.000Z","updated_at":"2024-03-03T11:14:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"e9aa74a4-8bf5-4cb4-895d-6e64d4349367","html_url":"https://github.com/BenjaminAbt/ToxicDetectorSampleMLNET","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BenjaminAbt/ToxicDetectorSampleMLNET","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenjaminAbt%2FToxicDetectorSampleMLNET","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenjaminAbt%2FToxicDetectorSampleMLNET/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenjaminAbt%2FToxicDetectorSampleMLNET/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenjaminAbt%2FToxicDetectorSampleMLNET/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BenjaminAbt","download_url":"https://codeload.github.com/BenjaminAbt/ToxicDetectorSampleMLNET/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenjaminAbt%2FToxicDetectorSampleMLNET/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32803653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["classification","csharp","dotnet","machinelearning","mlnet","sentiment","tensorflow","toxic"],"created_at":"2024-12-04T09:19:53.810Z","updated_at":"2026-05-09T01:13:05.953Z","avatar_url":"https://github.com/BenjaminAbt.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ML.NET - Toxic Sentiment Sample\n\nThis code example shows the use of ML.NET using sentiment detection for toxic or offensive messages.\nThis can be integrated e.g. in chat applications.\n\n## Test Data\nIn this sample we use sample data of Kaggle: https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge/data\n\nDue to licensing requirements, this sample does not contain that training data.\nThese must be downloaded yourself and replaced with the train.csv file.\n\n## Usage\n\nAfter the `train.csv` has been downloaded, the application can simply be started with `dotnet run`.\n\nWhen started, the application is compiled and the model is trained. In my case, this takes around 5 seconds to generate the model; but can vary depending on processing power (especially CPU power).\n\n```sh\nPS C:\\source\\ba\\ToxicDetectorSampleMLNET\u003e dotnet run\n=\u003e create model context...\n=\u003e loading test data...\n=\u003e parsing test data...\n=\u003e create model partitions...\n=\u003e create binary classification pipeline...\n=\u003e model training...\n```\nWhen the model was created, it will be validated:\n```sh\n=\u003e model validation...\n=\u003e metrics for binary classification\n┌───────────────────────────────────┬─────────┐\n│                              Name │ Value   │\n├───────────────────────────────────┼─────────┤\n│                          Accuracy │ 95,76 % │\n│ Area Under Precision Recall Curve │ 84,38 % │\n│              Area Under Roc Curve │ 96,42 % │\n│                          F1 Score │ 74,15 % │\n│                          Log Loss │ 0,18    │\n│                Log Loss Reduction │ 0,61    │\n│                Positive Precision │ 0,89    │\n│                   Positive Recall │ 0,64    │\n│                Negative Precision │ 0,96    │\n│                   Negative Recall │ 0,99    │\n└───────────────────────────────────┴─────────┘\n```\n\nThen you can enter your text to check for toxic content:\n\n```sh\n--------------------------------------------------\nText Input: Ben likes you\n\nPredict Results:\n┌─────────────┬───────────────┐\n│        Name │ Value         │\n├─────────────┼───────────────┤\n│        Text │ Ben likes you │\n│  Prediction │ Friendly :-)  │\n│ Probability │ 20,68 %       │\n│       Score │ -3,3611276    │\n└─────────────┴───────────────┘\n--------------------------------------------------\n```\n\n## Dependencies\n\n### CSVHelper\n\nThe ML.NET CSV Reader is very basic and does not support all CSV scenarios. The standard ML NET CSV Reader unfortunately does not work with the CSV files of the Kaggle toxic comment data sample.\n\nTherefore, the CSVHelper (https://github.com/JoshClose/CsvHelper) library is used.\n\n## spectre.console\n\nhttps://github.com/spectreconsole/spectre.console for nicer console output\n\n\n## Thank you!\n\nPlease donate - if possible - to necessary institutions of your choice such as child cancer aid, children's hospices etc. Thanks!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjaminabt%2Ftoxicdetectorsamplemlnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenjaminabt%2Ftoxicdetectorsamplemlnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjaminabt%2Ftoxicdetectorsamplemlnet/lists"}