public async Task CreateMultiDataset() { Client c = new Client(userName, apiKey); Source.Arguments args = new Source.Arguments(); args.Add("remote", "https://static.bigml.com/csv/iris.csv"); args.Add("name", "https://static.bigml.com/csv/iris.csv"); Source s = await c.CreateSource(args); s = await c.Wait<Source>(s.Resource); Assert.AreEqual(s.StatusMessage.StatusCode, Code.Finished); DataSet.Arguments argsDS = new DataSet.Arguments(); argsDS.Source = s.Resource; DataSet ds = await c.CreateDataset(argsDS); ds = await c.Wait<DataSet>(ds.Resource); // use the other DataSet constructor argsDS = new DataSet.Arguments(s); DataSet ds2 = await c.CreateDataset(argsDS); ds2 = await c.Wait<DataSet>(ds2.Resource); argsDS = new DataSet.Arguments(); argsDS.OriginDatasets.Add(ds.Resource); argsDS.OriginDatasets.Add(ds2.Resource); argsDS.Name = "Dataset using multi datasets"; DataSet dsMulti = await c.CreateDataset(argsDS); dsMulti = await c.Wait<DataSet>(dsMulti.Resource); await c.Delete(s); await c.Delete(ds); await c.Delete(ds2); await c.Delete(dsMulti); }
public async Task CreateOptiMLFromRemoteSource() { Client c = new Client(userName, apiKey); Project.Arguments pArgs = new Project.Arguments(); pArgs.Add("name", "Test Project"); Project p1 = await c.CreateProject(pArgs); Project p2 = await c.CreateProject(pArgs); Source.Arguments args = new Source.Arguments(); args.Add("remote", "https://static.bigml.com/csv/iris.csv"); args.Add("name", "C# tests - Iris"); // The project can be added as a regular parameter in the creation args.Add("project", p1.Resource); Source s = await c.CreateSource(args); s = await c.Wait <Source>(s.Resource); Assert.AreEqual(s.StatusMessage.StatusCode, Code.Finished); // Update the project Newtonsoft.Json.Linq.JObject changes = new Newtonsoft.Json.Linq.JObject(); changes.Add("project", p2.Resource); s = await c.Update <Source>(s.Resource, changes); Assert.AreEqual(s.Code, System.Net.HttpStatusCode.Accepted); DataSet.Arguments argsDS = new DataSet.Arguments(); argsDS.Add("source", s.Resource); DataSet ds = await c.CreateDataset(argsDS); ds = await c.Wait <DataSet>(ds.Resource); Assert.AreEqual(ds.StatusMessage.StatusCode, Code.Finished); OptiML.Arguments argsOM = new OptiML.Arguments(); argsOM.Add("dataset", ds.Resource); argsOM.Add("name", "C# tests - TestOptiML"); argsOM.Add("max_training_time", 100); OptiML om = await c.CreateOptiML(argsOM); om = await c.Wait <OptiML>(om.Resource); // This step can take a bit Assert.AreNotEqual(om.StatusMessage.StatusCode, Code.Faulty); await c.Delete(s); await c.Delete(ds); await c.Delete(om); await c.Delete(p1); await c.Delete(p2); }
public async Task CreateDeepnetFromRemoteSource() { // Prepare connection Client c = new Client(userName, apiKey); // Create source Source.Arguments args = new Source.Arguments(); args.Add("remote", "http://static.bigml.com/csv/iris.csv"); Source s = await c.CreateSource(args); s = await c.Wait <Source>(s.Resource); Assert.AreEqual(s.StatusMessage.StatusCode, Code.Finished); // Create dataset DataSet.Arguments argsDS = new DataSet.Arguments(); argsDS.Add("source", s.Resource); DataSet ds = await c.CreateDataset(argsDS); ds = await c.Wait <DataSet>(ds.Resource); Assert.AreEqual(ds.StatusMessage.StatusCode, Code.Finished); // Create deepnet Deepnet.Arguments argsDn = new Deepnet.Arguments(); argsDn.Add("dataset", ds.Resource); Deepnet dn = await c.CreateDeepnet(argsDn); dn = await c.Wait <Deepnet>(dn.Resource); Assert.AreEqual(dn.StatusMessage.StatusCode, Code.Finished); // test UPDATE method Newtonsoft.Json.Linq.JObject changes = new Newtonsoft.Json.Linq.JObject(); Newtonsoft.Json.Linq.JArray tags = new Newtonsoft.Json.Linq.JArray(); tags.Add("Bindings C# test"); changes.Add("tags", tags); dn = await c.Update <Deepnet>(dn.Resource, changes); Assert.AreEqual(dn.Code, System.Net.HttpStatusCode.Accepted); // test DELETE method await c.Delete(s); await c.Delete(ds); await c.Delete(dn); }
public async Task CreateLogisticRegressionFromRemoteSource() { Client c = new Client(userName, apiKey); Source.Arguments args = new Source.Arguments(); args.Add("remote", "https://static.bigml.com/csv/iris.csv"); args.Add("name", "C# tests - Iris"); Source s = await c.CreateSource(args); s = await c.Wait <Source>(s.Resource); Assert.AreEqual(s.StatusMessage.StatusCode, Code.Finished); DataSet.Arguments argsDS = new DataSet.Arguments(); argsDS.Add("source", s.Resource); DataSet ds = await c.CreateDataset(argsDS); ds = await c.Wait <DataSet>(ds.Resource); Assert.AreEqual(ds.StatusMessage.StatusCode, Code.Finished); LogisticRegression.Arguments argsTM = new LogisticRegression.Arguments(); argsTM.Add("dataset", ds.Resource); LogisticRegression lr = await c.CreateLogisticRegression(argsTM); lr = await c.Wait <LogisticRegression>(lr.Resource); // test it is finished Assert.AreEqual(lr.StatusMessage.StatusCode, Code.Finished); // test update method Newtonsoft.Json.Linq.JObject changes = new Newtonsoft.Json.Linq.JObject(); Newtonsoft.Json.Linq.JArray tags = new Newtonsoft.Json.Linq.JArray(); tags.Add("Bindings C# test"); changes.Add("tags", tags); lr = await c.Update <LogisticRegression>(lr.Resource, changes); Assert.AreEqual(lr.Code, System.Net.HttpStatusCode.Accepted); await c.Delete(s); await c.Delete(ds); await c.Delete(lr); }
public async Task CreateTimeSeriesFromRemoteSource() { Client c = new Client(userName, apiKey); Source.Arguments args = new Source.Arguments(); args.Add("remote", "https://static.bigml.com/csv/iris.csv"); args.Add("name", "C# tests - Iris"); Source s = await c.CreateSource(args); s = await c.Wait <Source>(s.Resource); Assert.AreEqual(s.StatusMessage.StatusCode, Code.Finished); DataSet.Arguments argsDS = new DataSet.Arguments(); argsDS.Add("source", s.Resource); DataSet ds = await c.CreateDataset(argsDS); ds = await c.Wait <DataSet>(ds.Resource); Assert.AreEqual(ds.StatusMessage.StatusCode, Code.Finished); TimeSeries.Arguments argsTM = new TimeSeries.Arguments(); argsTM.Add("dataset", ds.Resource); TimeSeries ts = await c.CreateTimeSeries(argsTM); ts = await c.Wait <TimeSeries>(ts.Resource); // test it is finished Assert.AreEqual(ts.StatusMessage.StatusCode, Code.Finished); // test update method Newtonsoft.Json.Linq.JObject changes = new Newtonsoft.Json.Linq.JObject(); Newtonsoft.Json.Linq.JArray tags = new Newtonsoft.Json.Linq.JArray(); tags.Add("Bindings C# test"); changes.Add("tags", tags); ts = await c.Update <TimeSeries>(ts.Id, changes); Assert.AreEqual(ts.Code, 202); await c.Delete(s); await c.Delete(ds); await c.Delete(ts); }
public async Task CreateDataset() { Client c = new Client(userName, apiKey); Source.Arguments args = new Source.Arguments(); args.Add("remote", "https://static.bigml.com/csv/iris.csv"); Source s = await c.CreateSource(args); s = await c.Wait<Source>(s.Resource); Assert.AreEqual(s.StatusMessage.StatusCode, Code.Finished); DataSet.Arguments argsDS = new DataSet.Arguments(); DataSet ds = await c.CreateDataset(argsDS); ds = await c.Wait<DataSet>(ds.Resource); await c.Delete(s); await c.Delete(ds); }
public async Task CreateMultiDataset() { Client c = new Client(userName, apiKey); Source.Arguments args = new Source.Arguments(); args.Add("remote", "https://static.bigml.com/csv/iris.csv"); args.Add("name", "https://static.bigml.com/csv/iris.csv"); Source s = await c.CreateSource(args); s = await c.Wait <Source>(s.Resource); Assert.AreEqual(s.StatusMessage.StatusCode, Code.Finished); DataSet.Arguments argsDS = new DataSet.Arguments(); argsDS.Source = s.Resource; DataSet ds = await c.CreateDataset(argsDS); ds = await c.Wait <DataSet>(ds.Resource); // use the other DataSet constructor argsDS = new DataSet.Arguments(s); DataSet ds2 = await c.CreateDataset(argsDS); ds2 = await c.Wait <DataSet>(ds2.Resource); argsDS = new DataSet.Arguments(); argsDS.OriginDatasets.Add(ds.Resource); argsDS.OriginDatasets.Add(ds2.Resource); argsDS.Name = "Dataset using multi datasets"; DataSet dsMulti = await c.CreateDataset(argsDS); dsMulti = await c.Wait <DataSet>(dsMulti.Resource); await c.Delete(s); await c.Delete(ds); await c.Delete(ds2); await c.Delete(dsMulti); }
public async Task CreateDataset() { Client c = new Client(userName, apiKey); Source.Arguments args = new Source.Arguments(); args.Add("remote", "https://static.bigml.com/csv/iris.csv"); Source s = await c.CreateSource(args); s = await c.Wait <Source>(s.Resource); Assert.AreEqual(s.StatusMessage.StatusCode, Code.Finished); DataSet.Arguments argsDS = new DataSet.Arguments(); DataSet ds = await c.CreateDataset(argsDS); ds = await c.Wait <DataSet>(ds.Resource); await c.Delete(s); await c.Delete(ds); }
public async Task CreateTopicModelFromRemoteSource() { Client c = new Client(userName, apiKey); Source.Arguments args = new Source.Arguments(); args.Add("remote", "https://static.bigml.com/csv/iris.csv"); args.Add("name", "C# tests - Iris"); Source s = await c.CreateSource(args); s = await c.Wait <Source>(s.Resource); Assert.AreEqual(s.StatusMessage.StatusCode, Code.Finished); DataSet.Arguments argsDS = new DataSet.Arguments(); argsDS.Add("source", s.Resource); DataSet ds = await c.CreateDataset(argsDS); ds = await c.Wait <DataSet>(ds.Resource); Assert.AreEqual(ds.StatusMessage.StatusCode, Code.Finished); TopicModel.Arguments argsTM = new TopicModel.Arguments(); argsTM.Add("dataset", ds.Resource); TopicModel tm = await c.CreateTopicModel(argsTM); tm = await c.Wait <TopicModel>(tm.Resource); // test fails because there is no text field in data Assert.AreEqual(tm.StatusMessage.StatusCode, Code.Faulty); await c.Delete(s); await c.Delete(ds); await c.Delete(tm); }
public async Task CreateFusionFromRemoteSource() { // Prepare connection Client c = new Client(userName, apiKey); // Create source Source.Arguments args = new Source.Arguments(); args.Add("remote", "http://static.bigml.com/csv/iris.csv"); Source s = await c.CreateSource(args); s = await c.Wait <Source>(s.Resource); Assert.AreEqual(s.StatusMessage.StatusCode, Code.Finished); // Create dataset DataSet.Arguments argsDS = new DataSet.Arguments(); argsDS.Add("source", s.Resource); DataSet ds = await c.CreateDataset(argsDS); ds = await c.Wait <DataSet>(ds.Resource); Assert.AreEqual(ds.StatusMessage.StatusCode, Code.Finished); // Create Logistic Regression LogisticRegression.Arguments argsLR = new LogisticRegression.Arguments(); argsLR.Add("dataset", ds.Resource); LogisticRegression lr = await c.CreateLogisticRegression(argsLR); lr = await c.Wait <LogisticRegression>(lr.Resource); // Create Tree model Model.Arguments argsMd = new Model.Arguments(); argsMd.Add("dataset", ds.Resource); Model md = await c.CreateModel(argsMd); md = await c.Wait <Model>(md.Resource); // Create Fusion Fusion.Arguments argsFs = new Fusion.Arguments(); List <dynamic> modelIDs = new List <dynamic>(); modelIDs.Add(lr.Resource); modelIDs.Add(md.Resource); argsFs.Models = modelIDs; Fusion fs = await c.CreateFusion(argsFs); fs = await c.Wait <Fusion>(fs.Resource); Assert.AreEqual(fs.StatusMessage.StatusCode, Code.Finished); // test UPDATE method Newtonsoft.Json.Linq.JObject changes = new Newtonsoft.Json.Linq.JObject(); Newtonsoft.Json.Linq.JArray tags = new Newtonsoft.Json.Linq.JArray(); tags.Add("Bindings C# test"); changes.Add("tags", tags); fs = await c.Update <Fusion>(fs.Resource, changes); Assert.AreEqual(fs.Code, System.Net.HttpStatusCode.Accepted); // test DELETE method await c.Delete(s); await c.Delete(ds); await c.Delete(fs); }