# Shapely ## Docs - [Cluster Quality](https://shapely.mintlify.app/api-reference/Analysis/Cluster_Quality.md): Cluster Quality evaluates how well a clustering algorithm has grouped your data. It calculates metrics like the Silhouette Score, which measures how similar each point is to its own cluster compared to other clusters. - [Feature Overlay Analysis](https://shapely.mintlify.app/api-reference/Analysis/Feature_Overlay_Analysis.md): Feature Overlay Analysis visualizes and compares the distribution of features across different clusters or classes. It helps you understand how each feature contributes to the separation between groups. - [K-Finder](https://shapely.mintlify.app/api-reference/Analysis/K-Finder.md): K-Finder automatically determines the optimal number of clusters (K) for your data using methods like the Elbow Method and Silhouette Analysis. It tests different K values and recommends the best one. - [Mean Absolute Error](https://shapely.mintlify.app/api-reference/Analysis/Mean_Absolute_Error.md): Mean Absolute Error (MAE) measures the average magnitude of errors between predicted and actual values. It calculates the mean of the absolute differences, giving you a clear picture of how far off predictions are on average. - [Principal Component Analysis (PCA)](https://shapely.mintlify.app/api-reference/Analysis/PCA.md): Principal Component Analysis (PCA) reduces the number of features in your data while preserving the most important patterns. It transforms your original features into a smaller set of new features (principal components) that capture the maximum variance. - [Dynamo → Shapely](https://shapely.mintlify.app/api-reference/Conversation/Dynamo→Shapely.md): Converts Dynamo geometry to Shapely geometry. - [GeoJSON → Shapely](https://shapely.mintlify.app/api-reference/Conversation/GeoJSON→Shapely.md): Converts GeoJSON file to Shapely geometry. - [Numpy → Shapely](https://shapely.mintlify.app/api-reference/Conversation/Numpy→Shapely.md): Converts Numpy data to Shapely geometry. - [Shapely → Dynamo](https://shapely.mintlify.app/api-reference/Conversation/Shapely→Dynamo.md): Converts Shapely geometry to Dynamo geometry. - [Shapely → Numpy](https://shapely.mintlify.app/api-reference/Conversation/Shapely→Numpy.md): Converts Shapely geometry to Numpy data. - [Shapely Buffer](https://shapely.mintlify.app/api-reference/Create/Shp_Buffer.md): A shapely buffer creates a new geometry extended by a specified +/- distance around a geometry (point, line or polygon). This operation adds a buffer zone around the geometry based on the given distance. - [Shapely ConvexHull](https://shapely.mintlify.app/api-reference/Create/Shp_ConvexHull.md): It forms the smallest convex polygon that encompasses the entire geometry or set of points. The resulting geometry is a boundary that surrounds all points without containing any concave indentations. - [Shapely Polygonise](https://shapely.mintlify.app/api-reference/Create/Shp_Polygonise.md): Constructs polygons from a set of lines that form closed loops. This operation is useful for converting linework into area-based geometries. - [Shapely Snap](https://shapely.mintlify.app/api-reference/Create/Shp_Snap.md): Aligns the corner points of one geometry with the corners of another geometry within a specified tolerance distance. This process is used to eliminate small gaps or misalignments between geometries. - [Shapely Triangulate](https://shapely.mintlify.app/api-reference/Create/Shp_Triangulate.md): It divides a polygon or a set of points into non-overlapping triangles. This process allows geometry to be broken down into smaller and simpler parts and is widely used in computational geometry. - [Shapely Voronoi](https://shapely.mintlify.app/api-reference/Create/Shp_Voronoi.md): It generates a Voronoi diagram based on the given set of points. Each Voronoi cell represents the area belonging to the nearest point. - [Introduction](https://shapely.mintlify.app/api-reference/ML Introduction.md): No coding, no external tools - just connect the nodes and let your geometric data reveal its patterns, make predictions, and uncover insights that would be difficult to discover manually. - [Gradient Boosting Classifier](https://shapely.mintlify.app/api-reference/Model/Classifier/Gradient Boosting Classifier.md): Gradient Boosting Classifier combines many simple decision trees in a step-by-step process. Each tree learns from the mistakes made by the previous trees, gradually improving prediction accuracy. - [KNN Classifier](https://shapely.mintlify.app/api-reference/Model/Classifier/KNN Classifier.md): K-Nearest Neighbors (KNN) classifies a data point based on the majority class of its nearest neighbors. It finds the K closest training samples and assigns the most common class among them. - [Logistic Regression](https://shapely.mintlify.app/api-reference/Model/Classifier/Logistic Regression.md): Logistic Regression models the probability of a data point belonging to a particular class using a sigmoid function. Despite its name, it is used for classification, not regression. - [Random Forest Classifier](https://shapely.mintlify.app/api-reference/Model/Classifier/Random Forest Classifier.md): Random Forest creates a collection of independent decision trees, each trained on a random subset of the data. When making a prediction, every tree votes and the most popular class wins. - [Support Vector Classification](https://shapely.mintlify.app/api-reference/Model/Classifier/Support Vector Classification.md): Support Vector Classification (SVC) finds the optimal boundary (hyperplane) that separates data points of different classes with the maximum margin. It uses kernel functions to handle complex, non-linear decision boundaries. - [Gaussian Mixture](https://shapely.mintlify.app/api-reference/Model/Clustering/Gaussian Mixture.md): Gaussian Mixture Model (GMM) assumes data comes from a mix of Gaussian distributions, each representing a cluster. Unlike K-Means, it calculates the probability of a point belonging to each cluster. - [K-Means](https://shapely.mintlify.app/api-reference/Model/Clustering/K-Means.md): K-Means partitions data into K distinct groups by minimizing the distance between data points and their assigned cluster center (centroid). It is one of the simplest and most widely used clustering algorithms. - [Spectral Clustering](https://shapely.mintlify.app/api-reference/Model/Clustering/Spectral Clustering.md): Spectral Clustering uses a similarity graph and its mathematical properties (eigenvalues) to discover complex, non-convex cluster shapes that traditional algorithms like K-Means cannot handle. - [DBSCAN(Density Clustering)](https://shapely.mintlify.app/api-reference/Model/Density/DBSCAN(Density Clustering).md): Density Clustering (DBSCAN) groups together points that are closely packed in space and marks points in low-density regions as outliers. It does not require the number of clusters to be specified in advance. - [Isolation Forest](https://shapely.mintlify.app/api-reference/Model/Density/Isolation Forest.md): Isolation Forest detects anomalies by randomly partitioning data using decision trees. Anomalous data points are easier to isolate because they are few and different from normal observations. - [Gradient Boosting Regressor](https://shapely.mintlify.app/api-reference/Model/Regression/Gradient Boosting Regressor.md): Gradient Boosting Regressor builds sequential decision trees where each new tree corrects the prediction errors of the previous ones. It predicts continuous numerical values with high accuracy. - [Huber Regressor](https://shapely.mintlify.app/api-reference/Model/Regression/Huber Regressor.md): Huber Regressor is a robust regression method that combines squared loss for small errors and absolute loss for large errors. This makes it significantly less sensitive to outliers than standard linear regression. - [Lasso Regressor](https://shapely.mintlify.app/api-reference/Model/Regression/Lasso Regressor.md): Lasso Regression adds L1 regularization to linear regression, which can shrink irrelevant feature coefficients to exactly zero. This means Lasso not only predicts values but also performs automatic feature selection. - [Linear Regressor](https://shapely.mintlify.app/api-reference/Model/Regression/Linear Regressor.md): Linear Regression is the most fundamental regression algorithm. It models the relationship between features and a target value by fitting a straight line (or hyperplane) that minimizes the sum of squared errors. - [Random Forest Regressor](https://shapely.mintlify.app/api-reference/Model/Regression/Random Forest Regressor.md): Random Forest Regressor creates an ensemble of decision trees, each trained on a random subset of the data. The final prediction is the average of all tree outputs, producing robust and stable results. - [Support Vector Regression](https://shapely.mintlify.app/api-reference/Model/Regression/Support Vector Regression.md): Support Vector Regression (SVR) fits a function within an epsilon-tube around the data, tolerating small errors while penalizing larger deviations. Kernel functions allow it to model complex non-linear relationships. - [Shapely Difference](https://shapely.mintlify.app/api-reference/Modifier/Shp_Difference.md): It calculates the difference between two geometries. It subtracts the area where the second geometry intersects from the first geometry. This operation is used to see the difference between one geometry and other geometries. - [Shapely Intersection](https://shapely.mintlify.app/api-reference/Modifier/Shp_Intersection.md): Returns the common area between two geometries. The intersecting areas are taken and a new geometry is created. This process is used to determine the intersection areas. - [Shapely Offset](https://shapely.mintlify.app/api-reference/Modifier/Shp_Offset.md): Creates a new geometry by shifting the boundaries of a geometry by the specified distance. This operation is used to shift the boundaries of polygons inwards or outwards. - [Shapely Reverse Difference](https://shapely.mintlify.app/api-reference/Modifier/Shp_RevDifference.md): It performs the inverse of the difference function. It subtracts the second geometry from the first geometry, but here the subtracted geometries are applied in reverse. - [Shapely Rotate](https://shapely.mintlify.app/api-reference/Modifier/Shp_Rotate.md): Rotates a geometry by the specified angle. - [Shapely Rotate Skew](https://shapely.mintlify.app/api-reference/Modifier/Shp_RotateSkew.md): Rotates a geometry and simultaneously applies skew to it. This operation changes the position of the geometry while also providing a more complex transformation. - [Shapely Scale](https://shapely.mintlify.app/api-reference/Modifier/Shp_Scale.md): Scales a geometry by a specific factor. It expands or contracts the geometry along both the horizontal and vertical axes. - [Shapely Split](https://shapely.mintlify.app/api-reference/Modifier/Shp_Split.md): Divides a geometry with a specified line. This operation divides a polygon or line into two separate parts relative to the given line. - [Shapely Union](https://shapely.mintlify.app/api-reference/Modifier/Shp_Union.md): It combines all geometries provided in the input with each other and produces a single polygon that encompasses all geometries. - [Shapely Area](https://shapely.mintlify.app/api-reference/Operation/Shp_Area.md): Calculates the area of a polygon. This operation is used to perform area analyses. - [Shapely Boundary](https://shapely.mintlify.app/api-reference/Operation/Shp_Boundary.md): It provides the edges that define a geometry. For polygons, this function returns a line representing the boundaries of the geometry. - [Shapely BoundingBox](https://shapely.mintlify.app/api-reference/Operation/Shp_BoundingBox.md): Finds the smallest rectangle surrounding a geometry. This rectangle encompasses the furthest points of the geometry and is commonly used to summarise the dimensions of the geometry. - [Shapely BoundingCircle](https://shapely.mintlify.app/api-reference/Operation/Shp_BoundingCircle.md): Returns the smallest circle surrounding a geometry. This circle is calculated to encompass the entire geometry. - [Shapely BuildBoundary](https://shapely.mintlify.app/api-reference/Operation/Shp_BuildBoundary.md): This creates a geometry that defines the surrounding area. This operation defines the area covered by the geometry. - [Shapely Centroid](https://shapely.mintlify.app/api-reference/Operation/Shp_Centroid.md): Finds the centre of gravity for a geometry. - [Shapely Contains](https://shapely.mintlify.app/api-reference/Operation/Shp_Contains.md): It checks whether one geometry completely encompasses the other. In other words, it checks whether the first geometry contains the second geometry. - [Shapely Distance](https://shapely.mintlify.app/api-reference/Operation/Shp_Distance.md): Calculates the shortest distance between two geometries. - [Shapely GetPoint](https://shapely.mintlify.app/api-reference/Operation/Shp_GetPoint.md): Returns a point at a specified length along a line geometry. - [Shapely LabelPoint](https://shapely.mintlify.app/api-reference/Operation/Shp_LabelPoint.md): It identifies the **Best Point** within a polygon that is as far away from the edges as possible. - [Shapely Length](https://shapely.mintlify.app/api-reference/Operation/Shp_Length.md): Calculates the length of a line. For line geometry, this operation gives the total length. - [Shapely NearestPoint](https://shapely.mintlify.app/api-reference/Operation/Shp_NearestPoint.md): Returns the point on the other geometry that is closest to or intersects with the given geometry. This operation is used to find the shortest distance location between two geometries. - [Shapely Oriented](https://shapely.mintlify.app/api-reference/Operation/Shp_Oriented.md): After various operations, the orientation of geometries may sometimes change. The **Oriented** input reorders all geometries within it as CCW/CW and corrects their orientation as desired by the user. It does not alter the geometry itself, only its orientation. - [Shapely Perimeter](https://shapely.mintlify.app/api-reference/Operation/Shp_Perimeter.md): Returns the **outermost boundary** that defines the geometry and provides the edges. - [Shapely Perimeter Interior](https://shapely.mintlify.app/api-reference/Operation/Shp_PerimeterInterior.md): This returns the **inner boundaries (holes)** of a polygon. These are the empty spaces inside the polygon. - [Shapely Segmentize](https://shapely.mintlify.app/api-reference/Operation/Shp_Segmentize.md): It breaks the geometry into smaller pieces. This process divides the geometry into smaller parts for more precise analysis and calculations. - [Shapely SharedPaths](https://shapely.mintlify.app/api-reference/Operation/Shp_SharedPaths.md): Determines the common paths between two geometries. This operation is used to find common edges or connections. - [Shapely ShortLine](https://shapely.mintlify.app/api-reference/Operation/Shp_ShortLine.md): Creates the shortest line connecting two geometries. - [Shapely Simplify](https://shapely.mintlify.app/api-reference/Operation/Shp_Simplify.md): Simplifies a geometry, that is, it removes unnecessary details. This process enables more efficient calculations when working with large data sets. - [Shapely Skeleton Pruning](https://shapely.mintlify.app/api-reference/Operation/Shp_SkeletonPruning.md): It uses the Topological Analysis method to clean the skeleton (centreline) of a polygon. It cleans the dead-end streets, known as “spurs”, which arise from Voronoi diagrams and are not connected to the main line. - [Shapely Touches](https://shapely.mintlify.app/api-reference/Operation/Shp_Touches.md): It checks whether there is any boundary contact between two geometries. This determines whether the edges of the geometries touch each other. - [Shapely TouchesByDistance](https://shapely.mintlify.app/api-reference/Operation/Shp_TouchesByDistance.md): It analyses the relationship between one geometry and other geometries based on the specified distance. - [Decoder](https://shapely.mintlify.app/api-reference/PreProcessing/Decoder.md): Decoder converts numerical values back into their original categorical (text-based) labels. It reverses the encoding process, transforming numbers like "0, 1, 2" back into labels like "Residential", "Commercial", "Industrial". - [Encoder](https://shapely.mintlify.app/api-reference/PreProcessing/Encoder.md): Encoder converts categorical (text-based) data into numerical values that machine learning algorithms can process. It transforms labels like "Residential", "Commercial", "Industrial" into numbers like " 0, 1, 2 " . - [Feature Extractor](https://shapely.mintlify.app/api-reference/PreProcessing/Feature_Extractor.md): Feature Extractor automatically calculates geometric properties **Area, Compactness, AspectRatio, Solidity, Rectangularity, CentroidX, CentroidY** from Shapely geometry objects and organizes them into a structured feature set ready for machine learning. - [Feature Joiner](https://shapely.mintlify.app/api-reference/PreProcessing/Feature_Joiner.md): Feature Joiner combines multiple separate feature lists into a single unified feature matrix. It merges individual feature columns into one structured dataset. - [Feature Scaler](https://shapely.mintlify.app/api-reference/PreProcessing/Feature_Scaler.md): Feature Scaler normalizes feature values to a common scale so that no single feature dominates the model due to its larger numerical range. It transforms all features to have comparable magnitudes. - [Model → Load](https://shapely.mintlify.app/api-reference/Serialization/Model→Load.md): Model Load restores a previously saved machine learning model from a file so it can be reused for predictions without retraining. It reads the model file and reconstructs the trained model in memory. - [Model → Predict](https://shapely.mintlify.app/api-reference/Serialization/Model→Predict.md): Model Predict uses a trained (or loaded) machine learning model to make predictions on new, unseen data. It takes input features and returns the model output — class labels for classifiers, cluster assignments for clustering, or numerical values for regressors. - [Model → Save](https://shapely.mintlify.app/api-reference/Serialization/Model→Save.md): Model Save exports a trained machine learning model to a file on disk so it can be loaded and reused later. It serializes the model state, preserving all learned parameters and configurations. - [Introduction](https://shapely.mintlify.app/api-reference/Shapely Introduction.md): In this section, you will find a guide and a sample Revit file **(Version: Revit2026)** for testing the codes. - [Shapely](https://shapely.mintlify.app/index.md): Shapely is a great Python library that helps us analyse and manipulate geometries.