Elbow Curve¶
General¶
vastorbit’s Elbow Curve tool is a valuable asset for optimizing clustering models,
particularly those employing algorithms like K-Means. This tool allows users
to assess the performance of the clustering algorithm by plotting the distortion
(inertia) against varying numbers of clusters (k values). Analyzing the Elbow
Curve helps data analysts pinpoint the optimal number of clusters where the rate
of decrease in distortion slows down, resembling the bend in an “elbow”.
This information is crucial for selecting an appropriate value for the number
of clusters in a dataset. By leveraging the insights gained from the Elbow Curve,
data analysts can enhance the efficiency of their clustering models, avoid
overfitting or underfitting, and make informed decisions to achieve optimal model performance.
Let’s begin by importing `vastorbit`.
Let’s use the iris dataset from vastorbit.datasets for this example.
from vastorbit.datasets import load_iris
data = load_iris()
In the context of data visualization, we have the flexibility to harness multiple plotting libraries to craft a wide range of graphical representations. vastorbit, as a versatile tool, provides support for several graphic libraries, such as Matplotlib and Plotly. Each of these libraries offers unique features and capabilities, allowing us to choose the most suitable one for our specific data visualization needs.
Note
To select the desired plotting library, we simply need to use the :py:func:`~vastorbit.set_option function. vastorbit offers the flexibility to smoothly transition between different plotting libraries. In instances where a particular graphic is not supported by the chosen library or is not supported within the vastorbit framework, the tool will automatically generate a warning and then switch to an alternative library where the graphic can be created.
Please click on the tabs to view the various graphics generated by the different plotting libraries.
We can switch to using the plotly module.
vo.set_option("plotting_lib", "plotly")
Let’s generate the Validation Curve.
elbow(
input_relation = data,
X = ["PetalLengthCm", "PetalWidthCm"]
)
We can switch to using the matplotlib module.
vo.set_option("plotting_lib", "matplotlib")
Let’s generate the Validation Curve.
elbow(
input_relation = data,
X = ["PetalLengthCm", "PetalWidthCm"]
)
Chart Customization¶
vastorbit empowers users with a high degree of flexibility when it comes to tailoring the visual aspects of their plots. This customization extends to essential elements such as color schemes, text labels, and plot sizes, as well as a wide range of other attributes that can be fine-tuned to align with specific design preferences and analytical requirements. Whether you want to make your visualizations more visually appealing or need to convey specific insights with precision, vastorbit’s customization options enable you to craft graphics that suit your exact needs.