Angular 2 Typescript Math Toolkit Statistical Analysis of Tabular Data

TSMT

When you think of importing tabular data containing categorical and numerical data followed by analysis of that data, Excel is the most likely software that comes to mind.  With the Typescript Math Toolkit, many popular types of analyses can be directly incorporated into your Angular 2 or other modern web application.

The latest in my series of Angular2/TSMT demos reads a json data file that corresponds to the used car data set mentioned in chapter 2 of ‘Machine Learning in R’ by Lantz.  A variety of one-way and cross-tab analyses are performed on that data and the results are dynamically populated into an Angular 2 external template.

The template makes liberal use of ngFor, ngIf, and Angular 2-supplied pipes, although it is visually very unimpressive.  While statistical analysis with Typescript Math Toolkit is the primary motivation of the demo, the code distribution also covers how to setup a project for both development/debug and production distribution.  The latter may be considered a release candidate, for example.

Past demos simply built a demo into a build folder that used Angular 2 development bundles and no application bundling.  This is fine for ongoing development and debugging, but not for production distribution.  This new demo uses separate gulp files to build both a dev and prod version of the code.  The production build bundles the framework and application into two separate bundles.  This facilitates one-time load-and-cache of the framework and periodic application updates.  Application bundling is performed using the –outFile option of the Typescript compiler, which allows use of System modules and avoids issues encountered by third-party bundlers with System.register.  You could, however, use jspm as a substitute for npm and a bundler.  This is, perhaps, a good topic for another demo :)

But, what you really want is the code, right.  Well, it is available at a friendly, neighborhood Github near you.  Build instructions are provided and after executing the code, you will be greeting with a rather unimpressive display as shown below (talk about room for improvement :).

table

Expected values from each operation are documented in the code and follow a similar path to various analyses documented in Chapter 2 of Lantz.

Enjoy and I hope you find something valuable in the example.

Comments are closed.