Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

README updated

  • Loading branch information...
commit b450d06d8ee14ef330f29eeb1abcdfd5050652c7 1 parent 9687e43
@jaor jaor authored
Showing with 96 additions and 3 deletions.
  1. +96 −3
@@ -1,4 +1,97 @@
+## C# bindings for
-C# bindings for
+These bindings expose a full LINQ provider, a strongly typed
+projection of all the JSON objects exposed by the REST API, as well as
+the ability to compile models to .NET assemblies.
+The implementation of the LINQ provider may be an interesting topic of
+study by itself, and follows the pattern outlined in
+[The World According to LINQ](
+### Accessing
+To access BigML using the bindings, you first create a new client
+object by passing your user name and API key. The client object
+provides methods for most of the operations provided by
+[the BigML API]( (of course the binding
+may not reflect all the latest features, for example we do not
+implement Evaluations yet, but that is why we provide the source on
+GitHub) such as listing, filtering, and sorting your sources using
+LINQ queries. For instance:
+// New BigML client using username and API key.
+Console.Write("user: "); var User = Console.ReadLine();
+Console.Write("key: "); var ApiKey = Console.ReadLine();
+var client = new Client(User, ApiKey);
+Ordered<Source.Filterable, Source.Orderable, Source> result
+ = (from s in client.ListSources()
+ orderby s.Created descending
+ select s);
+var sources = await result;
+foreach(var src in sources) Console.WriteLine(src.ToString());
+### Creating a datasources, datasets and models
+Once we have printed out the existing sources, we can create a new
+source from an in-memory collection, but BigML (and the .NET bindings)
+also supports creating sources from local files, Amazon S3, or Azure
+Blob store. And from that a dataset, and a model. Since it can take a
+while for the BigML service to process creation of sources, datasets,
+and models, we need to poll until we get status code “finished” back
+from the service:
+// New source from in-memory stream, with separate header.
+var source = await client.Create(iris, "Iris.csv", "sepal length, sepal width, petal length, petal width, species");
+// No push, so we need to busy wait for the source to be processed.
+while ((source = await client.Get(source)).StatusMessage.StatusCode != Code.Finished) await Task.Delay(10);
+// Default dataset from source
+var dataset = await client.Create(source);
+// No push, so we need to busy wait for the source to be processed.
+while ((dataset = await client.Get(dataset)).StatusMessage.StatusCode != Code.Finished) await Task.Delay(10);
+// Default model from dataset
+var model = await client.Create(dataset);
+// No push, so we need to busy wait for the source to be processed.
+while ((model = await client.Get(model)).StatusMessage.StatusCode != Code.Finished) await Task.Delay(10);
+### Manipulating models
+The model description is a JSON object that represents the decision
+tree that BigML has learned from the data we fed to it. We translate
+the model into a .NET expression tree and then compile the expression
+tree into a .NET delegate, and call it on one of the test inputs to
+see if it predicts the same kind of iris:
+var description = model.ModelDescription;
+// First convert it to a .NET expression tree
+var expression = description.Expression();
+// Then compile the expression tree into MSIL
+var predict = expression.Compile() as Func<double,double,double,double,string>;
+// And try the first flower of the example set.
+var result2 = predict(5.1, 3.5, 1.4, 0.2);
+Console.WriteLine("result = {0}, expected = {1}", result2, "setosa");
+## Support
+Please report problems and bugs to our
+[ issue tracker](
+You can also join us in our
+[Campfire chatroom](
Please sign in to comment.
Something went wrong with that request. Please try again.