Battle-Tested JavaScript Frameworks – Part 3, Data Science.
Table of Contents

Battle-Tested JavaScript Frameworks – Part 3, Data Science.

Summary

  • Node.js, and JavaScript for Data Science? Yes!
  • JavaScript is not the usual choice for Data Science, though there is no reason why would it not work, especially with TypeScript, Though you won't find Pandas or NumPy, there are high-quality alternatives available;
  • Below, you may find some of the most reliable JavaScript packages used for data analytics, visualization, and complex mathematical operations;
  • If you can’t work without your favorite Python library, there is a solution for that. Pyodide lets you run your .py libraries in browsers.

Data Science is traditionally the domain of Python; perhaps R, Swift, or Julia. Wanting to use JavaScript in this context is traditionally thought of as walking into somebody’s house with muddy shoes. Nevertheless, JavaScript for Data Science works, and as people say “if it works, but it looks stupid – it isn’t stupid.” 

Below, we present the tools that developers may use to process, analyze, and visualize data with JavaScript.

Artificial Intelligence

TensorFlow.js

A description of the TensorFlow.js project.
Source: https://github.com/tensorflow/tfjs

JavaScript’s version of the famous TensorFlow, this is the library that will satisfy your machine learning, and deep learning needs. Announced in 2018, for many this even was a true enablement of building smart services. What’s even better, is that this solved the problem of app distribution, and compatibility with one’s OS. Why worry about platform-specific ways of handling things? Just let browsers take care of that for you!

If you want more proof, that the library is indeed useful, and not a gimmick, then we have a video for you. Here is a short overview of one of the projects, TeamSportz.Pro, with a functionality built with tf.js. 

If that video was not enough to convince you, there are dozens of other examples for you to see. The team made sure you saw them, and shared them with everybody in their GitHub repository.

The Verdict

With frequent updates, backing from a large corporation, and using TypeScript to provide type safety, we have no other choice than to tell you: go for it. There simply is not much more to say.

Repository

https://github.com/tensorflow/tfjs

Visualization

Plotly.js

Source: https://github.com/plotly/plotly.js/

The sibling of the popular plotly Python package (often referred to as Plotly.py), “can be used to produce dozens of chart types and visualizations, including statistical charts, 3D graphs, scientific charts, SVG and tile maps, financial charts and more.

Interestingly, the library also powers the more popular Plotly.py package.

The verdict

While enjoying an immense popularity in the Python ecosystem, in the JavaScript world it is not nearly as popular; partially due to the reason of different uses of the two languages. Nevertheless, Plotly.js is a reliable choice for any of your future projects. 

Repo

https://github.com/plotly/plotly.js/


Chart.js

A description of the Chart.js project as seen on their GitHub repository.
Source: https://github.com/chartjs/Chart.js

Chart.js is the “simple yet flexible” JavaScript charting library for those who want to visualize some data. 

It really is simple to get started: below you may find a basic set up, which renders a sample chart.


A code example showing how easy it is to create a chart using Chart.js.
Code Source: https://www.chartjs.org/docs/latest/getting-started/

The Verdict

With an effortless set-up, and immense popularity as expressed by a considerable number of starts on GitHub, it’s a solid option. The only concern is its size: according to bundlephobia it’s…~ 64 kB (minified + gzipped). 

Repo

https://github.com/chartjs/Chart.js


D3.js

Source: https://github.com/d3/d3


For many, considered a standard in visualizing data. It certainly belongs to the more powerful ones. The charts & graphs one can create are quite impressive. Especially with powerful integrations available for use.

One of them is the integration with Three.js. It allows you to create some spectacular graphs that let you immerse in the data & grasp it. Literally. In VR. 


A graph of interconnected dots in 3D showing how close the characters of Les Miserables were.
Screenshot of an interactive graph representing how close each character of “Les Misérables” was. Source: https://bl.ocks.org/vasturiano/raw/972ca4f3e8e074dacf14d7071aad8ef9/?raw=true

The Verdict

Is there anything more to say here than “absolutely yes”? Be careful of the bundle size, however. It's 89 kB, though you may decrease it beyond that.

Repo

https://github.com/d3/d3

Processing Data

Math.js

Source: https://github.com/josdejong/mathjs

Math.js is a very popular scientific library for JavaScript, and Node.js. With 1.1 million downloads a month, you can’t say it’s a niche solution. The number of scientific operations supported is overwhelming, while also offers you an easy way of working with complex numbers, fractions, units, and matrices.

The Verdict

Even though “only” plain JavaScript reigns over the library, there are built-in type declarations available for you. With the plethora of functionality, popularity, and full TypeScript support, we don’t have a choice – go for it! Did we mention that the tests cover 94% of total code?

Repo

https://github.com/josdejong/mathjs

Stdlib

Source: https://github.com/stdlib-js/stdlib

An open-source effort, to create a set of basic functionality one may use in JavaScript. Package’s name should perhaps be stdmathlib, instead. That would indicate the focus of the author to develop a package of common, more advanced, mathematical operations… and indeed it seems the author pulled that off quite well! The number of built-in functions are quite impressive. The only concern is the large number of Issues currently open. We’d say go for it, though be careful.

The Verdict

The project is fine, and very much alive. There is more than a couple of thousand stars on GitHub, showing us that there are plenty of people liking the project. 

Repo

https://github.com/stdlib-js/stdlib

Fermat.js

Source: https://github.com/mathigon/fermat.js

A “powerful mathematics and statistics library” with plenty of useful functions for you to use in your next project.

It’s a part of a bigger project, mathigon.io, aiming to form the future of education… and Fermat is not the only thing they have shared with the community.

The Verdict

Overall, the maintainers are doing a pretty solid job of staying on top of incoming pull requests. The library is also a part of a larger ecosystem, so we see it developing even further, providing developers with more and more functionalities.

Repo

https://github.com/mathigon/fermat.js

Bonus

Note: All libraries below may or may not run your code. We advise against using them in production apps, though ultimately, it is your choice.

Can’t say goodbye to your favorite data science libraries, but need to run them in a web browser? Even though we cannot say we are using JavaScript, we do remain in the realms of the same world.

Remember, though, that some of your favorite projects might not run in browsers. That is due to all the bindings to C/C++, and other features. Though maybe in the future we will have JavaScript libraries that use your GPU for the heavy lifting: developers are already exploring what’s possible.

Python - Pyodide

Source: https://github.com/pyodide/pyodide

Pyodide lets you run your Python run in browsers. The best aspect? 

Pyodide makes it possible to install and run Python packages in the browser with micropip. Any pure Python package with a wheel available on PyPi is supported. Many packages with C extensions have also been ported for use with Pyodide. These include many general-purpose packages such as regex, PyYAML, lxml and scientific Python packages including NumPy, pandas, SciPy, Matplotlib, and scikit-learn.

If you are not a fan of Pyodide, there is another solution for you. RustPython allows you to run build a web app that will run Python code. You may even ship a full Python compiler to your users (should you need to do so for whatever reason).

Julia – Charlotte.jl

Source: https://github.com/MikeInnes/Charlotte.jl

Julia is a relatively new player on the market, with the emphasis “high performance”, while aiming to feel like a scripting language. This eliminates some drawbacks of the traditional choices for high-speed computing. 

While you may write any app you may want with Julia, the consensus is, that it is tailor-made for scientific computing. So if you can’t live without some library, or just love the language that much, you should give Charlotte a try.

Swift - SwiftWasm

Source: https://github.com/swiftwasm/swift

Swift’s legible syntax, and high performance, makes the language attractive to the data community. Need your code to run in Chrome or Firefox? Go to https://github.com/swiftwasm/swift, and follow the instructions.

Liked the article? subscribe to updates!
360° IT Check is a weekly publication where we bring you the latest and greatest in the world of tech. We cover topics like emerging technologies & frameworks, news about innovative startups, and other topics which affect the world of tech directly or indirectly.

Like what you’re reading? Make sure to subscribe to our weekly newsletter!
Relevant Expertise:
No items found.
Share

Subscribe for periodic tech i

By filling in the above fields and clicking “Subscribe”, you agree to the processing by ITMAGINATION of your personal data contained in the above form for the purposes of sending you messages in the form of newsletter subscription, in accordance with our Privacy Policy.
Thank you! Your submission has been received!
We will send you at most one email per week with our latest tech news and insights.

In the meantime, feel free to explore this page or our Resources page for eBooks, technical guides, GitHub Demos, and more!
Oops! Something went wrong while submitting the form.

Related articles

Our Partners & Certifications
© 2024 ITMAGINATION, A Virtusa Company. All Rights Reserved.