-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import numpy as np | ||
from kdtree import KDTree | ||
from sklearn import datasets | ||
|
||
def test(data): | ||
num_samples, _ = data.shape | ||
|
||
ratio = 0.85 | ||
X_train = data[:int(ratio*num_samples), :] | ||
X_test = data[int(ratio*num_samples):, :] | ||
|
||
kd_tree = KDTree(X_train) | ||
kd_tree.build_tree() | ||
|
||
nn = kd_tree.query(X_test, 4) | ||
|
||
if __name__ == "__main__": | ||
test(datasets) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os | ||
import sys | ||
from setuptools import setup | ||
|
||
setup(name ="kdtree", | ||
version = "1.0.0", | ||
description = "Python library for optimization descent algorithms", | ||
long_description = open("README.md").read(), | ||
url = "https://github.com/qzhao19/kdtree", | ||
author = 'Qi ZHAO', | ||
author_email = '[email protected]', | ||
license = "MIT", | ||
packages = ['kdtree'], | ||
install_requires = ["numpy>=1.19.5"], | ||
classifiers=[ | ||
"Intended Audience :: Science/Research", | ||
"Topic :: Scientific/Engineering :: Mathematics :: Machine Learning Algorithms", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.6", | ||
'Operating System :: Unix', | ||
], | ||
keywords='kdtree', | ||
) |