10 ms·
JavaScript for Data Science
- beforeolives 5y agoI know that data science is a broad and somewhat vague term but this - We will cover: Core features of modern JavaScript Programming with callbacks and promises Creating objects and classes Writing HTML and CSS Creating interactive pages with React Building data services Testing Data visualization Combining everything to create a three-tier web application - this isn't data science.
- 11235813213455 5y agoout of context it's not data science
- bryanrasmussen 5y agonobody ever writes books assuming you know how to use the language, I suppose it decreases customer base.
- HWR_14 5y agoIt decreases the amount of boilerplate "how to program in X" text you have to write. Producing text, especially novel text, is expensive in a non-fiction book.
- rapfaria 5y agoWhile understanble, I hate this. "Here's 100 pages of python before we get to the good stuff", which ends up not even being good. Publishers should just offer a free e-book of said language, and make it a requirement.
- deleted 5y ago[deleted]
- jhbadger 5y agoThe book does cover a lot of basic Javascript material, as its target is actual natural scientists who may not have much experience with the language, but towards the end it does cover things like Data-Forge (which is a data science library in Javascript)
- d--b 5y agoWell the problem with “data science” is that it costs a shit ton of money but rarely integrates into anything. A book about wiring data science models into real user facing application maybe isn’t data science, but sure is useful...
- zitterbewegung 5y agoIt's more like Presenting and Serving Models using Javascript for Data Science.
- jiofih 5y agoI assume it’s aimed at data scientists who want to learn Javascript? No point teaching DS concepts here. A better name would be “JS for data scientists”
- javierluraschi 5y agoI'm glad more people are doing DS/ML/AI with JavaScript, thanks for this book and keep up the great work! -- We are also working in this space, would love to connect, you can find me in javier at hal9.ai
- jhgb 5y agoPresumably that's why the "JavaScript for" prefix precedes it?
- nkmnz 5y agoThe title is „JavaScript for Data Science“, not „Data Science for JavaScript“. It’s like... in a bar: they will serve a beer for you, so they have the beer and you have you. For a book called „JS for DS“, you should have the the DS while they bring the JS. Compare this with: „Data wrangling with JavaScript“ [1] [1] https://www.amazon.de/Data-Wrangling-JavaScript-Ashley-Davis/dp/1617294845 https://www.amazon.de/Data-Wrangling-JavaScript-Ashley-Davis...
- zwaps 5y agoI get your point, but as someone doing data science and having no idea about JavaScript, this is actually precisely what I need. Like, all the stuff "for my data science", such as making a visualization website etc.
- bluishgreen 5y ago"JavaScript relies heavily on callback functions: Instead of a function giving us a result immediately, we give it another function that tells it what to do next. Many other languages use them as well, but JavaScript is often the first place that programmers with data science backgrounds encounter them." That sentence from the book clarifies a lot for me. It is Javascript for Data Science People. Taken in that context this is an excellent book written with empathy for the Data Science user who is usually making uneasy excursions which they hope and pray is only temporary into Javascript and running back to Python the first time they encounter a Promise or a Callback.
- danpalmer 5y agoI don’t want to repeat the old and tired JavaScript hate, but this just isn’t a great idea. I’d suggest that there are 3 important primitives for data science: flexible numeric types, fast math/algorithm libraries, and data manipulation being easy. JavaScript doesn’t really have any of these. Numbers are 64bit floats only - no integers, no big numbers. There aren’t equivalents to Numpy/Pandas/Scikit Learn, and the lack of standard library and expressiveness in data manipulation in the language makes basic tasks harder. JavaScript has its uses, but there’s really no reason to force data science be one of them.
- RedShift1 5y agoThere is decimal.js but yes it's not going to be fast.
- 11235813213455 5y agoI don't see JS as less powerful than Python for data science, it's faster than Python, or can use bindings just like Python. JS is maybe less commonly used than Python in data science nowadays, but I wouldn't be surprised if this changes in next years. There are equivalent libs like tensorflow-core, there are native features like BigInt, and there are libs for 64bits floats (decimal.js, big.js). I'd be glad to spend some time converting Scikit-learn into JS and also show you how expressive JS actually is, if you show me some Python code, I'll translate it
- uryga 5y ago> libs for 64bits floats (decimal.js, big.js) both of those libraries are for arbitrary precision decimals, not floats.
- __jem 5y agoIf it's arbitrary precision, what's the difference, besides slightly more bookkeeping on your end?
- danpalmer 5y agoThe fact that the number support isn’t part of the language is Linda the problem though. When you’re writing data science code, the value is in the answer more than the process of getting to that answer. Anything that complicates that gets in the way. This is why things like Pandas are so popular despite having some questionable engineering. Using a library for big number support, having to get that to play nicely with other libraries, it all goes against the aims. Now for data engineering it’s very different. I wouldn’t choose JS myself, but it’s a much more reasonable choice. For engineering the process by which you get the answer matters far more - is it scalable, testable, repeatable, etc. Having to use a library for big number support is fine. It’s two very different ways of working and I’m still fairly convinced that JS is not conducive to the former.
- temp8964 5y agoThey use data-forge.js, which has less stars than danfo.js. I can't find any benchmark how they compare to data.table or pandas. Without a dominant and high performance data frame library as a foundation, I wouldn't even try.
- la_fayette 5y agoData science is not a standardized term, however I don't get what specifically makes this text relevant for the domain of data science... For some data science projects one could surely use javascript, however in mamy cases one misses important libraries, for purposes such as statistical analysis, data manipulation, machine learning, ...
- m00dy 5y agowell, I was expecting training a neural network with web-assembly through gpu support in its last chapter :)
- jason0597 5y agoWhy on earth would you want to use JavaScript for Data Science?
- bambam24 5y agoBecause nobody wants to use Java?
- nesarkvechnep 5y agoBecause some people are monoglots :(
- javierluraschi 5y agoA few reasons, https://venturebeat.com/2021/04/23/4-reasons-to-learn-machine-learning-with-javascript/ https://venturebeat.com/2021/04/23/4-reasons-to-learn-machin... Personally, I'm excited to build apps that don't require cloud computing and if they do, have access to one of the largest software engineering libraries through NPM. Sure, I'm not doing just Data Science in JavaScript but rather building apps that use DS/ML/AI, but that's still a valid use case. The alternative would be to use Python for prototyping then rewrite for production apps.
- Rainymood 5y agoReally cool but no one needs this... as a data scientist learning javascript, teach me how to run data science models using javascript! That's where the real gold is... I'm even thinking of writing articles about this myself... JS is great for making things more tangible and interactive
- splithalf 5y agoData scientists are the new webmasters.
- qntty 5y agoCould you elaborate?
- bambam24 5y agoWe run an experiment. We hired 4 Java developers all senior. And 1 Fullstack Javascript developer. Gave them the same tasks without telling them. The result: We got a Userinterfacd, aws serverless, and scalable infra within a week the task is comoleted by Single Javascript developer. And when we ask whats the status to 4 senior Java developer, they say they are still designing “thinking how to do it” At the end if second week, they were still sturggling with Gradle and supporting authenticafion. And what they designed was to run k8s with EKS etc. Luckily they are no working in our company anymore.
- slt2021 5y agohard pass. even python is not used for data science, all heavy lifting is done in C/fortran, and python is just a glue
- genrez 5y agoI am a noob to Javascript, so if someone knows better, than please correct me about this, but arrow functions aren't meant to replace normal function syntax, right? From [1], it seems like the main point of arrow syntax is to allow you to inherit the "this" parameter if you are inside a method. Meanwhile, you need normal function syntax if you are creating a constructor, making a method function for a prototype, or making generator functions. (I didn't even know javascript had generator functions until just now :)) So it seems a bit weird to me that they advocate using arrow function syntax instead of the regular syntax. They seem to be advocating using the new class syntax instead, so I guess they don't need the constructor or method creation features of the normal syntax, but I still don't see why they would specifically advocate for arrow function syntax. Is it faster? They say it interferes with other features, but which features? [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- __jem 5y agoNot changing `this` is a huge benefit that shouldn't be ignored. Especially when you're programming in a more functional style, it makes sense to default to arrow functions because you never want to engage in `this` shenanigans anyway. So, yes, I'd say it's a pretty common idiom in the JS community to replace "normal" function declarations.
- genrez 5y agoI agree that inheriting the `this` for arrow functions is beneficial. To me it seems like you would want to use the normal syntax for global functions for hoisting and to prevent unintentional re-definitions, the arrow functions where you would use lambda functions in other languages, and the class method syntax for methods. side-note: Most of my JS experience is writing userscripts for myself, so I definitely do my share of 'this' shenanigans.
- ctidd 5y agoAs a heads up since you mentioned "class method syntax", methods are one of the most important places to have lexical `this` binding in many scenarios. Take the following example, which is a normal class method: > alertSum() { alert(this.a + this.b); } And here we have an arrow function used to create an instance method (just an arrow function assigned to a property on the instance): > alertSum = () => { alert(this.a + this.b); } Then let's say we want to pass the method directly as callback: > this.button.addEventListener('click', this.alertSum) The first example (class method syntax) won't have the necessary `this` context unless it has its context bound to the instance through `Function.prototype.bind`. There are other patterns to avoid this (e.g. wrapping all callbacks in arrow functions when passing them), but it's useful to consider that classes methods can easily create confusion because that's _exactly where_ someone more used to a different language may assume the `this` context is bound lexically.
- mark_l_watson 5y agoI thought of writing a Javascript + tensor flow.js + NLP + web scraping + linked data + etc. book about a year ago. tensorflow.js is especially very cool: well documented with great examples. In fact, it was the great tensor flow.js examples and demos that convinced me to not write the book because I didn't feel like I could do much value add on that subject.
- czep 5y agoTo address some of the skepticism about when and where javascript would be appropriate in data science, would you want to fit a logistic regression model in javascript? Probably not, but to build a solver that takes model outputs and visualizes the changes in predicted probabilities based on different combinations of variables? This is definitely where javascript would make sense. Visualization, dashboards, reporting, and exploratory analysis are all ripe domains for developing rich responsive UIs. Basically, any layer where you have a data-to-human interface can be leveraged with javascript. There is a lot of great work happening in this space already. In the R world for example, shiny makes heavy use of js to the point that you often can't tell where R code ends and javascript begins. Plotly's Dash provides bindings for R, Python, and Julia. Personally, as a data scientist, I have been excitedly learning React because it really rips the landscape wide open for all the use cases I mentioned above. It then makes sense to have libraries that give JS users a good data model and can do most of the same numerical computation that we'd be doing in other languages. Again, you probabaly don't want to do serious numerical work in js, but remember people said that about Python ten years ago too. I love the framing of this book, because I want more data scientists to start thinking about the presentation of data and spark some bits of ingenuity to make datasets and model outputs accessible to non-data scientists. Data scientists should be the ones writing the tools that interface data with humans because of their domain knowledge. But this is a different skillset and usually the work of SW engineers. Of course engineers can also have great data intuition too, but I really do encourage data scientists to develop their front end skills, it's well worth it.
- tharne 5y agoI don't see the point of this. You already have a ubiquitous, easy-to-learn, high-level language that's great for data science, it's called python. If you're a JavaScript developer who wants to get into data science but are too lazy to learn python, you probably weren't that interested in data science in the first place. Python definitely has some problems, but if you were going to have a new lingua franca for data science, it would probably be something like Julia, certainly not JavaScript.
- javierluraschi 5y agoMy hunch is that there has been 10X more investment in engineering for JavaScript: nodejs, webassembly, webgl, webgpu, react native, deno, typescript, electron, chrome, etc. That will be harder to rewrite in Python than to rewrite TensorFlow and a few math libraries in JavaScript.
- brianzelip 5y agoJust putting this out there: stdlib - a standard library for js, https://stdlib.io/ https://stdlib.io/.
- talolard 5y agoAs a data scientist who does more frontend, I think this is a really valuable concept. Hello by users/stakeholders engage with our work is the way to push it forward in the org and a dash of frontend can do wonders for getting that message across. It’s wonderful that people are making resources about the frontend for data scientists
- javierluraschi 5y agoGlad you also see it this way! Would love to chat with you and get some feedback on a platform we are building at hal9.ai, my email is javier at hal9.ai -- Looking forward to chat.