Tutorials References Menu

TensorFlow Graphics

TensorFlow Visor (tfjs-vis)

  • Graphic tools for visualizing Machine Learning
  • Functions for visualizing TensorFlow Objects
  • Visualizations can be organized in a Visor (a modal browser window)
  • Can be used with Custom Tools likes d3, Chart.js, and Plotly.js

Using Graphics

To use tfjs-vis, add the following script tag to your HTML file(s):

Example

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-vis"></script>

Scatter Plots

Example with Visor

const series = ['First', 'Second'];

const serie1 = [];
const serie2 = [];
for (let i = 0; i < 100; i++) {
  serie1[i] = {x:i, y:Math.random() * 100};
  serie2[i] = {x:i, y:Math.random() * 100};
}

const data = {values: [serie1, serie2], series}

tfvis.render.scatterplot({name: "my Plots"}, data);

Try it Yourself »

Example without Visor

const surface = document.getElementById('demo');
const series = ['First', 'Second'];

const serie1 = [];
const serie2 = [];
for (let i = 0; i < 100; i++) {
  serie1[i] = {x:i, y:Math.random() * 100};
  serie2[i] = {x:i, y:Math.random() * 100};
}

const data = {values: [serie1, serie2], series}

tfvis.render.scatterplot(surface, data);

Try it Yourself »


Bar Graphs

Example with Visor

const data = [
  {index: 0, value: 100},
  {index: 1, value: 200},
  {index: 2, value: 150},
  {index: 2, value: 250},
];

tfvis.render.barchart({name:"my Graphs"}, data);

Try it Yourself »

Example without Visor

const surface = document.getElementById('demo');
const data = [
  {index: 0, value: 100},
  {index: 1, value: 200},
  {index: 2, value: 150},
  {index: 2, value: 250},
];

tfvis.render.barchart(surface, data);

Try it Yourself »


Line Graphs

Example with Visor

let values = [
  {x: 1, y: 20},
  {x: 2, y: 30},
  {x: 3, y: 5},
  {x: 4, y: 12}
];

tfvis.render.linechart({name: 'my Lines'}, {values});

Try it Yourself »

Example without Visor

const surface = document.getElementById('demo');

let values = [
  {x: 1, y: 20},
  {x: 2, y: 30},
  {x: 3, y: 5},
  {x: 4, y: 12}
];

tfvis.render.linechart(surface, {values});

Try it Yourself »