Skip to content

Commit

Permalink
Added PyPI v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rmj3197 committed Mar 12, 2024
1 parent e192244 commit 5e0ac0d
Show file tree
Hide file tree
Showing 255 changed files with 17,296 additions and 9,815 deletions.
74 changes: 0 additions & 74 deletions CODE_OF_CONDUCT.md

This file was deleted.

79 changes: 0 additions & 79 deletions CONTRIBUTING.md

This file was deleted.

16 changes: 6 additions & 10 deletions QuadratiK/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
import importlib

__version__ = "1.0.0"
submodules = [
"kernel_test",
"poisson_kernel_test",
"spherical_clustering",
"tools",
"ui",
]
submodules = ["kernel_test","poisson_kernel_test","spherical_clustering","tools","ui"]
__all__ = submodules + [__version__]


def __dir__():
return __all__


# taken from scipy
def __getattr__(name):
if name in submodules:
return importlib.import_module(f"QuadratiK.{name}")
return importlib.import_module(f'QuadratiK.{name}')
else:
try:
return globals()[name]
except KeyError:
raise AttributeError(f"Module 'QuadratiK' has no attribute '{name}'")
raise AttributeError(
f"Module 'QuadratiK' has no attribute '{name}'"
)

2 changes: 1 addition & 1 deletion QuadratiK/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from ._dataset import load_wireless_data

__all__ = ["load_wireless_data"]
__all__ = ["load_wireless_data"]
42 changes: 17 additions & 25 deletions QuadratiK/datasets/_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ def load_wireless_data(desc=False, return_X_y=False, as_dataframe=True, scaled=F
Parameters
----------
desc : boolean, optional
If set to `True`, the function will return the description along with the data.
desc : boolean, optional
If set to `True`, the function will return the description along with the data.
If set to `False`, the description will not be included. Defaults to False.
return_X_y : boolean, optional
Determines whether the function should return the data as separate arrays (`X` and `y`).
Determines whether the function should return the data as separate arrays (`X` and `y`).
Defaults to False.
as_dataframe : boolean, optional
Determines whether the function should return the data as a pandas DataFrame (Trues)
or as a numpy array (False). Defaults to True.
Determines whether the function should return the data as a pandas DataFrame (Trues)
or as a numpy array (False). Defaults to True.
scaled : boolean, optional
Determines whether or not the data should be scaled. If set to True, the data will be
Determines whether or not the data should be scaled. If set to True, the data will be
divided by its Euclidean norm along each row. Defaults to False.
Returns
Expand All @@ -45,9 +45,9 @@ def load_wireless_data(desc=False, return_X_y=False, as_dataframe=True, scaled=F
Dataframe of the data with shape (n_samples, n_features + class)
(desc, data, target) : tuple, if desc is True and return_X_y is True
A tuple of description and two numpy.ndarray. The first containing a 2D
array of shape (n_samples, n_features) with each row representing
one sample and each column representing the features. The second
A tuple of description and two numpy.ndarray. The first containing a 2D
array of shape (n_samples, n_features) with each row representing
one sample and each column representing the features. The second
ndarray of shape (n_samples,) containing the target samples.
(desc, data) : tuple, if desc is True and as_dataframe is True
Expand All @@ -56,10 +56,10 @@ def load_wireless_data(desc=False, return_X_y=False, as_dataframe=True, scaled=F
References
----------
Rohra, J.G., Perumal, B., Narayanan, S.J., Thakur, P., Bhatt, R.B. (2017).
User Localization in an Indoor Environment Using Fuzzy Hybrid of Particle Swarm Optimization
& Gravitational Search Algorithm with Neural Networks. In: Deep, K., et al. Proceedings of
Sixth International Conference on Soft Computing for Problem Solving. Advances in Intelligent
Rohra, J.G., Perumal, B., Narayanan, S.J., Thakur, P., Bhatt, R.B. (2017).
User Localization in an Indoor Environment Using Fuzzy Hybrid of Particle Swarm Optimization
& Gravitational Search Algorithm with Neural Networks. In: Deep, K., et al. Proceedings of
Sixth International Conference on Soft Computing for Problem Solving. Advances in Intelligent
Systems and Computing, vol 546. Springer, Singapore. https://doi.org/10.1007/978-981-10-3322-3_27
Source
Expand All @@ -73,23 +73,17 @@ def load_wireless_data(desc=False, return_X_y=False, as_dataframe=True, scaled=F
>>> X, y = load_wireless_data(return_X_y=True)
"""

data = np.loadtxt(
str(
resources.files("QuadratiK.datasets").joinpath("data/wifi_localization.txt")
)
)
data = np.loadtxt(str(resources.files(
"QuadratiK.datasets").joinpath("data/wifi_localization.txt")))

if scaled:
data[:, :-1] = data[:, :-1] / np.linalg.norm(
data[:, :-1], axis=1, keepdims=True
)
data = data/np.linalg.norm(data, axis=1, keepdims=True)

feature_names = ["WS1", "WS2", "WS3", "WS4", "WS5", "WS6", "WS7", "Class"]

if desc:
desc_file = resources.files("QuadratiK.datasets").joinpath(
"data/wireless_localization_dataset.rst"
)
"data/wireless_localization_dataset.rst")
fdescr = desc_file.read_text()

if return_X_y:
Expand All @@ -105,5 +99,3 @@ def load_wireless_data(desc=False, return_X_y=False, as_dataframe=True, scaled=F
return (fdescr, pd.DataFrame(data, columns=feature_names))
else:
return pd.DataFrame(data, columns=feature_names)
else:
return data
2 changes: 1 addition & 1 deletion QuadratiK/kernel_test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ._kernel_test import KernelTest
from ._h_selection import select_h

__all__ = ["KernelTest", "select_h"]
__all__ = ["KernelTest","select_h"]
Loading

0 comments on commit 5e0ac0d

Please sign in to comment.