| @@ -15,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Visualization | |||||
| EndProject | EndProject | ||||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KerasNET.Core", "..\Keras.NET\src\KerasNET.Core\KerasNET.Core.csproj", "{E2F0C39C-D706-4CF5-AE00-81FB447F949D}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KerasNET.Core", "..\Keras.NET\src\KerasNET.Core\KerasNET.Core.csproj", "{E2F0C39C-D706-4CF5-AE00-81FB447F949D}" | ||||
| EndProject | EndProject | ||||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NumSharp.Core", "..\NumSharp\src\NumSharp.Core\NumSharp.Core.csproj", "{62360571-D1F7-473C-B81F-F03CA59E37DD}" | |||||
| EndProject | |||||
| Global | Global | ||||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| Debug|Any CPU = Debug|Any CPU | Debug|Any CPU = Debug|Any CPU | ||||
| @@ -45,6 +47,10 @@ Global | |||||
| {E2F0C39C-D706-4CF5-AE00-81FB447F949D}.Debug|Any CPU.Build.0 = Debug|Any CPU | {E2F0C39C-D706-4CF5-AE00-81FB447F949D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| {E2F0C39C-D706-4CF5-AE00-81FB447F949D}.Release|Any CPU.ActiveCfg = Release|Any CPU | {E2F0C39C-D706-4CF5-AE00-81FB447F949D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| {E2F0C39C-D706-4CF5-AE00-81FB447F949D}.Release|Any CPU.Build.0 = Release|Any CPU | {E2F0C39C-D706-4CF5-AE00-81FB447F949D}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| {62360571-D1F7-473C-B81F-F03CA59E37DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {62360571-D1F7-473C-B81F-F03CA59E37DD}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {62360571-D1F7-473C-B81F-F03CA59E37DD}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
| {62360571-D1F7-473C-B81F-F03CA59E37DD}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
| EndGlobalSection | EndGlobalSection | ||||
| GlobalSection(SolutionProperties) = preSolution | GlobalSection(SolutionProperties) = preSolution | ||||
| HideSolutionNode = FALSE | HideSolutionNode = FALSE | ||||
| @@ -0,0 +1,11 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Text; | |||||
| namespace Tensorflow | |||||
| { | |||||
| public static partial class tf | |||||
| { | |||||
| public static nn_impl nn => new nn_impl(); | |||||
| } | |||||
| } | |||||
| @@ -23,6 +23,17 @@ namespace Tensorflow | |||||
| return x; | return x; | ||||
| }); | }); | ||||
| } | } | ||||
| /// <summary> | |||||
| /// | |||||
| /// </summary> | |||||
| /// <param name="input_tensor"></param> | |||||
| /// <param name="axes"></param> | |||||
| /// <param name="keepdims"></param> | |||||
| /// <param name="name"></param> | |||||
| public static void reduce_mean(Tensor input_tensor, int[] axes = null, bool keepdims = false, string name = null) | |||||
| { | |||||
| } | |||||
| /// <summary> | /// <summary> | ||||
| /// Helper function for reduction ops. | /// Helper function for reduction ops. | ||||
| @@ -0,0 +1,32 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Text; | |||||
| namespace Tensorflow | |||||
| { | |||||
| public class nn_impl : Python | |||||
| { | |||||
| /// <summary> | |||||
| /// Calculate the mean and variance of `x` | |||||
| /// </summary> | |||||
| /// <param name="x"></param> | |||||
| /// <param name="axes"></param> | |||||
| /// <param name="name"></param> | |||||
| /// <param name="keep_dims"></param> | |||||
| /// <returns></returns> | |||||
| public (Tensor, Tensor) moments(Tensor x, | |||||
| int[] axes, | |||||
| string name = null, | |||||
| bool keep_dims = false) | |||||
| { | |||||
| with<ops.name_scope>(new ops.name_scope(name, "moments", new { x, axes }), scope => | |||||
| { | |||||
| var y = math_ops.cast(x, TF_DataType.TF_FLOAT); | |||||
| // mean = math_ops.reduce_mean(y, axes, keepdims = True, name = "mean") | |||||
| }); | |||||
| throw new NotImplementedException(""); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -55,4 +55,8 @@ Docs: https://tensorflownet.readthedocs.io</Description> | |||||
| <Folder Include="APIs\Keras\" /> | <Folder Include="APIs\Keras\" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\..\..\NumSharp\src\NumSharp.Core\NumSharp.Core.csproj" /> | |||||
| </ItemGroup> | |||||
| </Project> | </Project> | ||||
| @@ -2,6 +2,8 @@ | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Text; | using System.Text; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using NumSharp.Core; | |||||
| using System.Linq; | |||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| { | { | ||||
| @@ -9,10 +11,28 @@ namespace TensorFlowNET.Examples | |||||
| /// https://github.com/nicolov/naive_bayes_tensorflow | /// https://github.com/nicolov/naive_bayes_tensorflow | ||||
| /// </summary> | /// </summary> | ||||
| public class NaiveBayesClassifier : Python, IExample | public class NaiveBayesClassifier : Python, IExample | ||||
| { | |||||
| { | |||||
| public void Run() | public void Run() | ||||
| { | { | ||||
| throw new NotImplementedException(); | |||||
| // t/f.nn.moments() | |||||
| } | |||||
| public void fit(NDArray X, NDArray y) | |||||
| { | |||||
| // separate training points by class | |||||
| // shape : nb_class * nb_samples * nb_features | |||||
| NDArray unique_y = y.unique<long>(); | |||||
| NDArray points_by_class = np.array(y.Data<long>().Where(ys => unique_y.Data<long>().Contains(ys))); | |||||
| foreach (long cls in unique_y) | |||||
| { | |||||
| } | |||||
| // estimate mean and variance for each class / feature | |||||
| // shape : nb_classes * nb_features | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -12,6 +12,7 @@ | |||||
| <ItemGroup> | <ItemGroup> | ||||
| <ProjectReference Include="..\..\..\Keras.NET\src\KerasNET.Core\KerasNET.Core.csproj" /> | <ProjectReference Include="..\..\..\Keras.NET\src\KerasNET.Core\KerasNET.Core.csproj" /> | ||||
| <ProjectReference Include="..\..\..\NumSharp\src\NumSharp.Core\NumSharp.Core.csproj" /> | |||||
| <ProjectReference Include="..\..\src\TensorFlowNET.Core\TensorFlowNET.Core.csproj" /> | <ProjectReference Include="..\..\src\TensorFlowNET.Core\TensorFlowNET.Core.csproj" /> | ||||
| <ProjectReference Include="..\..\src\TensorFlowNET.Utility\TensorFlowNET.Utility.csproj" /> | <ProjectReference Include="..\..\src\TensorFlowNET.Utility\TensorFlowNET.Utility.csproj" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||