Skip to main content

playground-data

Data Generation for Neural Network Playground of Deep Insider.

This project/package that exists as an aid to the Nerural Network Playground - Deep Insider which was forked from tensorflow/playground: Deep playground.

Official pages

Requirements

  • Python 3.4+
  • numpy
  • matplotlib

Install this package using pip

pip install playground-data

Usage

from __future__ import print_function

print('Import plygdata package as pg')

import plygdata as pg

# Or, you can 'import' classes and functions directly like this:
# from plygdata.datahelper import DatasetType
# from plygdata.dataset import generate
print('Imported "playground-data" package version is ...')

print(pg.__version__)
print('Code for plotting sample graph')

import pprint
pprint.pprint(dir(pg))    # How to find class members

pprint.pprint(dir(pg.DatasetType))
#['ClassifyCircleData',
# 'ClassifySpiralData',
# 'ClassifyTwoGaussData',
# 'ClassifyXORData',
# 'RegressGaussian',
# 'RegressPlane',
# ...]

fig, ax = pg.plot_sample(pg.DatasetType.ClassifyCircleData)
# # uncomment if a graph is not shown
# import matplotlib.pyplot as plt
# plt.show()
print('Basic code for generating and graphing data')

data_noise=0.0
validation_data_ratio = 0.5

# Generate data
data_array = pg.generate_data(pg.DatasetType.ClassifyCircleData, data_noise)
#data_array = pg.generate_data(pg.DatasetType.ClassifyXORData, data_noise)
#data_array = pg.generate_data(pg.DatasetType.ClassifyTwoGaussData, data_noise)
#data_array = pg.generate_data(pg.DatasetType.ClassifySpiralData, data_noise)
#data_array = pg.generate_data(pg.DatasetType.RegressPlane, data_noise)
#data_array = pg.generate_data(pg.DatasetType.RegressGaussian, data_noise)

# Divide the data for training and validating at a specified ratio (further, separate each data into Coordinate point data part and teacher label part)
X_train, y_train, X_valid, y_valid = pg.split_data(data_array, validation_size=validation_data_ratio)
# You can use training_size instead of validation_size. training_size takes precedence over validation_size.

# Plot the data on the standard graph for Playground
fig, ax = pg.plot_points_with_playground_style(X_train, y_train, X_valid, y_valid, figsize = (6, 6), dpi = 100)

# # get figure + axes of matplotlib graph and plot the data points
# fig = pg.get_playground_figure(enable_colorbar=True)
# ax = pg.get_playground_axes(fig)
# pg.plot_points(ax, X_train, y_train, X_valid, y_valid)
# # These 3 lines equal to `plot_points_with_playground_style` function

# draw the decision boundary of X1 input (feature)
pg.draw_decision_boundary(fig, ax, node_id=pg.InputType.X1, discretize=False)

# # uncomment if a graph is not shown
# import matplotlib.pyplot as plt
# plt.show()
print('Signature of main @staticmethod')

import sys
if sys.version_info[0] < 3: # inspect.signature was introduced at version Python 3.3
  !pip install funcsigs

try:
    from inspect import signature
except ImportError:
    from funcsigs import signature

print('pg.plot_sample', str(signature(pg.plot_sample)))
# pg.plot_sample (data_type, noise=0.0, validation_size=0.5, visualize_validation_data=False, figsize=(5, 5), dpi=100, node_id=None, discretize=False)

print('pg.generate', str(signature(pg.generate)))
# pg.generate (data_type, noise=0.0)

print('pg.split_data', str(signature(pg.data)))
# pg.split_data (data, validation_size=0.5, label_num=1)

print('pg.plot_points_with_playground_style', str(signature(pg.plot_points_with_playground_style)))
# pg.plot_points_with_playground_style (X_train, y_train, X_valid=None, y_valid=None, figsize=(5, 5), dpi=100)

print('pg.get_playground_figure', str(signature(pg.get_playground_figure)))
# pg.get_playground_figure (enable_colorbar=False)

print('pg.get_playground_axes', str(signature(pg.get_playground_axes)))
# pg.get_playground_axes (fig)

print('pg.plot_points', str(signature(pg.plot_points)))
# pg.plot_points (ax, X_train, y_train, X_valid=None, y_valid=None)

print('pg.draw_decision_boundary', str(signature(pg.draw_decision_boundary)))
# pg.draw_decision_boundary (fig, ax, node_id='x', discretize=False, enable_colorbar=True)

Sample Web app

License

Copyright 2018-2019 Digital Advantage Co., Ltd. All Rights Reserved. Licensed under the Apache License, Version 2.0.

The licenses of using open-source code

This project uses the JavaScript-to-Python-translation of the following open-source code:

tensorflow / playground (Deep playground) / dataset.ts, heatmap.ts, playground.ts, state.ts
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0.

d3 / d3-scale / linear.js
Copyright 2010-2015 Mike Bostock. All rights reserved.
Licensed under the BSD 3-Clause "New" or "Revised" License.

Metadata

Release files for playground-data 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for playground-data 1.1.1
File Size Uploaded
playground-data-1.1.1.tar.gz 19.3 kB Details

Release files / playground-data-1.1.1.tar.gz

Download URL playground-data-1.1.1.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e770b830363e44162a574ede3cb21b1b4a7ea5d4885069cf4a8031ac8becadca
BLAKE2b-256 checksum
How to use checksums
4ccd39e6e9465b7fcb5492bb753cc4fbd80217650cc0762de0ac46313b3a3b98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.11

Release history Release notifications | RSS feed

This release

1.1.1 This release

1 release file

1.1.0

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.8

1 release file

0.7.7

1 release file

0.7.6

1 release file

0.7.5

1 release file

0.7.4

1 release file

0.7.3

1 release file

0.7.2

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.5

1 release file

0.6.4

1 release file

0.6.3

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.9

1 release file

0.5.6

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page