import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
import os
os.chdir(
    '/Users/ChrisErnst/Development/Perception-Challenge-Udacity-RoboticsND-Project3/'
)
from generate_clusters import cluster_gen

np.random.seed(424)
# Change the number to generate a different cluster. This 'seeds' the generator
# for the generate_clusters.py file

n_clusters = 8
clusters_x, clusters_y, labels = cluster_gen(n_clusters)

# Convert to a training dataset in sklearn format
X = np.float32(
    (np.concatenate(clusters_x), np.concatenate(clusters_y))).transpose()
y = np.float32((np.concatenate(labels)))

# Create an instance of SVM and fit the data. We're using a linear delineation
ker = 'linear'
# also try 'rbf' which is the default.
# It must be one of ‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’, ‘precomputed’ or a callable
svc = svm.SVC(kernel=ker).fit(X, y)

# Create a mesh that we will use to colorfully plot the decision surface
# Plotting Routine courtesy of: http://scikit-learn.org/stable/auto_examples/svm/plot_iris.html#sphx-glr-auto-examples-svm-plot-iris-py
# Note: this coloring scheme breaks down at > 7 clusters or so
"""

import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
import os
os.chdir('/Users/ChrisErnst/Development/Perception-Challenge-Udacity-RoboticsND-Project3/')
from generate_clusters import cluster_gen


np.random.seed(424) 
# Change the number to generate a different cluster. This 'seeds' the generator
# for the generate_clusters.py file

n_clusters = 8
clusters_x, clusters_y, labels = cluster_gen(n_clusters)

# Convert to a training dataset in sklearn format
X = np.float32((np.concatenate(clusters_x), np.concatenate(clusters_y))).transpose()
y = np.float32((np.concatenate(labels)))

# Create an instance of SVM and fit the data. We're using a linear delineation
ker = 'linear'
# also try 'rbf' which is the default. 
# It must be one of ‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’, ‘precomputed’ or a callable
svc = svm.SVC(kernel=ker).fit(X, y)


# Create a mesh that we will use to colorfully plot the decision surface
# Plotting Routine courtesy of: http://scikit-learn.org/stable/auto_examples/svm/plot_iris.html#sphx-glr-auto-examples-svm-plot-iris-py
# Note: this coloring scheme breaks down at > 7 clusters or so