Skip to content

Generating synthetic data #70

Description

@tlienart

# --------------------------------------------------------------------------
# The script below will eventually go in the tutorials, it generates points
# using standard keywords and plots them. It was also used to eyball the
# results and make sure they made sense
# --------------------------------------------------------------------------

# using PyPlot
#
# # BLOBS
#
# figure(figsize=(8, 6))
# X, y = make_blobs(100, 2, centers=3, as_table=false)
#
# plot(X[y.==1, 1], X[y.==1, 2], ls="none", marker="o")
# plot(X[y.==2, 1], X[y.==2, 2], ls="none", marker="o")
# plot(X[y.==3, 1], X[y.==3, 2], ls="none", marker="o")
#
# gcf()
#
# # CIRCLES
#
# figure(figsize=(8, 6))
# X, y = make_circles(200, as_table=false, factor=0.3)
#
# plot(X[y.==0, 1], X[y.==0, 2], ls="none", marker="o")
# plot(X[y.==1, 1], X[y.==1, 2], ls="none", marker="o")
#
# gcf()
#
# # MOONS
#
# figure(figsize=(8, 6))
# X, y = make_moons(200, as_table=false)
#
# plot(X[y.==0, 1], X[y.==0, 2], ls="none", marker="o")
# plot(X[y.==1, 1], X[y.==1, 2], ls="none", marker="o")
#
# gcf()
#
# # REGRESSION 1
#
# figure(figsize=(8, 6))
# X, y = make_regression(200, 1, as_table=false, noise=0.5, rng=550)
#
# plot(X[:, 1], y, ls="none", marker="o")
#
# gcf()
#
# # REGRESSION WITH OUTLIERS
#
# figure(figsize=(8, 6))
# X, y = make_regression(200, 1, as_table=false, noise=0.5, rng=550, outliers=0.1)
#
# plot(X[:, 1], y, ls="none", marker="o")
#
# gcf()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions