Source code can be download from github.com: https://github.com/xieguigang/VisualBasic_AppFramework Code style guideline for VisualBasic of this runtime library at codeproject article: http://www.codeproject.com/Articles/1101608/Code-style-guidelines-for-Microsoft-VisualBasic Article about manipulate these document at codeproject: http://www.codeproject.com/Articles/1099296/Easy-Document-in-VisualBasic


Keywords
VB.NET, .NET, CLI, Linux, Science, macOS, Data, visualize, Network, data-mining, data-science, graphquery, hdf5, machine-learning, manifold, microsoft-visualbasic, netcdf, network-visualization, t-sne, umap, visualbasic
License
GPL-3.0
Install
Install-Package VB_AppFramework -Version 2.1.0

Documentation

sciBASIC#: Microsoft VisualBasic for Scientific Computing

(๑•̀ㅂ•́)و✧ Github All Releases GPL Licence DOI

[WARNING] This project is a work in progress and is not recommended for production use.

Probably some namespace and object name may changes frequently on each commit, and you are feel free to using the Object Browser in visual studio to adapted to the object not defined problem which was caused by these changes.....


sciBASIC# logo

Read the project documents: http://sciBASIC.NET/

Scientific Computing runtime for VisualBasic.NET

sciBASIC#: A Microsoft VisualBasic feature runtime for data science application on Windows/Linux/macOS And China Tianhe Super Computing Platform. It was mainly consists with a data frame system, a data science analysis system, a data graphics system and a general application core runtime.

sciBASIC#(read as scientific visualbasic or just sciBASIC sharp) is a Microsoft VisualBasic language feature runtime for your data science application which is running in the CLI environment on Windows/Linux/macOS Desktop/Server platform or supercomputer platform. This framework project includes a lot of mathematics utility tools and the utility code extension functions for the data sciences application which is programming in VisualBasic language, and it also extends the VisualBasic programming language syntax. Makes the VisualBasic programming style more modernized in the data science industry by using this runtime library framework.

Abount VisualBasic code style guidelines:

Guides for using this framework, you can found the document and content index at the README.md(This guidelines document is currently compiling for users):


Runtime Installation

  • Compile & Application Development on this runtime required the latest VisualStudio 2017.
  • If you are running sciBASIC runtime on Windows, please makesure your operating system supports .NET framework 4.6
  • If you are running sciBASIC runtime on Linux/macOS, please install mono runtime at first by following the installation manual on mono-project website. And then the Microsoft VisualBasic core runtime is required, you can find this runtime file in this repository: Microsoft.VisualBasic.7z, just extract this 7z archive and put the Microsoft.VisualBasic.dll kernel in the application directory.

Install this framework via nuget package

For .NET Framework 4.6:

# For install latest stable release version:
PM> Install-Package sciBASIC
# For install latest unstable beta version:
PM> Install-Package sciBASIC -Pre

Contacts

Foundation for VisualBasic.NET scientific computing softwares from China: foundation@sciBASIC.NET

Directory Structure

1. source projects
  • /CLI_tools : Some small utilities and example tools
  • /Data : sciBASIC# data framework system for data science, includes data frame, data I/O, natural language text processing and data object search framework.
  • /Data_science : sciBASIC# Mathmatica system, data graphics plot system & Data Mining library
  • /Microsoft.VisualBasic.Core : Microsoft VisualBasic General App core runtime
  • /mime : Various mime-type text or Xml doc parsers in VisualBasic.
  • /gr : sciBASIC# Artists: (graphic artist) VB.NET imaging graphics system
  • /www : Web related utilities code
  • /vs_solutions : sciBASIC framework Windows installer project.
2. docs for User
  • /guides : This framework code usage example and manual documents
  • /vb_codestyle : sciBASIC# Coding style standard document

Namespace

Namespace Description
Microsoft.VisualBasic.ApplicationServices Application tool and Utils for build software in a more easy way
Microsoft.VisualBasic.CommandLine CLI framework for VisualBasic App
* Microsoft.VisualBasic.Data Raw data processing related code and charting plot library for data visualization
* Microsoft.VisualBasic.DataMining sciBASIC data mining library
* Microsoft.VisualBasic.Imaging sciBASIC graphics system based on the GDI+ API from System.Drawing
* Microsoft.VisualBasic.MachineLearning sciBASIC machine learning library
* Microsoft.VisualBasic.Math sciBASIC math library
Microsoft.VisualBasic.MIME MIME type text document parser
Microsoft.VisualBasic.Scripting String expression related API for CLI programming and scripting programming

sciBASIC runtime can be split as two part: Part1 is the general application runtime, like scripting helper, commandline system, and text document parser; Another part of the runtime is the data science runtime, like math function, cluster function, or charting runtime for data visualization. All of the data science related namespace in sciBASIC are marked with asterisk.

FAQs

1. Which platform that I can using this framework? For writing x86/x64 server/Desktop Win32 CLI program.

2. Relationship between Microsoft VisualBasic.NET and sciBASIC? sciBASIC is fully compatible with the native VB.NET language, sciBASIC is a kind of dialect derive from the Microsoft VisualBasic.NET language.

3. Is there any interactive WinForm/WPF control for charting plot? One of this framework its primary target is aim at provides a drawing environment for your CLI program create high quality printable content for scientific manuscript. This framework is not too much involved with "interactive".

4. Any coding style suggestion by using sciBASIC framework? sciBASIC framework is a kind of functional programming runtime for VisualBasic language.

5. Major features Major features of the sciBASIC are:

  • Functional programming
  • Fluent style Method cascading
  • Linq pipeline
  • Parallel computing

ODEs scripting language feature

Example for solving a dynamics system using VisualBasic ODEs scripting language feature, demo created for the Lorenz system:

Dim x, y, z As var
Dim sigma# = 10
Dim rho# = 28
Dim beta# = 8 / 3
Dim t = (a:=0, b:=120, dt:=0.005)

Call Let$(list:=Function() {x = 1, y = 1, z = 1})
Call {
    x = Function() sigma * (y - x),
    y = Function() x * (rho - z) - y,
    z = Function() x * y - beta * z
}.Solve(dt:=t) _
 .DataFrame _
 .Save($"{App.HOME}/Lorenz_system.csv")

Microsoft VisualBasic Trinity Natural Language Processor

TextRank

PageRank analysis on the text paragraph for find out the keyword, here is the pagerank result of the this example paragraph:

"the important pagerank. show on pagerank. have significance pagerank. implements pagerank algorithm. textrank base on pagerank."

Image fast binarization using VisualBasic image extension API

Sub Binarization(ByRef curBitmap As Bitmap, Optional style As BinarizationStyles = BinarizationStyles.Binary)

Imports Microsoft.VisualBasic.Imaging

Dim bitmap As Image = Image.FromFile("./etc/lena/f13e6388b975d9434ad9e1a41272d242_1_orig.jpg")

Call bitmap.Grayscale().SaveAs("./etc/lena/lena.grayscale.png", ImageFormats.Png)
Call bitmap.GetBinaryBitmap
     .SaveAs("./etc/lena/lena.binary.png", ImageFormats.Png)
Call bitmap.GetBinaryBitmap(BinarizationStyles.SparseGray)
     .SaveAs("./etc/lena/lena.gray.png", ImageFormats.Png)
Normal Binary SparseGray Grayscale

sciBASIC# Graphics Artist

Microsoft VisualBasic Data Science & Data Plots System

sciBASIC# Chart Plots System
Imports Microsoft.VisualBasic.Data.ChartPlots

3D heatmap
Dim func As Func(Of Double, Double, (Z#, Color#)) =
_
    Function(x, y) (3 * Math.Sin(x) * Math.Cos(y), Color:=x + y ^ 2)

Call Plot3D.ScatterHeatmap.Plot(
    func, "-3,3", "-3,3",
    New Camera With {
        .screen = New Size(3600, 2500),
        .ViewDistance = -3.3,
        .angleZ = 30,
        .angleX = 30,
        .angleY = -30,
        .offset = New Point(-100, -100)
    }) _
    .SaveAs("./3d-heatmap.png")

Contour Heatmap

You can using a lambda expression as the plot data source:

Dim f As Func(Of Double, Double, Double) =
    Function(x, y) x ^ 2 + y ^ 3

Call ScatterHeatmap _
    .Plot(f, "(-1,1)", "(-1,1)", legendTitle:="z = x ^ 2 + y ^ 3") _
    .SaveAs("./scatter-heatmap.png")

Stacked Barplot

The stacked barplot is a best choice for visualize the sample composition and compares to other samples data:

Imports Microsoft.VisualBasic.Data.ChartPlots

' Plots metagenome taxonomy profiles annotation result using barplot
Dim taxonomy As BarDataGroup = csv.LoadBarData(
    "./FigurePlot-Reference-Unigenes.absolute.level1.csv",
    "Paired:c8") ' Using color brewer color profiles

Call BarPlot.Plot(
    taxonomy,
    New Size(2000, 1400),
    stacked:=True,
    legendFont:=New Font(FontFace.BookmanOldStyle, 18)) _
    .SaveAs("./FigurePlot-Reference-Unigenes.absolute.level1.png")

beta-PDF
Public Function beta(x#, alpha#, _beta#) As Double
    Return Pow(x, alpha - 1) * Pow((1 - x), _beta - 1) *
        Exp(lgamma(alpha + _beta) - lgamma(alpha) - lgamma(_beta))
End Function

Public Function lgamma(x As Double) As Double
    Dim logterm As Double = Math.Log(x * (1.0F + x) * (2.0F + x))
    Dim xp3 As Double = 3.0F + x

    Return -2.081061F - x + 0.0833333F / xp3 -
        logterm + (2.5F + x) * Math.Log(xp3)
End Function

https://en.wikipedia.org/wiki/Beta_distribution

Heatmap

Dim data = DataSet.LoadDataSet("./Quick_correlation_matrix_heatmap/mtcars.csv")

Call data.CorrelatesNormalized() _
    .Plot(mapName:="Jet",  ' Using internal color theme 'Jet'
          mapLevels:=20,
          legendFont:=New Font(FontFace.BookmanOldStyle, 32)) _
    .SaveAs("./images/heatmap.png")
Microsoft.VisualBasic.Mathematical.Plots.Heatmap::Plot(IEnumerable(Of NamedValue(Of Dictionary(Of String, Double))), Color(), Integer, String, Boolean, Size, Size, String, String, String) As Bitmap

Heatmap data source from R dataset mtcars and calculates the Pearson correlations:

data(mtcars)
write.csv(mtcars, "./Data_science/Mathematical/Quick_correlation_matrix_heatmap/mtcars.csv")

New VisualBasic Language Syntax in this runtime

First of all, imports the language feature namespace of VisualBasic

#Region "Microsoft VisualBasic.NET language"
' sciBASIC# general application runtime
' Microsoft.VisualBasic.Architecture.Framework_v3.0_22.0.76.201__8da45dcd8060cc9a.dll
#End Region

Imports Microsoft.VisualBasic.Language
1. Inline value assign

Old:

Dim s As String = ""

Do While Not s Is Nothing
   s = blablabla

   ' Do other staff
Loop

New:

Dim s As New Value(Of String)

Do While Not (s = blablabla) Is Nothing
   ' Do other staff
Loop
2. List(Of ) Add

Old:

Dim l As New List(Of String)

Call l.Add("123")
Call l.AddRange(From x In 100.Sequence Select CStr(x))

New:

Dim l As New List(Of String)

l += "123"
l += From x As Integer
     In 100.Sequence
     Select CStr(x)
New Integer(int) type in visualbasic
  • value ranges syntax
Dim min As int = 1
Dim max As int = 200
Dim x% = 199

' Compares
Call println(min <= x < max) ' True
x += 10 ' 209
Call println(min <= x < max) ' False
x = -1
Call println(min <= x < max) ' False
  • inline calculation and value assign
Dim bitChunk As Byte() = New Byte(INT64 - 1) {}
Dim p As int = Scan0

Call Array.ConstrainedCopy(rawStream, ++(p + INT64), bitChunk, Scan0, INT64)
ProtocolCategory = BitConverter.ToInt64(bitChunk, Scan0)

Call Array.ConstrainedCopy(rawStream, ++(p + INT64), bitChunk, Scan0, INT64)
Protocol = BitConverter.ToInt64(bitChunk, Scan0)

bitChunk = New Byte(INT64 - 1) {}
Call Array.ConstrainedCopy(rawStream, p = (p + INT64), bitChunk, Scan0, INT64)
BufferLength = BitConverter.ToInt64(bitChunk, Scan0)

Copyleft 2018, I@xieguigang.me (http://sciBASIC.NET/)