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 Average Remoteness characteristic calculator for masked arrays #63

Open
ChainsManipulator opened this issue Oct 17, 2024 · 0 comments
Assignees

Comments

@ChainsManipulator
Copy link
Member

ChainsManipulator commented Oct 17, 2024

Add calculator function for Average Remoteness characteristic for given intervals array using formula:
$$g_j=\displaystyle \log_2 \Delta_{g j} = \frac{G_j}{n_j} = \frac{1}{n_j} * \sum_{i=1}^{n_j} \log_2 \Delta_{ij}$$
Where $\Delta_{ij}$ is an interval and $n_j$ is a number of intervals in the given congeneric sequence.

Examples

X = [2, 4, 2, 2, 4]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [0.3333333, 1.29248]
X = [1, 2, 3]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [0, 1, 1.5849625]
X = [1, 2, 3]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [1.5849625, 1, 0]
X = ['B','B','B','A','A','B','B','A','B','B']
mask = [1, 1, 1, 0, 0, 1, 1, 0, 1, 1]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Lossy')
result = average_remoteness(x_intervals)
print(result)
> [0.7925]
X = ['B','B','B','A','A','B','B','A','B','B']
mask = [1, 1, 1, 0, 0, 1, 1, 0, 1, 1]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [1.195]
X = ['B','B','B','A','A','B','B','A','B','B']
mask = [1, 1, 1, 0, 0, 1, 1, 0, 1, 1]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [1.0567]
X = ['B','B','B','A','A','B','B','A','B','B']
mask = [1, 1, 1, 0, 0, 1, 1, 0, 1, 1]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Redundant')
result = average_remoteness(x_intervals)
print(result)
> [1.2925]
X = ['B','B','B','A','A','B','B','A','B','B']
mask = [1, 1, 1, 0, 0, 1, 1, 0, 1, 1]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Cycle')
result = average_remoteness(x_intervals)
print(result)
> [1.39]
X = ['A','A','A','B','A','B','B','A','A','A','A','B','A','A','A']
mask = [1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Lossy')
result = average_remoteness(x_intervals)
print(result)
> [1.1073]
X = ['A','A','A','B','A','B','B','A','A','A','A','B','A','A','A']
mask = [1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [1.3305]
X = ['A','A','A','B','A','B','B','A','A','A','A','B','A','A','A']
mask = [1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [1.3305]
X = ['A','A','A','B','A','B','B','A','A','A','A','B','A','A','A']
mask = [1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Redundant')
result = average_remoteness(x_intervals)
print(result)
> [1.4644]
X = ['A','A','A','B','A','B','B','A','A','A','A','B','A','A','A']
mask = [1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Cycle')
result = average_remoteness(x_intervals)
print(result)
> [1.5323]
X = ['B']
masked_X = ma.masked_array(X,)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Lossy')
result = average_remoteness(x_intervals)
print(result)
> [0]
X = ['B']
masked_X = ma.masked_array(X,)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [0]
X = ['B']
masked_X = ma.masked_array(X,)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [0]
X = ['B']
masked_X = ma.masked_array(X,)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Redundant')
result = average_remoteness(x_intervals)
print(result)
> [0]
X = ['B']
masked_X = ma.masked_array(X,)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Cycle')
result = average_remoteness(x_intervals)
print(result)
> [0]
X = ['A','A','A','A','A','A','A','B']
mask = [1, 1, 1, 1, 1, 1, 1, 0]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Lossy')
result = average_remoteness(x_intervals)
print(result)
> [0]
X = ['A','A','A','A','A','A','A','B']
mask = [1, 1, 1, 1, 1, 1, 1, 0]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [3]
X = ['A','A','A','A','A','A','A','B']
mask = [1, 1, 1, 1, 1, 1, 1, 0]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [0]
X = ['A','A','A','A','A','A','A','B']
mask = [1, 1, 1, 1, 1, 1, 1, 0]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Redundant')
result = average_remoteness(x_intervals)
print(result)
> [1.5]
X = ['A','A','A','A','A','A','A','B']
mask = [1, 1, 1, 1, 1, 1, 1, 0]
masked_X = ma.masked_array(X, mask)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Cycle')
result = average_remoteness(x_intervals)
print(result)
> [3]
X = ['A','A','A','A','A']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Lossy')
result = average_remoteness(x_intervals)
print(result)
> [0]
X = ['A','A','A','A','A']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [0]
X = ['A','A','A','A','A']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Normal')
result = average_remoteness(x_intervals)
print(result)
> [0]
X = ['A','A','A','A','A']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Redundant')
result = average_remoteness(x_intervals)
print(result)
> [0]
X = ['A','A','A','A','A']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Cycle')
result = average_remoteness(x_intervals)
print(result)
> [0]

Inequalities with identifying informations

X = [38, 9, 38, 9, 38, 9]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Lossy')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [38, 9, 38, 9, 38, 9]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Lossy')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [38, 9, 38, 9, 38, 9]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Normal')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [38, 9, 38, 9, 38, 9]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Normal')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [38, 9, 38, 9, 38, 9]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Redundant')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [38, 9, 38, 9, 38, 9]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Redundant')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [38, 9, 38, 9, 38, 9]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Cycle')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [38, 9, 38, 9, 38, 9]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Cycle')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true

X = [2, 2, 1, 2, 2]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Lossy')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [2, 2, 1, 2, 2]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Lossy')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [2, 2, 1, 2, 2]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Normal')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [2, 2, 1, 2, 2]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Normal')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [2, 2, 1, 2, 2]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Redundant')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [2, 2, 1, 2, 2]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Redundant')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [2, 2, 1, 2, 2]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Cycle')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [2, 2, 1, 2, 2]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Cycle')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true

X = ['G','G','G','G']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Lossy')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = ['G','G','G','G']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Lossy')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = ['G','G','G','G']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Normal')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = ['G','G','G','G']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Normal')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = ['G','G','G','G']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Redundant')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = ['G','G','G','G']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Redundant')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = ['G','G','G','G']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Cycle')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = ['G','G','G','G']
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Cycle')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true

X = [58, 58, 100, 100]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Lossy')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [58, 58, 100, 100]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Lossy')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [58, 58, 100, 100]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Normal')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [58, 58, 100, 100]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Normal')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [58, 58, 100, 100]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Redundant')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [58, 58, 100, 100]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Redundant')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [58, 58, 100, 100]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Cycle')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true
X = [58, 58, 100, 100]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Cycle')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
print(g[1] <= H[1])
> true

X = [1]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Lossy')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = [1]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Lossy')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = [1]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Normal')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = [1]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Normal')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = [1]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Redundant')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = [1]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Redundant')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = [1]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'Start', 'Cycle')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
X = [1]
masked_X = ma.masked_array(X)
order, alphabet = ma.order(masked_X, True)
x_intervals = ma.intervals(order, 'End', 'Cycle')
g = average_remoteness(x_intervals)
H = identifying_information(x_intervals)
print(g[0] <= H[0])
> true
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