Code Monkey home page Code Monkey logo

sianet's Introduction

Build Status Join the chat at https://gitter.im/sia-cog/SiaNet

A C# deep learning wrapper with CNTK backend

Developing a C# wrapper to help developer easily create and train deep neural network models. I am working on enhancing the interface to load data, build model, train and predict.

Install using NuGet

GPU and CPU Version: https://www.nuget.org/packages/SiaNet

For better performance on CPU please use CPU only version. CPU Only Version: https://www.nuget.org/packages/SiaNet.CPUOnly/

Load dataset (Housing regression example)

DataFrame frame = new DataFrame();

frame.LoadFromCsv(trainFile);

var xy = frame.SplitXY(14, new[] { 1, 13 });

traintest = xy.SplitTrainTest(0.25);

Load Sample Dataset (MNIST)

Downloader.DownloadSample(SampleDataset.MNIST);

var samplePath = Downloader.GetSamplePath(SampleDataset.MNIST);

train = ImageDataGenerator.FlowFromText(samplePath.Train);

validation = ImageDataGenerator.FlowFromText(samplePath.Test);

Build Model

model = new Sequential();

model.Add(new Dense(13, 12, OptActivations.ReLU));

model.Add(new Dense(13, OptActivations.ReLU));

model.Add(new Dense(1));

Build Convolution Layers

model.Add(new Conv2D(Tuple.Create(imageDim[0], imageDim[1], imageDim[2]), 4, Tuple.Create(3, 3), Tuple.Create(2, 2), activation: OptActivations.None, weightInitializer: OptInitializers.Xavier, useBias: true, biasInitializer: OptInitializers.Ones));

model.Add(new MaxPool2D(Tuple.Create(3, 3)));

model.Add(new Conv2D(8, Tuple.Create(3, 3), Tuple.Create(2, 2), activation: OptActivations.None, weightInitializer: OptInitializers.Xavier));

model.Add(new MaxPool2D(Tuple.Create(3, 3)));

model.Add(new Dense(numClasses));

Configure Training callbacks

model.OnEpochEnd += Model_OnEpochEnd;

model.OnTrainingEnd += Model_OnTrainingEnd;

model.OnBatchEnd += Model_OnBatchEnd;

Train Model

model.Compile(OptOptimizers.Adam, OptLosses.MeanSquaredError, OptMetrics.MAE, Regulizers.RegL2(0.1)); model.Train(traintest.Train, 64, 200, traintest.Test);

API Documentation: https://deepakkumar1984.github.io/SiaNet/

Examples Docs (More to add)

Help me improve this project

Donate

sianet's People

Contributors

deepakkumar1984 avatar dragonflyeast avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.