Skip to content

Commit

Permalink
Add OptiML as new resource
Browse files Browse the repository at this point in the history
  • Loading branch information
joseribes committed Jun 11, 2018
1 parent 11c8d05 commit 480ffe9
Show file tree
Hide file tree
Showing 14 changed files with 348 additions and 8 deletions.
40 changes: 39 additions & 1 deletion BigML/BigML.csproj
Expand Up @@ -41,6 +41,12 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand All @@ -50,6 +56,7 @@
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http">
<HintPath>..\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.dll</HintPath>
Expand Down Expand Up @@ -173,6 +180,13 @@
<Compile Include="Evaluation\Filterable.cs" />
<Compile Include="Evaluation\Orderable.cs" />
<Compile Include="Evaluation\Status.cs" />
<Compile Include="Forecast\Arguments.cs" />
<Compile Include="Forecast\BigMLClientForecast.cs" />
<Compile Include="Forecast\Filterable.cs" />
<Compile Include="Forecast\Forecast.cs" />
<Compile Include="Forecast\ForecastListing.cs" />
<Compile Include="Forecast\Orderable.cs" />
<Compile Include="Forecast\Status.cs" />
<Compile Include="Helpers\Categories.cs" />
<Compile Include="Helpers\Combiner.cs" />
<Compile Include="Helpers\Constants.cs" />
Expand Down Expand Up @@ -254,6 +268,13 @@
<Compile Include="Response\MetaObject.cs" />
<Compile Include="Response\Response.cs" />
<Compile Include="Response\Status.cs" />
<Compile Include="OptiML\Arguments.cs" />
<Compile Include="OptiML\BigMLClientOptiML.cs" />
<Compile Include="OptiML\Filterable.cs" />
<Compile Include="OptiML\Orderable.cs" />
<Compile Include="OptiML\OptiML.cs" />
<Compile Include="OptiML\OptimlListing.cs" />
<Compile Include="OptiML\Status.cs" />
<Compile Include="Sample\Arguments.cs" />
<Compile Include="Sample\BigMLClientSample.cs" />
<Compile Include="Sample\Filterable.cs" />
Expand All @@ -272,13 +293,27 @@
<Compile Include="Source\Parser.cs" />
<Compile Include="Source\Status.cs" />
<Compile Include="Source\Type.cs" />
<Compile Include="Deepnet\Arguments.cs" />
<Compile Include="Deepnet\BigMLClientDeepnet.cs" />
<Compile Include="Deepnet\Filterable.cs" />
<Compile Include="Deepnet\Orderable.cs" />
<Compile Include="Deepnet\Deepnet.cs" />
<Compile Include="Deepnet\DeepnetListing.cs" />
<Compile Include="Deepnet\Status.cs" />
<Compile Include="StatisticalTest\Arguments.cs" />
<Compile Include="StatisticalTest\BigMLClientStatisticalTest.cs" />
<Compile Include="StatisticalTest\Filterable.cs" />
<Compile Include="StatisticalTest\Orderable.cs" />
<Compile Include="StatisticalTest\StatisticalTest.cs" />
<Compile Include="StatisticalTest\StatisticalTestListing.cs" />
<Compile Include="StatisticalTest\Status.cs" />
<Compile Include="TimeSeries\Arguments.cs" />
<Compile Include="TimeSeries\BigMLClientTimeSeries.cs" />
<Compile Include="TimeSeries\Filterable.cs" />
<Compile Include="TimeSeries\Orderable.cs" />
<Compile Include="TimeSeries\Status.cs" />
<Compile Include="TimeSeries\TimeSeries.cs" />
<Compile Include="TimeSeries\TimeSeriesListing.cs" />
<Compile Include="TopicDistribution\Arguments.cs" />
<Compile Include="TopicDistribution\BigMLClientTopicDistribution.cs" />
<Compile Include="TopicDistribution\Filterable.cs" />
Expand Down Expand Up @@ -317,7 +352,10 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="BigML.nuspec" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="_doc\" />
Expand Down
10 changes: 6 additions & 4 deletions BigML/BigML.nuspec
Expand Up @@ -2,21 +2,23 @@
<package >
<metadata>
<id>BigML</id>
<version>2.3</version>
<version>2.4</version>
<title>BigML</title>
<authors>BigML Team</authors>
<owners>BigML Inc.</owners>
<licenseUrl>https://bigml.com/tos</licenseUrl>
<projectUrl>https://github.com/bigmlcom/bigml-csharp</projectUrl>
<iconUrl>https://secure.gravatar.com/avatar/d286e440ee01b6de94c1db5855352e09</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Official BigML bindings for dotnet developers</description>
<summary>- Update reference to Newtonsoft 11.0.1</summary>
<releaseNotes>- Fix issue input data for remote predictions</releaseNotes>
<copyright>BigML Inc 2018</copyright>
<summary>+ Add OptiML as new resource</summary>
<releaseNotes>+ Add OptiML as new resource</releaseNotes>
<language>en-US</language>
<dependencies>
<dependency id="EntityFramework" version="6.1.3" />
<dependency id="Newtonsoft.Json" version="11.0.1" />
</dependencies>
<copyright>BigML Inc 2018</copyright>
<tags></tags>
</metadata>
</package>
33 changes: 33 additions & 0 deletions BigML/OptiML/Arguments.cs
@@ -0,0 +1,33 @@
using Newtonsoft.Json.Linq;

namespace BigML
{
public partial class OptiML
{
public class Arguments : Arguments<OptiML>
{
public Arguments()
{

}

/// <summary>
/// A valid dataset/id.
/// </summary>
public string DataSet
{
get;
set;
}


public override JObject ToJson()
{
dynamic json = base.ToJson();

if(!string.IsNullOrWhiteSpace(DataSet)) json.dataset = DataSet;
return json;
}
}
}
}
39 changes: 39 additions & 0 deletions BigML/OptiML/BigMLClientOptiML.cs
@@ -0,0 +1,39 @@
using System.Threading.Tasks;

namespace BigML
{
public partial class Client
{
/// <summary>
/// Create a OptiML using supplied arguments.
/// </summary>
public Task<OptiML> CreateOptiML(OptiML.Arguments arguments)
{
return Create<OptiML>(arguments);
}

/// <summary>
/// Create a OptiML.
/// </summary>
/// <param name="dataset">A DataSet instance</param>
/// <param name="name">The name you want to give to the new OptiML. </param>
/// <param name="arguments">The other parameters you want to specify (description, tags, etc.)</param>
public Task<OptiML> CreateOptiML(DataSet dataset, string name = null,
OptiML.Arguments arguments = null)
{
arguments = arguments ?? new OptiML.Arguments();
if (!string.IsNullOrWhiteSpace(name))
arguments.Name = name;
arguments.DataSet = dataset.Resource;
return Create<OptiML>(arguments);
}

/// <summary>
/// List all the OptiMLs
/// </summary>
public Query<OptiML.Filterable, OptiML.Orderable, OptiML> ListOptiMLs()
{
return new OptimlListing(List<OptiML>);
}
}
}
29 changes: 29 additions & 0 deletions BigML/OptiML/Filterable.cs
@@ -0,0 +1,29 @@
using BigML.Meta;

namespace BigML
{
public partial class OptiML
{
/// <summary>
/// Filterable properties for OptiML
/// </summary>
public class Filterable : Filterable<OptiML>
{
/// <summary>
/// The dataset/id that was used to build the OptiML.
/// </summary>
public String Dataset
{
get { return Object.dataset; }
}

/// <summary>
/// Whether the dataset is still available or has been deleted.
/// </summary>
public Bool DatasetStatus
{
get { return Object.dataset_status; }
}
}
}
}
57 changes: 57 additions & 0 deletions BigML/OptiML/OptiML.cs
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BigML
{
/// <summary>
/// An OptiML is an automated optimization process for model selection and
/// parameterization (or hyper-parameterization) to solve classification
/// and regression problems.
/// The complete and updated reference with all available parameters is in
/// our <a href="https://bigml.com/api/optimls">documentation</a> website.
/// </summary>
public partial class OptiML : Response
{

/// <summary>
/// The name of the OptiML as your provided or based on the name
/// of the dataset by default.
/// </summary>
public string Name
{
get { return Object.name; }
}


/// <summary>
/// The dataset/id that was used to build the OptiML.
/// </summary>
public string DataSet
{
get { return Object.dataset; }
}



/// <summary>
/// Whether the dataset is still available or has been deleted.
/// </summary>
public bool DataSetStatus
{
get { return Object.dataset_status; }
}


/// <summary>
/// A description of the status of the OptiML. It includes a code, a message,
/// and some extra information.
/// </summary>
public Status StatusMessage
{
get { return new Status(Object.status); }
}
}
}
13 changes: 13 additions & 0 deletions BigML/OptiML/OptimlListing.cs
@@ -0,0 +1,13 @@
using System;
using System.Threading.Tasks;

namespace BigML
{
public class OptimlListing : Query<OptiML.Filterable, OptiML.Orderable, OptiML>
{
public OptimlListing(Func<string, Task<Listing<OptiML>>> client)
: base(client)
{
}
}
}
31 changes: 31 additions & 0 deletions BigML/OptiML/Orderable.cs
@@ -0,0 +1,31 @@
using BigML.Meta;

namespace BigML
{
using Meta.Key;

public partial class OptiML
{
/// <summary>
/// Orderable properties for OptiMLs
/// </summary>
public class Orderable : Orderable<OptiML>
{
/// <summary>
/// The dataset/id that was used to build the OptiML.
/// </summary>
public String Dataset
{
get { return Object.dataset; }
}

/// <summary>
/// Whether the dataset is still available or has been deleted.
/// </summary>
public Bool DatasetStatus
{
get { return Object.dataset_status; }
}
}
}
}
31 changes: 31 additions & 0 deletions BigML/OptiML/Status.cs
@@ -0,0 +1,31 @@
using Newtonsoft.Json.Linq;

namespace BigML
{
public partial class OptiML
{
/// <summary>
/// Creating an OptiML is a process that can take just a few
/// seconds or a few hours depending on the size of the dataset used as
/// input and on the work load of BigML's systems.
/// The OptiML goes through a number of states until its completed.
/// Through the status field in the OptiML you can determine when the
/// OptiML has been fully processed and ready to be used in scatterplot.
/// </summary>
public class Status : Status<OptiML>
{
internal Status(JObject status): base(status)
{
}

/// <summary>
/// How far BigML.io has progressed processing the OptiML.
/// </summary>
public double Progress
{
get { return _status.progress; }
}

}
}
}
3 changes: 2 additions & 1 deletion BigML/Source/Arguments.cs
Expand Up @@ -53,7 +53,8 @@ public override Newtonsoft.Json.Linq.JObject ToJson()
if (!string.IsNullOrWhiteSpace(File)) json.file = File;
if (Data != null && Data.Any()) json.data = string.Join("\n", Data);
if (!string.IsNullOrWhiteSpace(Remote)) json.remote = Remote;
json.source_parser = Parser.ToJson();

if (!Parser.isEmpty()) json.parser = Parser.ToJson();
return json;
}
}
Expand Down
13 changes: 13 additions & 0 deletions BigML/Source/Parser.cs
Expand Up @@ -124,6 +124,19 @@ public JObject ToJson()
return copy;
}

public bool isEmpty()
{

if (Header != _header) return false;
if (Trim != _trim) return false;
if (Separator != _separator) return false;
if (Quote != _quote) return false;
if (Locale != _locale) return false;
if (MissingTokens.Count > 0) return false;

return true;
}

public override string ToString()
{
return ToJson().ToString();
Expand Down
4 changes: 2 additions & 2 deletions BigML/_doc/enviroment.txt
@@ -1,4 +1,4 @@
To run and develop you should use dotnet framework 4.5
To develop to need visual studio 2012 (version 11) or higher.
To develop to need visual studio 2015 (version 14) or higher.
To add the reference "Newtonsoft.Json" you need to run in the package manager:
PM> Install-Package Newtonsoft.Json -Version 9.0.1 BigML
PM> Install-Package Newtonsoft.Json -Version 11.0.1 BigML

0 comments on commit 480ffe9

Please sign in to comment.