DeepSharp.Pipelines
0.3.0
See the version list below for details.
dotnet add package DeepSharp.Pipelines --version 0.3.0
NuGet\Install-Package DeepSharp.Pipelines -Version 0.3.0
<PackageReference Include="DeepSharp.Pipelines" Version="0.3.0" />
<PackageVersion Include="DeepSharp.Pipelines" Version="0.3.0" />
<PackageReference Include="DeepSharp.Pipelines" />
paket add DeepSharp.Pipelines --version 0.3.0
#r "nuget: DeepSharp.Pipelines, 0.3.0"
#:package DeepSharp.Pipelines@0.3.0
#addin nuget:?package=DeepSharp.Pipelines&version=0.3.0
#tool nuget:?package=DeepSharp.Pipelines&version=0.3.0
<img src="https://raw.githubusercontent.com/xkqg/DeepSharp/main/assets/icon.png" width="96" align="right" alt="" />
DeepSharp — deep learning in C#
The best of three worlds: TensorFlow's way of describing a network, PyTorch's way of running it, and ML.NET's way of learning from a table.
DeepSharp is the C# layer over the engines that already exist: you describe, train and use a network in C#, and the arithmetic runs on .NET's own vector maths out of the box or on a heavier engine later — swapping between them does not change a line of your model. What it adds is everything around the engine: getting your data in, the layers, the training loop, the checkpoints and the pictures. And a table that a tree learns better than a network does not have to become a network: the same prepared data is meant for ML.NET's trainers too.
0.3.0 is the tensors, the data half, and a notebook to see the data in and choose its columns — in Verso, in an application of your own, or in your browser from DeepSharp's own server. What learns from them is next; the roadmap says in which order, and the changelog records what each release added.
dotnet add package DeepSharp
dotnet add package DeepSharp.Pipelines
using DeepSharp.Pipelines;
var prepared = Pdd.Create()
.ReadCsv("btceur-1d.csv") // declared, not opened
.Declare(schema => schema
.Timestamp("timestamp")
.Number("close")
.Optional("trades", ColumnKind.Number)) // a column that may have gaps
.SplitByTime("timestamp", train: 0.70, validation: 0.15) // test is the rest
.FillMissing("trades", With.Mean) // only offered after the split
.Normalise("close")
.Build()
.Run();
The course from raw data to a validated model is declared once as an artefact and replayed, and anything that learns from the data is fitted on the training rows alone. That is the whole idea, and PDD is where it is explained.
The steps and what they learned are one file: prepared.ToJson() writes it, and
PreparedData.FromJson(text, StepCatalog.BuiltIn()) reads it back in a program that has never seen the data.
The catalog is the list of verbs the reader knows — add .WithIndicators() for a file that holds indicators,
which read the rows in their order and so need that order said first, with .OrderBy("timestamp").
A notebook to see it in
DeepSharp.Verso.Notebooks writes the same pipeline as a Verso notebook,
one block per step, each block the step's own JSON — edited as text, or field by field in Verso's properties
panel. "Show the data here" on a block runs the pipeline down to it and shows the rows there, each column
coloured over the training rows and every row marked with the part it lands in. A box on the grid leaves a
column out — it turns black — or makes it a category, and the notebook writes the step that does it. "Choose the
columns" lists every column of the source with its first values: tick it in or out, pick its kind, make it the
answer and set the answer's own values — or tick a range, and seventy bands of a flock are taken in, or made the
answer, with two ticks. What the blocks decide about their columns is saved beside the notebook, and the toolbar
takes a saved file over again, listing every change before it makes one and every saved decision it cannot make.
It also runs the whole pipeline and exports it as the same file the chain writes.
Install it from Verso's Extensions panel. The same package runs in Verso's VS Code extension, in the browser
editor verso serve opens, and inside an application of your own, through DeepSharp.Verso.Api — the
Notebook page says what each needs. Or let
DeepSharp's own server show it in your browser, with nothing else to install:
dotnet tool install --global DeepSharp.Verso.Serve
deepsharp-serve titanic.verso
It listens on this computer alone and answers only the address it prints, token and all.
A C# cell in the same notebook reads what the blocks declare, as text — it is there after "Show the data here" or the toolbar's run, and taken back whenever the blocks may no longer make it:
#r "nuget: DeepSharp.Pipelines.Indicators"
using DeepSharp.Pipelines;
if (Variables.TryGet<string>("deepsharp.pipeline", out var text))
{
var folder = Variables.TryGet<string>("deepsharp.folder", out var saved) ? SourceFolder.Of(saved) : SourceFolder.WorkingDirectory;
var declaration = PipelineDeclaration.FromJson(text, StepCatalog.BuiltIn().WithIndicators());
var prepared = new Pipeline(declaration, rows: null, folder).Run();
}
Read on
| Getting started | Install it, add two tensors, prepare a real file. |
| PDD | The idea this library is built around, and the mistake it removes. |
| Pipeline | Every verb in the order you write it: readers, features, the split, gaps, scales, what a model is asked to predict, the handover. |
| Notebook | A pipeline written block by block in Verso, and the data at any block. |
| Architecture | The design decisions, and what was deliberately left out. |
| Next to TorchSharp, TensorFlow.NET and ML.NET | What those give you, what they do not, why the choice of engine stays a choice, and where a trainer from ML.NET fits. |
| Quality | What has to be true before anything is allowed in. |
| Roadmap | What is next, and in which order. |
| Contributing | A failing test first, no warnings, a coverage check that fails rather than reports. |
| Security | What counts as a vulnerability here, and how to report one. |
The packages
DeepSharp |
The tensors, their shape, and the backend the arithmetic runs on. |
DeepSharp.Pipelines |
The data half: readers, features, the split, gaps, scales, the answer in four kinds, the handover, and the column decisions saved on their own and taken over — saved as a file and replayed. |
DeepSharp.Pipelines.DataFrame |
One reader for the long tail: a CSV, a database query, rows already in hand — anything that fills Microsoft's DataFrame, Microsoft.Data.Analysis, reached through MatPlotLibNet.DataFrame. |
DeepSharp.Pipelines.Indicators |
Twelve indicators over a series as pipeline verbs, the arithmetic borrowed from MatPlotLibNet rather than written again. |
DeepSharp.Verso.Notebooks |
A pipeline written as a Verso notebook, one block per step, with the data, a profile and a heatmap at any block, and its columns chosen from the grid or a list and saved beside it. It runs in Verso's VS Code extension, in verso serve, in DeepSharp's own server and in an application of your own. |
DeepSharp.Verso.Api |
An application of your own hosting the notebook: one open notebook for each file, however many views show it, with the notebook's parts registered by the package itself — so a program published as a single file has them too. Typing, running, a click on a block's controls and the toolbar's buttons take their turn one at a time; a cell is added after another or at the end, of any kind the engine has, taken away, moved past its neighbour or turned into another kind, each only where the notebook's layout allows it; as a cell's text is typed, its kernel offers what may come next and says what a word means, even while a run is under way; a new notebook is made as one block that reads a CSV file, never over a file that is there already; a run can be stopped, one that never ends or one that still waits for another notebook's C# run, a file a button hands over goes to whoever pressed it, the properties panel comes back field by field, the layout, the theme and the title are changed as Verso's editors change them, and what a person does to the dashboard's tiles goes to the layout's own part. The notebook opens and saves as Verso's browser editor does, writing nothing into it that the engine only falls back on; every view is told what changed, version by version — the cells, the run under way and what runs that no run owns, the toolbar, whether anything is unsaved, what became of the kernels, what the dashboard or the presentation draws, and what the notebook says of itself; a notebook no view shows can close by itself when nothing in it is unsaved, a close stops the run under way instead of waiting for it, and the cells, and what they show, come back as plain values. |
DeepSharp.Verso.Serve |
DeepSharp's own server: deepsharp-serve, a .NET tool, shows a notebook or a folder of them in your browser, on Verso's engine and built on DeepSharp.Verso.Api, with nothing else to install. It listens on this computer alone, answers only the address it prints, makes a change only for its own page, and writes into its folder only the notebooks it serves, what they save beside themselves, and a new notebook a page asks for, never over a file that is there; Ctrl+C ends it at once, whatever a notebook runs. Its page does what Verso's editor does, over one connection a tab, and carries everything it draws with, so it fetches nothing: the blocks, failures, JSON, CSV, progress, Mermaid diagrams and KaTeX formulas drawn as Verso draws them, a widget in a sandboxed frame, the dashboard and the presentation as the engine arranges them; the Metadata, Properties and View panels; Verso's keys, and what a cell's kernel offers and what a word means as its text is typed; the kernels' status, a dot while anything is unsaved, and the Stop where Run All stood. A cell is added, taken away once you say yes, moved or turned into another kind there, where the notebook's layout allows it; a file a button hands over arrives as a download; a dropped connection comes back by itself, keeping what was typed; and a folder's page makes a new notebook. |
Runs on .NET 8 and .NET 10. MIT — see LICENSE. The page
deepsharp-serve serves carries Mermaid and KaTeX, each under its own MIT licence, named in the tool's
third-party notices.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
-
net8.0
NuGet packages (5)
Showing the top 5 NuGet packages that depend on DeepSharp.Pipelines:
| Package | Downloads |
|---|---|
|
DeepSharp.Pipelines.Indicators
Financial and signal-processing indicators as pipeline features, borrowed from MatPlotLibNet rather than written again: moving averages, RSI, ATR, ADX, MACD, Bollinger bands, stochastic, VWAP and more, each arriving as one or more columns before the split because an indicator learns nothing from the data as a whole. Two properties are tested rather than promised — the window only looks backwards, and the warm-up is an absence rather than a value. |
|
|
DeepSharp.Pipelines.DataFrame
Reads a DeepSharp pipeline's rows out of Microsoft's DataFrame, Microsoft.Data.Analysis, or out of anything that can fill one: a comma-separated file, a database query, rows somebody already had. One reader for the long tail of formats, so the pipeline itself needs none of them. A comma-separated file comes through as the text it writes, so the pipeline's own schema decides what each column holds, and a database query says what its columns hold as the database types them. An absent value stays absent rather than becoming a not-a-number, because never-there and arithmetic-went-wrong are different answers. |
|
|
DeepSharp.Verso.Notebooks
A DeepSharp pipeline written as a notebook in Verso, one block per step. Each block is the step's own JSON, edited as text or in Verso's properties panel, and shows the data at that point on request: a grid coloured per column over the training rows, a profile that names what should not be there and how each is answered, with a box that gives an answer which changes the columns, and a heatmap of the complete training rows. Columns are chosen from the grid or from a list of the source's columns, which says what each column's cells propose it holds, and the decisions are saved beside the notebook and taken over again. The notebook is the declaration — exported as the same pipeline file, and handed to C# cells as text. It runs in Verso's VS Code extension, in verso serve, in DeepSharp's own server deepsharp-serve and in an application of your own. |
|
|
DeepSharp.Charts
The charts of a DeepSharp run, drawn from what the training loop and the measures already keep, never from arrays anybody assembles: the loss curve of the training and the validation rows, the learning rate every epoch took, a confusion matrix as a heatmap of counts, what a model predicted against what was there, what was left over, every measure as bars beside the training rows' average, and a correlation as a heatmap. Each chart is handed out as the text of an SVG, drawn by MatPlotLibNet, and kept in a package of its own so a trainer on a machine with no screen never carries a renderer. |
|
|
DeepSharp.Learners.Networks
Where a DeepSharp network meets a DeepSharp pipeline: a network learns from the rows the pipeline hands over from its training split, every feature on one scale, is judged by its validation rows and never sees its test rows; the pipeline's report measures it in the answer's own units; what it predicts for a row served later comes back as a value, a probability, a price or a count, as the pipeline's way back gives it. The network and the pipeline it was trained behind are one file, which refuses to be read beside any other fit of that pipeline — and a checkpoint is the same file with what the run needs to go on. |
GitHub repositories
This package is not used by any popular GitHub repositories.