All Projects → Kyrand → Dataviz With Python And Js

Kyrand / Dataviz With Python And Js

Licence: other
The accompanying files for the book 'Dataviz with Python and JavaScript'

Projects that are alternatives of or similar to Dataviz With Python And Js

Attention network with keras
An example attention network with simple dataset.
Stars: ✭ 225 (-0.88%)
Mutual labels:  jupyter-notebook
Text summarization with tensorflow
Implementation of a seq2seq model for summarization of textual data. Demonstrated on amazon reviews, github issues and news articles.
Stars: ✭ 226 (-0.44%)
Mutual labels:  jupyter-notebook
Awesome Industrial Machine Datasets
Stars: ✭ 225 (-0.88%)
Mutual labels:  jupyter-notebook
Datascienceprojects
The code repository for projects and tutorials in R and Python that covers a variety of topics in data visualization, statistics sports analytics and general application of probability theory.
Stars: ✭ 223 (-1.76%)
Mutual labels:  jupyter-notebook
Source separation
Deep learning based speech source separation using Pytorch
Stars: ✭ 226 (-0.44%)
Mutual labels:  jupyter-notebook
Example Scripts
Example Machine Learning Scripts for Numerai's Tournament
Stars: ✭ 223 (-1.76%)
Mutual labels:  jupyter-notebook
Deeplearning cv notes
📓 deepleaning and cv notes.
Stars: ✭ 223 (-1.76%)
Mutual labels:  jupyter-notebook
Image classification with 5 methods
Compared performance of KNN, SVM, BPNN, CNN, Transfer Learning (retrain on Inception v3) on image classification problem. CNN is implemented with TensorFlow
Stars: ✭ 227 (+0%)
Mutual labels:  jupyter-notebook
Set transformer
Pytorch implementation of set transformer
Stars: ✭ 224 (-1.32%)
Mutual labels:  jupyter-notebook
Theano Tutorial
A collection of tutorials on neural networks, using Theano
Stars: ✭ 226 (-0.44%)
Mutual labels:  jupyter-notebook
Ml From Scratch
机器学习算法 基于西瓜书以及《统计学习方法》,当然包括DL。
Stars: ✭ 225 (-0.88%)
Mutual labels:  jupyter-notebook
Poretools
a toolkit for working with Oxford nanopore data
Stars: ✭ 225 (-0.88%)
Mutual labels:  jupyter-notebook
18s096
18.S096 three-week course at MIT
Stars: ✭ 226 (-0.44%)
Mutual labels:  jupyter-notebook
Lstm Crf Medical
构建医疗实体识别的模型,包含词典和语料标注,基于python构建
Stars: ✭ 224 (-1.32%)
Mutual labels:  jupyter-notebook
Gan Tutorial
Simple Implementation of many GAN models with PyTorch.
Stars: ✭ 227 (+0%)
Mutual labels:  jupyter-notebook
Zoom Learn Zoom
computational zoom from raw sensor data
Stars: ✭ 224 (-1.32%)
Mutual labels:  jupyter-notebook
Tf Vqvae
Tensorflow Implementation of the paper [Neural Discrete Representation Learning](https://arxiv.org/abs/1711.00937) (VQ-VAE).
Stars: ✭ 226 (-0.44%)
Mutual labels:  jupyter-notebook
Full Stack Data Science
Full Stack Data Science in Python
Stars: ✭ 227 (+0%)
Mutual labels:  jupyter-notebook
Applied Deep Learning With Keras
Deep Learning examples with Keras.
Stars: ✭ 227 (+0%)
Mutual labels:  jupyter-notebook
Tensorflow notes
Tensorflow notes
Stars: ✭ 226 (-0.44%)
Mutual labels:  jupyter-notebook

Data Visualisation with Python and JavaScript: Crafting a dataviz toolchain for the web

This repo contains the code to accompany the O'Reilly book Data Visualisation with Python and JavaScript. It's currently being refined, prior to the book's release in early July 2016.

Installing Dependencies

The instructions in Chapter 1 Development Setup should provide you with a basic Anaconda setup, providing the main Python data analysis and visualisation tools. I recommend using a virtual environment, either using Anaconda's conda command:

$ conda --create pyjsviz anaconda

or using virtualenv:

$ virtualenv pyjsviz

With the virtual environment activated, any extra dependencies can be installed using the requirements.txt with pip:

$ pip install -r requirements.txt

You should now have all the Python libraries you need.

Seeding the MonogoDB Nobel-prize database

In order to seed the database with the Nobel-prize winners dataset, use run.py:

$ python run.py seed_db
Seeded the database with 858 Nobel winners

You can drop the database like so:

$ python run.py drop_db
Dropped the nobel_prize database from MongoDB

Using the Jupyter (IPython) Notebooks

There are notebooks to accompany chapters 9, 10 and 11. To use them just run Jupyter (or IPython for older versions) from the command-line in the root directory:

$ jupyter notebook
...
[I 20:50:56.397 NotebookApp] The IPython Notebook is running at: http://localhost:8888/
[I 20:50:56.397 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

You should now be able to select the notebooks from your default web-browser and use them to follow their respective chapters.

Note - D3 version 4

Since the book was published D3 has shifted versions, necessitating some conversion work from existing v3 visualizations. One key change is a flattening of the namespace, e.g.:

  • d3.scale.linear ↦ d3.scaleLinear
  • d3.geo.path ↦ d3.geoPath

This is an easy adaption. A harder on is the change in the way the enter method works, which affects the existing examples of the all important update pattern.

A version 4 compliant Nobel Visualization can be found in the nobel_viz_D3_v4 directory. The following code snippets from the Nobel barchart show the changes made to the update pattern and the use of the new merge method. Because the enter method no longer magically updates its selector we need to merge back the original selection to the newly appended elements (created by data-joining) in order to change their attributes in one go.

D3 Version 3:

        var bars = svg.selectAll(".bar")
            .data(data, function(d) {
                return d.code;
            });

        bars.enter().append("rect")
            .attr("class", "bar")
            .attr("x", xPaddingLeft);

        bars
            .classed('active', function(d) {
                return d.key === nbviz.activeCountry;
            })
            .transition().duration(nbviz.TRANS_DURATION)
            .attr("x", function(d) { return xScale(d.code); })
            .attr("width", xScale.rangeBand())
            .attr("y", function(d) { return yScale(d.value); })
            .attr("height", function(d) { return height - yScale(d.value); });

        bars.exit().remove();

D3 Version 4:

        var bars = svg.selectAll(".bar")
            .data(data, function(d) {
                return d.code;
            });

        bars.enter().append("rect")
            .attr("class", "bar")
            .attr("x", xPaddingLeft)
        .merge(bars)
            .classed('active', function(d) {
                return d.key === nbviz.activeCountry;
            })
            .transition().duration(nbviz.TRANS_DURATION)
            .attr("x", function(d) { return xScale(d.code); })
            .attr("width", xScale.bandwidth())
            .attr("y", function(d) { return yScale(d.value); })
            .attr("height", function(d) { return height - yScale(d.value); });

        bars.exit().remove();

The Nobel Visualization

The Python and JavaScript files for the Nobel Visualization are in the nobel_viz subdirectory. These include the config, login and test files demonstrated in the book's appendix:

nobel_viz
├── api <-- EVE RESTful API
│   ├── server_eve.py <-- EVE server
│   └── settings.py
├── config.py
├── index.html <-- entry index.html file for static Nobel-viz
├── __init__.py
├── nobel_viz.py <-- Nobel-viz server
├── nobel_viz.wsgi
├── SpecRunner.html
├── static
│   ├── css
│   ├── data
│   ├── images
│   ├── js
│   └── lib
├── templates
│   ├── index.html <-- template for entry html file for dynamic Nobel-viz
│   ├── login.html
│   └── testj2.html
├── test_nbviz.py
├── tests
│   ├── jasmine
│   └── NbvizSpec.js
├── tests.js
└── tests.pyc

Running the Nobel-viz

You can run the Nobel-viz in two ways, one using static-files to emulate an API which can be run without MongoDB and the other using the EVE RESTful API with the Nobel winners dataset seeded by using run.py.

Running it statically

To run the Nobel-viz statically just run Python's SimpleHTTPServer server from the nobel_viz directory:

nobel_viz $ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...

If you go to the http:localhost:8000 URL with your web-browser of choice, you should see the Noble-viz running.

Running it dynamically with the EVE-API

To run the Nobel-viz using the EVE RESTful API, first start the EVE server by running it from the nobel_viz/api subdirectory:

nobel_viz/api $ python server_eve.py
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
...

With the API's server running on default port 5000, start the Nobel-viz's Flask server from the nobel_viz directory:

nobel_viz $ python nobel_viz.py
 * Running on http://127.0.0.1:8000/ (Press CTRL+C to quit)
...

If you go to the http:localhost:8000 URL with your web-browser of choice, you should see the Noble-viz running.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].