Package: difi
difiDid I Find It?Aboutdifiis a simple package that takes pre-formatted linkage information from software such asMOPS,pytrax, orTHORand analyzes which objects have been found given a set of known labels (or truths). A key performance criteria is thatdifineeds to be fast by avoiding Python for loops and instead uses cleverpandas.DataFramemanipulation.InstallationThe following installation paths are available:AnacondaPyPiDockerSourceAnacondadifican be downloaded directly from anaconda:conda install -c moeyensj difiOr, if preferred, installed into its own environment via:conda create -n difi_py38 -c moeyensj difi python=3.8PyPidifiis also available from the Python package index:pip install difiDockerA Docker container with the latest version of the code can be pulled using:docker pull moeyensj/difi:latestTo run the container:docker run -it moeyensj/difi:latestThe difi code is installed the /projects directory, and is by default also installed in the container's Python installation.SourceClone this repository using eithersshorhttps. Once cloned and downloaded,cdinto the repository.To install difi in its owncondaenviroment please do the following:conda create -n difi_py38 -c defaults -c conda-forge --file requirements.txt python=3.8Or, to install difi in a pre-existingcondaenvironment calleddifi_py38:conda activate difi_py38conda install -c defaults -c conda-forge --file requirements.txtOr, to install pre-requisite software usingpip:pip install -r requirements.txtOnce pre-requisites have been installed using either one of the three options above, then:python setup.py installOr, if you would like to make an editable install then:python setup.py developYou should now be able to start Python and import difi.ExampleThe example below can be found in greater detail in thisJupyter Notebook.Assumed Inputsdifiis designed to analyze a set of linkages made by external software where some of the underlying true linkages are known. It needs just two DataFrames of data:a DataFrame containing observations, with a column for observation ID and a column for the underlying truth (don't worry! --difican handle false positives and unknown truths as well)a DataFrame describing the linkages that were found in the observations by the external software. This DataFrame needs just two columns, one with the linkage ID and the other with the observation IDs that form that linkageWhat Can I Find?In most cases the user can determine what known truths in their observations dataframe can be found by their respective linking algorithm.difihas two simple findability metrics:The 'min_obs' metric: any object with this many or more observations is considered findable.The 'nightly_linkages' metric: any object with this many or more observations is considered findable.Which objects are findable?What observations made each object findable?A summary of what kinds of objects are findable might be useful.Did I Find It?Now lets see what the external linking software did find.difiassumes there to be three different types of linkages:'pure': all observations in a linkage belong to a unique truth'partial': up to a certain percentage of non-unique thruths are allowed so long as one truth has at least the minimum required number of unique observations'mixed': a linkage containing different observations belonging to different truths, we avoid using the word 'false' for these linkages as they may contain unknown truths depending on the use case. We leave interpretation up to the user.Thanks to the power ofpandasit can be super easy to isolate the different linkage types and analyze them separately.
Selecting 'pure' linkages:Selecting 'partial' linkages:Selecting 'mixed' linkages:Understanding the specifics behind each linkage is one thing, but how did the linking algorithm perform on an object by object basis.TutorialA detailed tutorial ondififunctionality can be foundhere.