semvec/pypi-packages huggingface dataset:
distython 0.0.3
Implementation of state-of-the-art distance metrics from research papers which can handle mixed-type data and missing values.

# distython
Implementation of state-of-the-art distance metrics from research papers which can handle mixed-type data and missing values.
At the moment, HEOM, HVDM and VDM are tested and working. VDM and HVDM has been released recently so please report bugs, if there are any.
Please feel free to help and contribute to the project as there is a lack of existing implementations of hetergeneous distance metrics.
# Installation
Clone the repository with `git clone`.
Install the necessary packages with `pipenv install`

# Example - HEOM
```python
# Example code of how the HEOM metric can be used together with Scikit-Learn
import numpy as np
from sklearn.neighbors import NearestNeighbors
from sklearn.datasets import load_boston
# Importing a custom metric class
from HEOM import HEOM

# Load the dataset from sklearn
boston = load_boston()
boston_data = boston["data"]
# Categorical variables in the data
categorical_ix = [3, 8]
# The problem here is that NearestNeighbors can't handle np.nan
# So we have to set up the NaN equivalent
nan_eqv = 12345

# Introduce some missingness to the data for the purpose of the example
row_cnt, col_cnt = boston_data.shape
for i in range(row_cnt):
    for j in range(col_cnt):
        rand_val = np.random.randint(20, size=1)
        if rand_val == 10:
            boston_data[i, j] = nan_eqv

# Declare the HEOM with a correct NaN equivalent value
heom_metric = HEOM(boston_data, categorical_ix, nan_equivalents = [nan_eqv])

# Declare NearestNeighbor and link the metric
neighbor = NearestNeighbors(metric = heom_metric.heom)

# Fit the model which uses the custom distance metric 
neighbor.fit(boston_data)

# Return 5-Nearest Neighbors to the 1st instance (row 1)
result = neighbor.kneighbors(boston_data[0].reshape(1, -1), n_neighbors = 5)
print(result)
```
# Research Papers
The code have implemented based on the following literature:
HEOM, VDM and HVDM: https://arxiv.org/pdf/cs/9701101.pdf
compdevkit 1.6.1
Developer tools for compmodels.org.

# Comp-Developer-Toolkit

`compdevkit` tests your model's functions against the [COMP criteria](https://docs.compmodels.org/publish/functions/). If your functions pass the `compdevkit` tests, then you can be reasonably sure that the functions will work on COMPmodels.org.

COMP Developer toolkit also provides a helper command for retrieving your [COMP API](https://docs.compmodels.org/api/guide/) token.

## Install `compdevkit`

```bash
pip install compdevkit
```

## Set up the `comp` directory

```bash
$ cdk-init
```

## Test your functions

```python
from compdevkit import FunctionsTest

import matchups

def test_get_parameters():
    ta = FunctionsTest(
        get_inputs=matchups.get_inputs,
        validate_inputs=matchups.validate_inputs,
        run_model=matchups.get_matchup,
        ok_adjustment={"matchup": {"pitcher": [{"value": "Max Scherzer"}]}},
        bad_adjustment={"matchup": {"pitcher": [{"value": "Not a pitcher"}]}}
    )
    ta.test()

```

## Get your [COMP API](https://docs.compmodels.org/api/guide/) token

```bash
$ cdk-token --username myuser --password mypass
Token: your-token-here
```

## Run the tests

```bash
py.test compconfig -v
```