Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
owc-software-python owc-software-python
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • bodc
  • owc-software-pythonowc-software-python
  • Merge requests
  • !12

Merged
Created Nov 15, 2019 by edsmall@edsmallContributor

ARGODEV-157: Calculate covariance matrix

  • Overview 0
  • Commits 14
  • Pipelines 1
  • Changes 3

Jira Issue

ARGODEV-157 (https://jira.ceh.ac.uk/browse/ARGODEV-157)

Python Implementation

Same as matlab implimentation, except variable names are now more descriptive, and the function will catch an exception if used incorrectly.

Testing

For this function I have written 6 unit tests:

  • Test that the return value is an array
  • Test that the function throws an error for bad inputs for arrays
  • Test that we get a covariance matrix full of 1's if the input values are all indentical
  • Test that we get a covariance matrix full of 0's if the inputs are all massively different to each other
  • Test that entering points1 of size 4n and points2 of 4m returns a covariance matrix of size m*n
  • Test that, if given specific values, we recieve the expected answer

Old Matlab Implementation

Uses the Squared Exponential (SE) covariance matrix:

SE(x1, x2) = exp{((x1 - x2) / l) ^ 2}

where x1 and x2 are two different data points of [latitude, longitude, date], and l is the characteristic length scale for each of these data points. This is to find out how similar two points are, and therefore how much influence they have over each other. An answer near 0 implies the points are incredibly different, whereas an answer near to 1 implies they are incredibly similar. As an example, if

  1. x1 = [-57.996, 53.195, 1974.0875]
  2. x2 = [-56.4902, 63.1170, 1987.0367]
  3. l = [4, 8, 20]

then

SE(x1, x2) = exp{((-57.996 - -56.4902) / 4) ^ 2

           + ((53.195 - 63.1170) / 8) ^ 2
           
           + ((1974.0875 - 1987.0367) / 20) ^ 2}
       
        = 0.122562

This implies that the points aren't totally disimilar, but don't have much influence over each other. This is most likely because the difference in longitude is larger than the characteristic length scale in that direction.

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: edsmall/covariance