Skip to content

Commit b350960

Browse files
authored
Added init k-means file
Added the initial k-means code
1 parent 438b36e commit b350960

File tree

1 file changed

+18
-0
lines changed
  • Tutorials/kmeans_implementation_project

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Replace python environment to suit your needs
2+
ENV["PYTHON"] = "/home/mysterio/miniconda3/envs/pydata/bin/python"
3+
Pkg.build("PyCall") # Build PyCall to suit the specified Python env
4+
5+
using PyCall
6+
using Statistics
7+
using Plots
8+
9+
# import whatever
10+
data = pyimport("sklearn.datasets")
11+
12+
#
13+
X, y = data.make_blobs(n_samples=5000, n_features=3, centers=3, cluster_std=0.9, random_state=10)
14+
15+
# Visualize the feature space
16+
scatter3d(X[:, 1], X[:, 2], X[:, 3], color=y, legend=false, st=:surface,
17+
xlabel="Feature #1", ylabel="Feature #2", zlabel="Feature #3",
18+
title="3D View Of Feature Space Coloured By Assigned Cluster")

0 commit comments

Comments
 (0)