How to use the verticapy.learn.plot.voronoi_plot function in verticapy

To help you get started, we’ve selected a few verticapy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vertica / Vertica-ML-Python / verticapy / learn / cluster.py View on Github external
---------------------------------------------------------------------------
	Draws the KMeans clusters.

	Parameters
	----------
	voronoi: bool, optional
		If set to true, a voronoi plot will be drawn. It is only available for
		KMeans using 2 predictors.
		"""
		if (voronoi):
			if (len(self.X) == 2):
				from verticapy.learn.plot import voronoi_plot
				query = "SELECT GET_MODEL_ATTRIBUTE(USING PARAMETERS model_name = '{}', attr_name = 'centers')".format(self.name)
				self.cursor.execute(query)
				clusters = self.cursor.fetchall()
				voronoi_plot(clusters = clusters, columns = self.X)
			else:
				raise ValueError("Voronoi Plots are only available in 2D")
		else:
			vdf = vDataFrame(self.input_relation, self.cursor)
			self.predict(vdf, "kmeans_cluster")
			if (len(self.X) <= 3):
				vdf.scatter(columns = self.X, catcol = "kmeans_cluster", max_cardinality = 100, max_nb_points = 10000)
			else:
				raise ValueError("Clustering Plots are only available in 2D or 3D")
	#---#