UnitVector

class geoanalytics.normalization.UnitVector.UnitVector(dataframe)[source]

Bases: object

About this algorithm

Description:

UnitVector performs feature normalization by scaling each row (feature vector) of the dataset to have unit L2 norm (i.e., the sum of squares of each row equals 1). This normalization is useful when you want to normalize across rows (samples) rather than columns (features), such as in cosine similarity or direction-based analyses.

Parameters:
  • dataframe (pd.DataFrame): Input DataFrame containing ‘x’, ‘y’ coordinates and feature values.

Attributes:
  • df (pd.DataFrame): The original DataFrame with standardized column headers (‘x’, ‘y’, …features).

  • normalizedDF (pd.DataFrame): The L2-normalized output DataFrame.

  • startTime, endTime (float): Runtime tracking timestamps.

  • memoryUSS, memoryRSS (float): Memory consumption statistics in kilobytes.

Execution methods

Calling from a Python program

import pandas as pd

from geoanalytics.normalization import UnitVector

df = pd.read_csv("input.csv")

transformer = UnitVector(df)

normalized_df = transformer.run()

transformer.getRuntime()

transformer.getMemoryUSS()

transformer.getMemoryRSS()

transformer.save("UnitVector.csv")

Credits

Developed by Raashika and M. Charan Teja, under the guidance of Professor Rage Uday Kiran.

getMemoryRSS()[source]

Prints the memory usage (RSS) of the process in kilobytes.

getMemoryUSS()[source]

Prints the memory usage (USS) of the process in kilobytes.

getRuntime()[source]

Prints the total runtime of the clustering algorithm.

run()[source]

Executes unit vector (L2) normalization on each row of the dataset.

Returns:

DataFrame containing ‘x’, ‘y’ and normalized feature values.

Return type:

pd.DataFrame

save(outputFile='UnitVector.csv')[source]

Saves the Normalized DataFrame to a CSV file.