-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
260 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System.Collections.Generic; | ||
using System.Json; | ||
using System.Linq; | ||
|
||
namespace BigML | ||
{ | ||
public partial class AssociationSet | ||
{ | ||
public class Arguments : Arguments<AssociationSet> | ||
{ | ||
public Arguments() | ||
{ | ||
InputData = new Dictionary<string, object>(); | ||
} | ||
|
||
/// <summary> | ||
/// A valid anomaly/id. | ||
/// </summary> | ||
public string Association | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
/// <summary> | ||
/// A group of values in a dictionary: "fieldId": value | ||
/// </summary> | ||
public IDictionary<string, object> InputData | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
public override JsonValue ToJson() | ||
{ | ||
dynamic json = base.ToJson(); | ||
|
||
if(!string.IsNullOrWhiteSpace(Association)) json.anomaly = Association; | ||
if (InputData.Count > 0) | ||
{ | ||
var input_data = new JsonObject(); | ||
foreach (var kv in InputData) | ||
{ | ||
JsonPrimitive value; | ||
JsonPrimitive.TryCreate(kv.Value, out value); | ||
input_data[kv.Key] = value; | ||
} | ||
json.input_data = input_data; | ||
} | ||
return json; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BigML | ||
{ | ||
/// <summary> | ||
/// An association set is created from an association and the input_data | ||
/// for which you wish to create an association set. | ||
/// Association Sets are useful to know which items have stronger | ||
/// associations with a given set of values for your fields. | ||
/// The complete and updated reference with all available parameters is in | ||
/// our <a href="https://bigml.com/api/associationsets">documentation</a> | ||
/// website. | ||
/// </summary> | ||
public partial class AssociationSet : Response | ||
{ | ||
|
||
/// <summary> | ||
/// The name of the association set as your provided or based on the name | ||
/// of the association by default. | ||
/// </summary> | ||
public string Name | ||
{ | ||
get { return Object.name; } | ||
} | ||
|
||
|
||
/// <summary> | ||
/// The association/id that was used to build the score. | ||
/// </summary> | ||
public string Association | ||
{ | ||
get { return Object.association; } | ||
} | ||
|
||
|
||
|
||
/// <summary> | ||
/// Whether the association is still available or has been deleted. | ||
/// </summary> | ||
public bool AssociationStatus | ||
{ | ||
get { return Object.association_status; } | ||
} | ||
|
||
|
||
/// <summary> | ||
/// A description of the status of the association set. It includes a | ||
/// code, a message, and some extra information. | ||
/// </summary> | ||
public Status<AssociationSet> StatusMessage | ||
{ | ||
get { return new Status(Object.status); } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace BigML | ||
{ | ||
public class AssociationSetListing : Query<AssociationSet.Filterable, AssociationSet.Orderable, AssociationSet> | ||
{ | ||
public AssociationSetListing(Func<string, Task<Listing<AssociationSet>>> client) | ||
: base(client) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace BigML | ||
{ | ||
public partial class Client | ||
{ | ||
/// <summary> | ||
/// Create an association set using supplied arguments. | ||
/// </summary> | ||
public Task<AssociationSet> CreateAssociationSet(AssociationSet.Arguments arguments) | ||
{ | ||
return Create<AssociationSet>(arguments); | ||
} | ||
|
||
/// <summary> | ||
/// Create an Association Set. | ||
/// </summary> | ||
/// <param name="association">An Association discovery instance</param> | ||
/// <param name="name">The name you want to give to the new association set. </param> | ||
/// <param name="arguments">Specifies the values of the fields that you want to use.</param> | ||
public Task<AssociationSet> CreateAssociationSet(Association association, string name = null, | ||
AssociationSet.Arguments arguments = null) | ||
{ | ||
arguments = arguments ?? new AssociationSet.Arguments(); | ||
if (!string.IsNullOrWhiteSpace(name)) | ||
arguments.Name = name; | ||
arguments.Association = association.Resource; | ||
return Create<AssociationSet>(arguments); | ||
} | ||
|
||
/// <summary> | ||
/// List all the associations sets | ||
/// </summary> | ||
public Query<AssociationSet.Filterable, AssociationSet.Orderable, AssociationSet> ListAssociationSets() | ||
{ | ||
return new AssociationSetListing(List<AssociationSet>); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using BigML.Meta; | ||
|
||
namespace BigML | ||
{ | ||
public partial class AssociationSet | ||
{ | ||
/// <summary> | ||
/// Filterable properties for Association sets | ||
/// </summary> | ||
public class Filterable : Filterable<AssociationSet> | ||
{ | ||
/// <summary> | ||
/// The dataset/id that was used to build the association. | ||
/// </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; } | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using BigML.Meta; | ||
|
||
namespace BigML | ||
{ | ||
using Meta.Key; | ||
|
||
public partial class AssociationSet | ||
{ | ||
/// <summary> | ||
/// Orderable properties for Association Sets | ||
/// </summary> | ||
public class Orderable : Orderable<AssociationSet> | ||
{ | ||
/// <summary> | ||
/// The dataset/id that was used to build the association discovery. | ||
/// </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; } | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Json; | ||
|
||
namespace BigML | ||
{ | ||
public partial class AssociationSet | ||
{ | ||
/// <summary> | ||
/// The association set goes through a number of states until its fully completed. | ||
/// Through the status field in the resource you can determine when the set has | ||
/// been fully processed and ready. | ||
/// </summary> | ||
public class Status : Status<AssociationSet> | ||
{ | ||
internal Status(JsonValue status): base(status) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// How far BigML.io has progressed processing the anomaly score. | ||
/// </summary> | ||
public double Progress | ||
{ | ||
get { return _status.progress; } | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters