NumSharp 0.20.0

NumSharp is the fundamental library for scientific computing with .NET providing a similar API to python's numpy scientific library. NumSharp has full N-D, broadcasting and axis support.  If you want to use .NET to get started with machine learning, NumSharp will be your best tool.

There is a newer version of this package available.
See the version list below for details.
Install-Package NumSharp -Version 0.20.0
dotnet add package NumSharp --version 0.20.0
<PackageReference Include="NumSharp" Version="0.20.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NumSharp --version 0.20.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

NumSharp

NumPy port in C# .NET Standard<a href="http://scisharpstack.org"><img src="https://github.com/SciSharp/SciSharp/blob/master/art/scisharp_badge.png" width="200" height="200" align="right" /></a>

Join the chat at https://gitter.im/publiclab/publiclab
AppVeyor
codecov
NuGet
Badge

Is it difficult to translate python machine learning code into C#? Because too many functions can’t be found in the corresponding code in the .Net SDK. NumSharp is the C# version of NumPy, which is as consistent as possible with the NumPy programming interface, including function names and parameter locations. By introducing the NumSharp tool library, you can easily convert from python code to C# code. Here is a comparison code between NumSharp and NumPy (left is python, right is C#):

comparision

If you want to read some more informations, we start a doc on https://scisharp.github.io/NumSharp/.

NumSharp has implemented the arange, array, max, min, reshape, normalize, unique interfaces. More and more interfaces will be added to the library gradually. If you want to use .NET to get started with machine learning, NumSharp will be your best tool library.

Implemented APIs

The NumPy class is a high-level abstraction of NDArray that allows NumSharp to be used in the same way as Python's NumPy, minimizing API differences caused by programming language features, allowing .NET developers to maximize Utilize a wide range of NumPy code resources to seamlessly translate python code into .NET code.

Check the code: src\NumSharp.Core\APIs

How to use

using NumSharp;
// create a vector
var nd = np.arange(12)

// create a matrix
nd = np.arange(12).reshape(3, 4);

// access data by index
var data = nd[1, 1];

// create a tensor
nd = np.arange(12).reshape(2, 3, 2);

// get the 2nd vector in the 1st dimension
data = n[new Shape(1)];

// get the 3rd vector in the (axis 1, axis 2) dimension
data = n[new Shape(1, 2)];

// interate ndarray
foreach (data in nd)
{
  // data is a ndarray or a value
}

Install NumSharp in NuGet

PM> Install-Package NumSharp

How to make docs

  • Download docfx and put on PATH &rarr; https://github.com/dotnet/docfx/releases
  • docfx ./docfx_project/docfx.json -o ./docs

How to run benchmark

C: \> dotnet NumSharp.Benchmark.dll nparange

Reference the documents generated by DocFX.

Reference the documents host on readthedocs.io.

NumSharp is referenced by:

You might also be interested in NumSharp's sister project Numpy.NET.

NumSharp is a member project of SciSharp.org which is the .NET based ecosystem of open-source software for mathematics, science, and engineering.
Welcome to fork and pull request to add more APIs, and make reference list longer.

<img src="https://avatars3.githubusercontent.com/u/44989469?s=200&v=4" width="80">

Join us on Gitter

Scan QR code to join TIM group:

SciSharp STACK

NumSharp

NumPy port in C# .NET Standard<a href="http://scisharpstack.org"><img src="https://github.com/SciSharp/SciSharp/blob/master/art/scisharp_badge.png" width="200" height="200" align="right" /></a>

Join the chat at https://gitter.im/publiclab/publiclab
AppVeyor
codecov
NuGet
Badge

Is it difficult to translate python machine learning code into C#? Because too many functions can’t be found in the corresponding code in the .Net SDK. NumSharp is the C# version of NumPy, which is as consistent as possible with the NumPy programming interface, including function names and parameter locations. By introducing the NumSharp tool library, you can easily convert from python code to C# code. Here is a comparison code between NumSharp and NumPy (left is python, right is C#):

comparision

If you want to read some more informations, we start a doc on https://scisharp.github.io/NumSharp/.

NumSharp has implemented the arange, array, max, min, reshape, normalize, unique interfaces. More and more interfaces will be added to the library gradually. If you want to use .NET to get started with machine learning, NumSharp will be your best tool library.

Implemented APIs

The NumPy class is a high-level abstraction of NDArray that allows NumSharp to be used in the same way as Python's NumPy, minimizing API differences caused by programming language features, allowing .NET developers to maximize Utilize a wide range of NumPy code resources to seamlessly translate python code into .NET code.

Check the code: src\NumSharp.Core\APIs

How to use

using NumSharp;
// create a vector
var nd = np.arange(12)

// create a matrix
nd = np.arange(12).reshape(3, 4);

// access data by index
var data = nd[1, 1];

// create a tensor
nd = np.arange(12).reshape(2, 3, 2);

// get the 2nd vector in the 1st dimension
data = n[new Shape(1)];

// get the 3rd vector in the (axis 1, axis 2) dimension
data = n[new Shape(1, 2)];

// interate ndarray
foreach (data in nd)
{
  // data is a ndarray or a value
}

Install NumSharp in NuGet

PM> Install-Package NumSharp

How to make docs

  • Download docfx and put on PATH &rarr; https://github.com/dotnet/docfx/releases
  • docfx ./docfx_project/docfx.json -o ./docs

How to run benchmark

C: \> dotnet NumSharp.Benchmark.dll nparange

Reference the documents generated by DocFX.

Reference the documents host on readthedocs.io.

NumSharp is referenced by:

You might also be interested in NumSharp's sister project Numpy.NET.

NumSharp is a member project of SciSharp.org which is the .NET based ecosystem of open-source software for mathematics, science, and engineering.
Welcome to fork and pull request to add more APIs, and make reference list longer.

<img src="https://avatars3.githubusercontent.com/u/44989469?s=200&v=4" width="80">

Join us on Gitter

Scan QR code to join TIM group:

SciSharp STACK

Release Notes

Most of the library (>95%) has been rewritten within over 400 commits in course of 3 months.

- Full n-d, slice, broadcasting and axis support in all reimplemented methods (e.g. np.sum, np.concatenate) Broadcasting n-d shapes against each other.

- NDArray Slicing and nested slicing (nd["-1, ::2"]["1::3, :, 0"])

- Full and precise (to numpy) type resolving and conversion (upcasting, downcasting and all other cases)

- Use of unmanaged memory and unsafe code in favor of performance.

- NumSharp no longer perform copies except for cases when numpy does. Compared to previous version, indexing an n-d array (e.g. nd[0,1] when shape is (3,3,3,3)) would return a copy when now it returns a reference (alias).

Showing the top 5 GitHub repositories that depend on NumSharp:

Repository Stars
SciSharp/TensorFlow.NET
.NET Standard bindings for Google's TensorFlow for developing, training and deploying Machine Learning models in C#.
SciSharp/BotSharp
The Open Source AI Chatbot Platform Builder in 100% C# Running in .NET Core with Machine Learning algorithm.
SciSharp/NumSharp
High Performance Computation for N-D Tensors in .NET, similar API to NumPy.
SciSharp/SiaNet
An easy to use C# deep learning library with CUDA/OpenCL support
SciSharp/Pandas.NET
Pandas port in C#, data analysis tool.

Read more about the GitHub Usage information on our documentation.

Version History

Version Downloads Last updated
0.20.4 25,212 10/5/2019
0.20.3 646 9/28/2019
0.20.2 574 9/11/2019
0.20.1 10,679 9/1/2019
0.20.0 587 8/20/2019
0.10.6 14,015 7/24/2019
0.10.5 230 7/22/2019
0.10.4 202 7/18/2019
0.10.3 936 6/15/2019
0.10.2 384 5/25/2019
0.10.1 624 5/11/2019
0.10.0 325 5/5/2019
0.9.0 682 4/15/2019
0.8.3 380 3/29/2019
0.8.2 339 3/25/2019
0.8.1 198 3/22/2019
0.8.0 640 3/12/2019
0.7.4 249 3/7/2019
0.7.3 944 2/20/2019
0.7.2 187 2/18/2019
0.7.1 213 2/12/2019
0.7.0 266 1/28/2019
0.6.6 210 1/26/2019
0.6.5 273 1/11/2019
0.6.4 227 1/7/2019
0.6.3 239 12/30/2018
0.6.2 371 12/27/2018
0.6.1 196 12/26/2018
0.6.0 255 12/21/2018
0.5.0 310 12/5/2018
0.4.0 208 11/21/2018
0.3.0 226 11/7/2018
0.2.0 402 10/29/2018
0.1.0 258 10/10/2018