Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Geometric Mean characteristic calculator #50

Open
ChainsManipulator opened this issue Oct 14, 2024 · 0 comments
Open

Add Geometric Mean characteristic calculator #50

ChainsManipulator opened this issue Oct 14, 2024 · 0 comments
Assignees

Comments

@ChainsManipulator
Copy link
Member

ChainsManipulator commented Oct 14, 2024

Add calculator function for Geometric Mean characteristic for given intervals array using formula:
$$\displaystyle \Delta_g=\sqrt[n]{V}= \sqrt[n]{\prod_{j=1}^{m} \prod_{i=1}^{n_j} \Delta_{ij}}$$
Where $\Delta_{ij}$ is an interval and $n$ is number of intervals in the sequence.

Examples

X = [2, 4, 2, 2, 4]
x_intervals = intervals(X, 'Start', 'Normal')
result = geometric_mean(x_intervals)
print(result)
> 1,64375
X = ['B','B','A','A','C','B','A','C','C','B']
x_intervals = intervals(X, 'Start', 'Lossy')
result = geometric_mean(x_intervals)
print(result)
> 2.0339
X = ['B','B','A','A','C','B','A','C','C','B']
x_intervals = intervals(X, 'Start', 'Normal')
result = geometric_mean(x_intervals)
print(result)
> 2.155
X = ['B','B','A','A','C','B','A','C','C','B']
x_intervals = intervals(X, 'End', 'Normal')
result = geometric_mean(x_intervals)
print(result)
> 2.0237
X = ['B','B','A','A','C','B','A','C','C','B']
x_intervals = intervals(X, 'Start', 'Redundant')
result = geometric_mean(x_intervals)
print(result)
> 2.1182
X = ['B','B','A','A','C','B','A','C','C','B']
x_intervals = intervals(X, 'Start', 'Cycle')
result = geometric_mean(x_intervals)
print(result)
> 2.3522

X = ['C','C','A','C','G','C','T','T','A','C']
x_intervals = intervals(X, 'Start', 'Lossy')
result = geometric_mean(x_intervals)
print(result)
> 2.139826387867
X = ['C','C','A','C','G','C','T','T','A','C']
x_intervals = intervals(X, 'Start', 'Normal')
result = geometric_mean(x_intervals)
print(result)
> 2.513888742864
X = ['C','C','A','C','G','C','T','T','A','C']
x_intervals = intervals(X, 'End', 'Normal')
result = geometric_mean(x_intervals)
print(result)
> 2.25869387
X = ['C','C','A','C','G','C','T','T','A','C']
x_intervals = intervals(X, 'End', 'Redundant')
result = geometric_mean(x_intervals)
print(result)
> 2.4953181811241978
X = ['C','C','A','C','G','C','T','T','A','C']
x_intervals = intervals(X, 'End', 'Cycle')
result = geometric_mean(x_intervals)
print(result)
> 2.843527111557

X = ['C','C','C','C'] 
x_intervals = intervals(X, 'Start', 'Lossy')
result = geometric_mean(x_intervals)
print(result)
> 1
X =['C','C','C','C']  
x_intervals = intervals(X, 'Start', 'Normal')
result = geometric_mean(x_intervals)
print(result)
> 1
X = ['C','C','C','C'] 
x_intervals = intervals(X, 'End', 'Normal')
result = geometric_mean(x_intervals)
print(result)
> 1
X = ['C','C','C','C'] 
x_intervals = intervals(X, 'End', 'Redundant')
result = geometric_mean(x_intervals)
print(result)
> 1
X = ['C','C','C','C'] 
x_intervals = intervals(X, 'End', 'Cycle')
result = geometric_mean(x_intervals)
print(result)
> 1

No intervals

X = ['C','G'] 
x_intervals = intervals(X, 'End', 'Lossy')
result = geometric_mean(x_intervals)
print(result)
> 0
X = ['A','C','G','T'] 
x_intervals = intervals(X, 'End', 'Lossy')
result = geometric_mean(x_intervals)
print(result)
> 0
X = [2, 1] 
x_intervals = intervals(X, 'End', 'Lossy')
result = geometric_mean(x_intervals)
print(result)
> 0

Inequalities with arithmetic mean

X = [10, 87, 10, 87, 10, 87] 
x_intervals = intervals(X, 'Start', 'Lossy')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [10, 87, 10, 87, 10, 87] 
x_intervals = intervals(X, 'End', 'Lossy')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [10, 87, 10, 87, 10, 87] 
x_intervals = intervals(X, 'Start', 'Normal')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [10, 87, 10, 87, 10, 87] 
x_intervals = intervals(X, 'End', 'Normal')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [10, 87, 10, 87, 10, 87] 
x_intervals = intervals(X, 'Start', 'Redundant')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [10, 87, 10, 87, 10, 87] 
x_intervals = intervals(X, 'End', 'Redundant')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [10, 87, 10, 87, 10, 87] 
x_intervals = intervals(X, 'Start', 'Cycle')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [10, 87, 10, 87, 10, 87] 
x_intervals = intervals(X, 'End', 'Cycle')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true

X = [1, 1, 3, 1, 1] 
x_intervals = intervals(X, 'Start', 'Lossy')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [1, 1, 3, 1, 1] 
x_intervals = intervals(X, 'End', 'Lossy')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [1, 1, 3, 1, 1] 
x_intervals = intervals(X, 'Start', 'Normal')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [1, 1, 3, 1, 1] 
x_intervals = intervals(X, 'End', 'Normal')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [1, 1, 3, 1, 1] 
x_intervals = intervals(X, 'Start', 'Redundant')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [1, 1, 3, 1, 1] 
x_intervals = intervals(X, 'End', 'Redundant')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [1, 1, 3, 1, 1] 
x_intervals = intervals(X, 'Start', 'Cycle')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [1, 1, 3, 1, 1] 
x_intervals = intervals(X, 'End', 'Cycle')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true

X = [13, 13, 13, 13] 
x_intervals = intervals(X, 'Start', 'Lossy')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [13, 13, 13, 13] 
x_intervals = intervals(X, 'End', 'Lossy')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [13, 13, 13, 13] 
x_intervals = intervals(X, 'Start', 'Normal')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [13, 13, 13, 13] 
x_intervals = intervals(X, 'End', 'Normal')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [13, 13, 13, 13] 
x_intervals = intervals(X, 'Start', 'Redundant')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [13, 13, 13, 13] 
x_intervals = intervals(X, 'End', 'Redundant')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [13, 13, 13, 13]  
x_intervals = intervals(X, 'Start', 'Cycle')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = [13, 13, 13, 13] 
x_intervals = intervals(X, 'End', 'Cycle')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true

X = ['A', 'A', 'B', 'B'] 
x_intervals = intervals(X, 'Start', 'Lossy')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['A', 'A', 'B', 'B'] 
x_intervals = intervals(X, 'End', 'Lossy')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['A', 'A', 'B', 'B'] 
x_intervals = intervals(X, 'Start', 'Normal')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['A', 'A', 'B', 'B'] 
x_intervals = intervals(X, 'End', 'Normal')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['A', 'A', 'B', 'B'] 
x_intervals = intervals(X, 'Start', 'Redundant')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['A', 'A', 'B', 'B'] 
x_intervals = intervals(X, 'End', 'Redundant')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['A', 'A', 'B', 'B'] 
x_intervals = intervals(X, 'Start', 'Cycle')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['A', 'A', 'B', 'B'] 
x_intervals = intervals(X, 'End', 'Cycle')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true

X = ['B'] 
x_intervals = intervals(X, 'Start', 'Lossy')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['B'] 
x_intervals = intervals(X, 'End', 'Lossy')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['B'] 
x_intervals = intervals(X, 'Start', 'Normal')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['B'] 
x_intervals = intervals(X, 'End', 'Normal')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['B'] 
x_intervals = intervals(X, 'Start', 'Redundant')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['B'] 
x_intervals = intervals(X, 'End', 'Redundant')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['B'] 
x_intervals = intervals(X, 'Start', 'Cycle')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
X = ['B'] 
x_intervals = intervals(X, 'End', 'Cycle')
delta_g = geometric_mean(x_intervals)
delta_a = arithmetic_mean(x_intervals)
print(delta_g  <= delta_a)
> true
@ChainsManipulator ChainsManipulator converted this from a draft issue Oct 14, 2024
@ChainsManipulator ChainsManipulator changed the title Add geometric mean calculator Add Geometric Mean calculator Oct 14, 2024
@ChainsManipulator ChainsManipulator changed the title Add Geometric Mean calculator Add Geometric Mean characteristic calculator Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

2 participants