Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learning Jupyter 5

You're reading from   Learning Jupyter 5 Explore interactive computing using Python, Java, JavaScript, R, Julia, and JupyterLab

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher
ISBN-13 9781789137408
Length 282 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (18) Chapters Close

Title Page
Packt Upsell
Contributors
Preface
1. Introduction to Jupyter FREE CHAPTER 2. Jupyter Python Scripting 3. Jupyter R Scripting 4. Jupyter Julia Scripting 5. Jupyter Java Coding 6. Jupyter JavaScript Coding 7. Jupyter Scala 8. Jupyter and Big Data 9. Interactive Widgets 10. Sharing and Converting Jupyter Notebooks 11. Multiuser Jupyter Notebooks 12. What's Next? 1. Other Books You May Enjoy Index

Node.js decision-tree package


The decision-tree package is an example of a machine learning package. It is available at https://www.npmjs.com/package/decision-tree. The package is installed by using the following command:

npm install decision-tree

We need a dataset to use for training/developing our decision tree. I am using the car MPG dataset from the following web page: https://alliance.seas.upenn.edu/~cis520/wiki/index.php?n=Lectures.DecisionTrees. It did not seem to be available directly, so I copied it into Excel and saved it as a local CSV.

The logic for machine learning is very similar:

  • Load our dataset
  • Split into a training set and a testing set
  • Use the training set to develop our model
  • Test the mode on the test set

Note

Typically, you might use two-thirds of your data for training and one-third for testing.

Using the decision-tree package and the car-mpgdataset, we would have a script similar to the following:

//Import the modules 
var DecisionTree = require('decision-tree'); 
var fs = require...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images