graph.network.core
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package graph.network.core --version 1.0.0
NuGet\Install-Package graph.network.core -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="graph.network.core" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add graph.network.core --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: graph.network.core, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install graph.network.core as a Cake Addin #addin nuget:?package=graph.network.core&version=1.0.0 // Install graph.network.core as a Cake Tool #tool nuget:?package=graph.network.core&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
graph.network
https://github.com/t-j-durden/graph.network
graph.network is a deep graph convultional neural network library written in C#.
It lets you model any domain as a graph and then train that model to predict answers:
//1 - create a graph of superheroes and villains
var gn = new GraphNet("supers");
gn.Add("spider_man", "is_a", "super_hero");
gn.Add("hulk", "is_a", "super_hero");
gn.Add("green_goblin", "is_a", "super_villain");
gn.Add("red_king", "is_a", "super_villain");
gn.Add("super_villain", "is_a", "villain");
gn.Add("super_hero", "is_a", "hero");
gn.Add("hero", "is", "good");
gn.Add("hero", "is_not", "bad");
gn.Add("villain", "is", "bad");
gn.Add("villain", "is_not", "good");
//3 - mark some nodes as possible answers
gn.SetOutputs("good","bad");
//4 - train the model
gn.Train(gn.NewExample("spider_man", "good"), gn.NewExample("green_goblin", "bad"));
//5 - predict answers to questions that have not been directly trained
Assert.AreEqual("good", gn.Predict("hulk"));
Assert.AreEqual("bad", gn.Predict("red_king"));
Nodes in the graph can be full C# objects with rich functionally, so traditional object-oriented code can exist inside a machine learning framework/graph:
//create a small knowledge graph with information about areas
//and a couple of true/false output nodes
var gn = new GraphNet("cities", maxNumberOfPaths: 5);
gn.Add("london", "is_a", "city");
gn.Add("london", "capital_of", "uk");
gn.Add("ny", "capital_of", "usa");
gn.Add("paris", "is_a", "city");
gn.Add("york", "is_a", "city");
gn.Add("paris", "capital_of", "france");
gn.Add("uk", "is_a", "country");
gn.Add("france", "is_a", "country");
gn.Add(gn.Node(true), true);
gn.Add(gn.Node(false), true);
//register an NLP tokeniser node that creates an edge for each word and
//also add these words to the true and false output nodes so that we can
//map the paths between words: (london >> is_a >> city >> true)
gn.RegisterDynamic("ask", (node, graph) =>
{
var words = node.Value.ToString().Split(' ');
gn.Node(node, "word", words);
Node.BaseOnAdd(node, graph);
gn.Node(true, "word", words);
gn.Node(false, "word", words);
Node.BaseOnAdd(gn.Node(true), graph);
Node.BaseOnAdd(gn.Node(false), graph);
});
//set new nodes to default to creating this 'ask' node
gn.DefaultInput = "ask";
//train some examples of true and false statements using the
//NLP 'ask' node as the input
gn.Train(
new NodeExample(gn.Node("london is a city"), gn.Node(true))
, new NodeExample(gn.Node("london is the caplital of uk"), gn.Node(true))
, new NodeExample(gn.Node("london is the caplital of france"), gn.Node(false))
, new NodeExample(gn.Node("london is the caplital of usa"), gn.Node(false))
, new NodeExample(gn.Node("ny is the caplital of usa"), gn.Node(true))
, new NodeExample(gn.Node("ny is the caplital of uk"), gn.Node(false))
, new NodeExample(gn.Node("london is a country"), gn.Node(false))
, new NodeExample(gn.Node("uk is a country"), gn.Node(true))
, new NodeExample(gn.Node("uk is a city"), gn.Node(false))
, new NodeExample(gn.Node("unknown is a city"), gn.Node(false))
);
//now we can ask questions about entities that are in the
//knowledge graph but the training has not seen
Assert.AreEqual(true, gn.Predict("paris is a city"));
Assert.AreEqual(false, gn.Predict("paris is a country"));
Assert.AreEqual(true, gn.Predict("is france a country ?"));
Assert.AreEqual(false, gn.Predict("france is a city"));
Assert.AreEqual(true, gn.Predict("york is a city"));
Assert.AreEqual(true, gn.Predict("paris is the capital of france"))
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Cognitio.ConvNetSharp.Core (>= 0.4.11-alpha)
- PropertyChanged.Fody (>= 3.0.1)
- QuickGraph (>= 3.6.61119.7)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on graph.network.core:
Package | Downloads |
---|---|
graph.network.ld
graph.network linked data extension |
GitHub repositories
This package is not used by any popular GitHub repositories.