{"id":27430984,"url":"https://github.com/bigmlcom/bigml-csharp","last_synced_at":"2025-07-09T05:04:38.916Z","repository":{"id":7278737,"uuid":"8592914","full_name":"bigmlcom/bigml-csharp","owner":"bigmlcom","description":"C# bindings for BigML.io","archived":false,"fork":false,"pushed_at":"2022-12-08T11:32:17.000Z","size":605,"stargazers_count":18,"open_issues_count":4,"forks_count":11,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-06-17T16:54:25.575Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigmlcom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-06T01:01:08.000Z","updated_at":"2021-05-27T06:18:10.000Z","dependencies_parsed_at":"2023-01-11T18:45:23.531Z","dependency_job_id":null,"html_url":"https://github.com/bigmlcom/bigml-csharp","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/bigmlcom/bigml-csharp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmlcom%2Fbigml-csharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmlcom%2Fbigml-csharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmlcom%2Fbigml-csharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmlcom%2Fbigml-csharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigmlcom","download_url":"https://codeload.github.com/bigmlcom/bigml-csharp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmlcom%2Fbigml-csharp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264396623,"owners_count":23601541,"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":[],"created_at":"2025-04-14T15:28:12.192Z","updated_at":"2025-07-09T05:04:38.894Z","avatar_url":"https://github.com/bigmlcom.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## C# bindings for BigML.io\n\nThese bindings expose a full LINQ provider, a strongly typed\nprojection of all the JSON objects exposed by the REST API, as well as\nthe ability to compile models to .NET assemblies.\n\nThe implementation of the LINQ provider may be an interesting topic of\nstudy by itself, and follows the pattern outlined in\n[The World According to LINQ](http://queue.acm.org/detail.cfm?id=2024658).\n\n### Adding JSON Library\n\nThis bindings uses the Newtonsoft.Json dll\n([See reference](https://www.nuget.org/packages/Newtonsoft.Json/12.0.3)).\nSo, its common to add it mannually. In order to add it you should use the\npackage manager. In your visual studio enviroments\ngo to the package manager console (Tools \u003e Library packages\nmanager \u003e Package manager console) and type:\n```Shell\nInstall-Package Newtonsoft.Json -Version 12.0.3 BigML\n```\nyou should see a message like this\n```Shell\n'Newtonsoft.Json 12.0.3' was successfully added to BigML.\n```\nThe NuGet of this library is available at https://www.nuget.org/packages/BigML/ .\nLast released version is 2.5.1. Previous versions (\u003c2.0) use Microsoft's\nSystem.Json deprecated package and we encourage to update to a 2.0\nversion or higher.\n\n\n### Accessing BigML.io\n\nTo access BigML using the bindings, you first create a new client\nobject by passing your user name and API key. The client object\nprovides methods for most of the operations provided by\n[the BigML API](https://bigml.com/api) such as listing,\nfiltering, and sorting your resources using\nLINQ queries.  For instance, to list the sources in your account:\n\n```c#\n// New BigML client using username and API key.\nConsole.Write(\"user: \"); var User = Console.ReadLine();\nConsole.Write(\"key: \"); var ApiKey = Console.ReadLine();\nvar client = new Client(User, ApiKey);\n\nOrdered\u003cSource.Filterable, Source.Orderable, Source\u003e result\n      = (from s in client.ListSources()\n\t     orderby s.Created descending\n\t     select s);\n\nvar sources = await result;\nforeach(var src in sources) Console.WriteLine(src.ToString());\n```\n\n### Modeling steps and resources\n\nThe C# bindings allow you to create resources in BigML. The first resource that\nyou will need to create is a `source`- Sources can be created\nfrom an in-memory collection. BigML (and the .NET bindings)\nalso supports creating sources from local files, Amazon S3, or Azure\nBlob store. Creating a resource is an asynchronous operation that can take a\nwhile. We'll need to repeatedly poll until we get the resource in a\n`finished` status code.\n\n```c#\n// New source from in-memory stream, with separate header.\nvar source = await client.Create(iris, \"Iris.csv\", \"sepal length, sepal width, petal length, petal width, species\");\n// No push, so we need to busy wait for the source to be processed.\nwhile ((source = await client.Get(source)).StatusMessage.StatusCode != Code.Finished) await Task.Delay(10);\nConsole.WriteLine(source.StatusMessage.ToString());\n```\n\nThe following step towards modeling would be creating a dataset. Datasets\nsummarize the information in your data.\n\n```c#\n// Default dataset from source\nvar dataset = await client.Create(source);\n// No push, so we need to busy wait for the source to be processed.\nwhile ((dataset = await client.Get(dataset)).StatusMessage.StatusCode != Code.Finished) await Task.Delay(10);\nConsole.WriteLine(dataset.StatusMessage.ToString());\n```\nAnd now we would be ready to create a model from the dataset.\n\n```c#\n// Default model from dataset\nvar model = await client.Create(dataset);\n// No push, so we need to busy wait for the source to be processed.\nwhile ((model = await client.Get(model)).StatusMessage.StatusCode != Code.Finished) await Task.Delay(10);\nConsole.WriteLine(model.StatusMessage.ToString());\n```\n\n### Using models locally\n\nModels, like the rest of resources in BigML, are downloadable JSON objects.\nEach type of model has a particular scheme whose properties are described in\nthe corresponding [API documentation](https://bigml.com/api)\n\nDecision trees, for instance, contain a `root` property which\nis a JSON object that represents the rules that the algorithm has found\nin your data. The `ModelStructure` method of the `Model` class\nmaps these rules into a tree of `Nodes` in memory. That is the\n`Model.LocalModel`. Given a new test input, you can use the local model to\nrun the input through the rules and produce a prediction for the\nvalue of the model's target field (the `objective field`):\n\n```c#\n// Transforms JSON in tree structure\nModel.LocalModel localModel = model.ModelStructure();\n\n// --- Specify prediction inputs and calculate the prediction ---\n// input data can be provided by fieldID or by name\nDictionary\u003cstring, dynamic\u003e inputData = new Dictionary\u003cstring, dynamic\u003e();\ninputData.Add(\"sepal width\", 5);\ninputData.Add(\"00003\", 2.5);\n// Other values are ommited or unknown\nModel.Node prediction = localModel.predict(inputData);\n\nConsole.WriteLine(\"result = {0}, expected = {1}\", prediction.Output, \"setosa\");\n```\n\nThe same can be done for `ensembles` using the `EnsembleStructure` method\nof the `Ensemble` class to create a `LocalEnsemble`.\n\n## Development and Testing\n\nThe `BigML.Tests` project in the repo contains some tests that can be run to\nensure the bindings CRUD functionality. In order to connect to `BigML` you will\nneed to set your credentials in `BigML` as properties in the `app.config`\nfile.\n\nThe `Iris` project in the repo can be run on an external shell and will ask\nfor your credentials in the command line prompt. It also tests a basic\nmodel creation workflow.\n\nThe `WFormApp`project in the repo creates a form with two buttons that retrieve\nthe list of sources in your environement and shows the number of them by using\ntwo different methods. In order to work, you need to set your credentials as\nenvironment variables: `BIGML_USERNAME` and `BIGML_API_KEY`.\n\nAlso, the `Gists` directory contains some examples of utilities to create\nlocal and remote predictions. All of them ask for your credentials using the\ncommand prompt.\n\n\n## Support\n\nPlease, refer to the information in [Read the Docs](https://bigml-csharp.readthedocs.io/en/latest/)\nto understand the use of these bindings.\n\nPlease, report problems and bugs to our\n[BigML.io issue tracker](https://github.com/bigmlcom/io/issues).\n\nYou can also join us in our\n[Campfire chatroom](https://bigmlinc.campfirenow.com/f20a0).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigmlcom%2Fbigml-csharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigmlcom%2Fbigml-csharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigmlcom%2Fbigml-csharp/lists"}