Browse Source

add nb_example data

tags/v0.9
Bo Peng 6 years ago
parent
commit
41bb848671
4 changed files with 10 additions and 14 deletions
  1. +0
    -6
      TensorFlow.NET.sln
  2. BIN
      data/nb_example.npy
  3. +0
    -4
      src/TensorFlowNET.Core/TensorFlowNET.Core.csproj
  4. +10
    -4
      test/TensorFlowNET.Examples/BasicModels/NaiveBayesClassifier.cs

+ 0
- 6
TensorFlow.NET.sln View File

@@ -17,8 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Keras.UnitTest", "test\Kera
EndProject EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TensorFlowNET.Examples.FSharp", "test\TensorFlowNET.Examples.FSharp\TensorFlowNET.Examples.FSharp.fsproj", "{62BC3801-F0D3-44A9-A0AC-712F40C8F961}" Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TensorFlowNET.Examples.FSharp", "test\TensorFlowNET.Examples.FSharp\TensorFlowNET.Examples.FSharp.fsproj", "{62BC3801-F0D3-44A9-A0AC-712F40C8F961}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NumSharp.Core", "..\NumSharp\src\NumSharp.Core\NumSharp.Core.csproj", "{E038A3C1-9055-4BF4-BE5B-0E7D661A7EB3}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -53,10 +51,6 @@ Global
{62BC3801-F0D3-44A9-A0AC-712F40C8F961}.Debug|Any CPU.Build.0 = Debug|Any CPU {62BC3801-F0D3-44A9-A0AC-712F40C8F961}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62BC3801-F0D3-44A9-A0AC-712F40C8F961}.Release|Any CPU.ActiveCfg = Release|Any CPU {62BC3801-F0D3-44A9-A0AC-712F40C8F961}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62BC3801-F0D3-44A9-A0AC-712F40C8F961}.Release|Any CPU.Build.0 = Release|Any CPU {62BC3801-F0D3-44A9-A0AC-712F40C8F961}.Release|Any CPU.Build.0 = Release|Any CPU
{E038A3C1-9055-4BF4-BE5B-0E7D661A7EB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E038A3C1-9055-4BF4-BE5B-0E7D661A7EB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E038A3C1-9055-4BF4-BE5B-0E7D661A7EB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E038A3C1-9055-4BF4-BE5B-0E7D661A7EB3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE


BIN
data/nb_example.npy View File


+ 0
- 4
src/TensorFlowNET.Core/TensorFlowNET.Core.csproj View File

@@ -62,10 +62,6 @@ Docs: https://tensorflownet.readthedocs.io</Description>
<Folder Include="Keras\Initializers\" /> <Folder Include="Keras\Initializers\" />
</ItemGroup> </ItemGroup>


<ItemGroup>
<ProjectReference Include="..\..\..\NumSharp\src\NumSharp.Core\NumSharp.Core.csproj" />
</ItemGroup>

<ItemGroup> <ItemGroup>
<Reference Include="NumSharp.Core"> <Reference Include="NumSharp.Core">
<HintPath>..\..\..\..\NumSharp\src\NumSharp.Core\bin\Debug\netstandard2.0\NumSharp.Core.dll</HintPath> <HintPath>..\..\..\..\NumSharp\src\NumSharp.Core\bin\Debug\netstandard2.0\NumSharp.Core.dll</HintPath>


+ 10
- 4
test/TensorFlowNET.Examples/BasicModels/NaiveBayesClassifier.cs View File

@@ -5,6 +5,8 @@ using Tensorflow;
using NumSharp; using NumSharp;
using System.Linq; using System.Linq;
using static Tensorflow.Python; using static Tensorflow.Python;
using System.IO;
using TensorFlowNET.Examples.Utility;


namespace TensorFlowNET.Examples namespace TensorFlowNET.Examples
{ {
@@ -34,10 +36,10 @@ namespace TensorFlowNET.Examples
var (xx, yy) = np.meshgrid(np.linspace(x_min, x_max, 30), np.linspace(y_min, y_max, 30)); var (xx, yy) = np.meshgrid(np.linspace(x_min, x_max, 30), np.linspace(y_min, y_max, 30));
with(tf.Session(), sess => with(tf.Session(), sess =>
{ {
var samples = np.vstack<float>(xx.ravel(), yy.ravel());
samples = np.transpose(samples);
var array = np.Load<double[,]>("H:\\PythonApplication1\\PythonApplication1\\data.npy");
samples = np.array(array).astype(np.float32);
//var samples = np.vstack<float>(xx.ravel(), yy.ravel());
//samples = np.transpose(samples);
var array = np.Load<double[,]>(Path.Join("nb", "nb_example.npy"));
var samples = np.array(array).astype(np.float32);
var Z = sess.run(predict(samples)); var Z = sess.run(predict(samples));
}); });


@@ -170,6 +172,10 @@ namespace TensorFlowNET.Examples
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2); 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2);


string url = "https://raw.githubusercontent.com/SciSharp/TensorFlow.NET/master/data/nb_example.npy";
Web.Download(url, "nb", "nb_example.npy");
#endregion #endregion
} }




Loading…
Cancel
Save