Data Mining Using Javascript

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 30

Data Mining

using
JavaScript
An Overview

• Brief History
Chronicles of • Standards and Framework Wars
the JS Empire • The Arrival of NodeJS and Package
Managers

Industrial • Tools and Methods for collecting data


• Application of DM Algos to mine data
Application of • NPM Alternatives for Python
Data Mining Packages
Console.log("Know your JavaScript");
• Inspired from Flickr file uploader.
• It combines Chrome's V8 Engine, Event
Loop and Low-level I/O API
 A Short Story of JavaScript Mocha

vs

Brenden Eich
 Three Ages of JavaScript Kingdom
What is ECMAScript/ES
• ECMA (European Computer
Manufacturers Association)
• ECMAScript is the name of the
International standard that defines
JavaScript.
ECMAScript Timeline

ES2017/ES8 is coming!!
Arrival
of
NodeJS
A Brief Intro
• Inspired from Flickr file uploader.
• It combines Chrome's V8 Engine, Event
Loop and Low-level I/O API
• It is Opensource.
• Single-thread application.

Ryan Dahl
Pros and Cons of NodeJS
Asynchronous event-driver  Large Nested callbacks can
IO support concurrent lead to spaghetti code.
handling.  No Multi-threading support.
Both Server and Client use  Not compliant with high-
JavaScript hence ease of computational tasks.
development.
 It is consistent.(API's code
Pack Managers for easy change for each version.)
installation and maintenance.
Large Open-source
Community backing.
Frameworks
WH's of Framework
• WHAT - A set of functionalities that provides solution to a particular
problem.
• WHY - To save effort and time. To ensure guidelines are met.
• WHEN – To make a solution reusable and efficient.
• WHERE – Problems that have solutions.
Advantages of Using JS Framework
• Efficiency — projects that used to take months and hundreds of
lines of code now can be achieved much faster with well-
structured prebuilt patterns and functions.
• Safety — top JavaScript frameworks have firm security
arrangements and are supported by large communities where
members and users also act as testers.
• Cost — most frameworks are open source and free. Since they
help programmers to build custom solutions faster, the ultimate
price for web app will be lower.
A Game of thrones: Framework wars
• Angular2
• React
• Vue.js
• Meteor
House Angular2
o Model-View-Whatever Pattern.

Dependency Injection
Opinionation: Flexible
Data Binding: Two-way
Fast Rendering: Static Lists.

 Painful Third-party Integration


 Performance concerns because of DOM Elements.
 Many Interactive Elements makes the page slow.
House React
o Model-View Pattern

Virtual DOM
Opinionation: Less Opinionated making Development Flexible.
Data Binding: One-way
Good Code Reuse
JSX
Debugging is easy.

 It is not a full-framework, It’s a library.


 Flux architectures are a different paradigm that what developers are used to.
House Vue.js
Virtual DOM
Fast Routing
Two-way Binding
Server-side Rendering
Good for SPAs.

 Performance is put forth ahead of Code Organization or App


Structure.
House Meteor JS
Database – UI Synchronization
Features for Front-end, Back-end, Database and Business Logic.
Used by IKEA, Honeywell, Mazda and Many others.
Useful for good Starter.
Mobile + Web Development.

 No other DB support except MongoDB.


 Budding Framework.
http://todomvc.com/
Industrial Usage of Data Mining
Web Scrapping
• Process of Programmatically retrieving information from the
Internet.
Promise
• The Promise object represents the eventual completion (or failure) of
an asynchronous operation, and its resulting value.
Request
• While Node.js does provide simple methods of downloading data
from the Internet via HTTP and HTTPS interfaces, you have to handle
them separately, to say nothing of redirects and other issues that
appear when you start working with web scraping. 

npm install request


Cheerio
• A fast, flexible and lean implementation of jQuery designed
specifically for the server.
• It enables us to focus on the data we download directly, rather
than on parsing it.

npm install cheerio


A Small Bot to mine Weather
var request = require("request"),
  cheerio = require("cheerio"),
  url = "http://www.wunderground.com/cgi-bin/findweather/getForecast?&query=" + 02888;
 
request(url, function (error, response, body) {
  if (!error) {
    var $ = cheerio.load(body),
      temperature = $("[data-variable='temperature'] .wx-value").html();
     
    console.log("It’s " + temperature + " degrees Fahrenheit.");
  } else {
    console.log("We’ve encountered an error: " + error);
 }
});
WHAT IF I TOLD YOU WE HAVE
PYTHON EQUIVALENT PACKAGE IN
NODE.JS

https://github.com/NaturalNode/natural
Overall Summary

You might also like