September 8, 2023

ML Lab Pro 1

import numpy as np
from scipy import stats

# Given array
data = np.array([115.3, 195.5, 120.5, 110.2, 90.4, 105.6, 110.9, 116.3, 122.3, 125.4])

# Mean (Average)
mean = np.mean(data)

# Median
median = np.median(data)

# Mode
mode_result = stats.mode(data)
mode = mode_result.mode[0] if mode_result.count[0] > 1 else "No mode"

# Standard Deviation
std_deviation = np.std(data)

# Variance
variance = np.var(data)

# Min-Max Normalization
min_value = np.min(data)
max_value = np.max(data)
min_max_normalized = (data - min_value) / (max_value - min_value)

# Standardization (Z-Score)
z_score = (data - mean) / std_deviation

# Displaying results
print("Mean:", mean)
print("Median:", median)
print("Mode:", mode)
print("Standard Deviation:", std_deviation)
print("Variance:", variance)
print("Min-Max Normalization:", min_max_normalized)
print("Standardization (Z-Score):", z_score)

115.3, 195.5, 120.5, 110.2,

Use the above array values and compute the mean, median, mode, standard deviation, variance, min-max normalization and standardization

se the above array values and compute the mean, median, mode, standard deviation, variance, min-max normalization and standardization