mirror of
https://github.com/Doctorado-ML/mufs.git
synced 2025-08-18 17:15:52 +00:00
Compare commits
6 Commits
v0.1.2
...
add_versio
Author | SHA1 | Date | |
---|---|---|---|
f85ae33e40
|
|||
971314c5ed
|
|||
95a3df360e
|
|||
d610f86483
|
|||
f313032b98
|
|||
4ef1e937de
|
23
.github/workflows/build.yml
vendored
Normal file
23
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
name: Build
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: sonarsource/sonarqube-scan-action@master
|
||||||
|
env:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||||
|
# If you wish to fail your job when the Quality Gate is red, uncomment the
|
||||||
|
# following lines. This would typically be used to fail a deployment.
|
||||||
|
- uses: sonarsource/sonarqube-quality-gate-action@master
|
||||||
|
timeout-minutes: 5
|
||||||
|
env:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, ubuntu-latest]
|
os: [macos-latest, ubuntu-latest]
|
||||||
python: [3.8]
|
python: [3.8, "3.10"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
pip install -q --upgrade pip
|
pip install -q --upgrade pip
|
||||||
pip install -q cython
|
pip install -q cython
|
||||||
pip install -q numpy
|
pip install -q numpy
|
||||||
pip install -q git+git://github.com/doctorado-ml/mdlp
|
pip install -q git+https://github.com/doctorado-ml/mdlp
|
||||||
pip install -q -r requirements/dev.txt
|
pip install -q -r requirements/dev.txt
|
||||||
pip install -q --upgrade codecov coverage black flake8 codacy-coverage
|
pip install -q --upgrade codecov coverage black flake8 codacy-coverage
|
||||||
- name: Lint
|
- name: Lint
|
||||||
|
5
Makefile
5
Makefile
@@ -1,6 +1,6 @@
|
|||||||
SHELL := /bin/bash
|
SHELL := /bin/bash
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
.PHONY: coverage deps help lint push test doc build
|
.PHONY: coverage deps help lint push test build
|
||||||
|
|
||||||
coverage: ## Run tests with coverage
|
coverage: ## Run tests with coverage
|
||||||
coverage erase
|
coverage erase
|
||||||
@@ -26,9 +26,6 @@ build: ## Build package
|
|||||||
rm -fr build/*
|
rm -fr build/*
|
||||||
python setup.py sdist bdist_wheel
|
python setup.py sdist bdist_wheel
|
||||||
|
|
||||||
doc-clean: ## Update documentation
|
|
||||||
make -C docs --makefile=Makefile clean
|
|
||||||
|
|
||||||
help: ## Show help message
|
help: ## Show help message
|
||||||
@IFS=$$'\n' ; \
|
@IFS=$$'\n' ; \
|
||||||
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \
|
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \
|
||||||
|
@@ -3,6 +3,8 @@
|
|||||||
[](https://lgtm.com/projects/g/Doctorado-ML/mufs/context:python)
|
[](https://lgtm.com/projects/g/Doctorado-ML/mufs/context:python)
|
||||||
[](https://badge.fury.io/py/MUFS)
|
[](https://badge.fury.io/py/MUFS)
|
||||||

|

|
||||||
|
[](http://haystack.local:25000/dashboard?id=mufs)
|
||||||
|
[](http://haystack.local:25000/dashboard?id=mufs)
|
||||||
|
|
||||||
# MUFS
|
# MUFS
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ from sys import float_info
|
|||||||
from itertools import combinations
|
from itertools import combinations
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from .Metrics import Metrics
|
from .Metrics import Metrics
|
||||||
|
from ._version import __version__
|
||||||
|
|
||||||
|
|
||||||
class MUFS:
|
class MUFS:
|
||||||
@@ -40,6 +41,11 @@ class MUFS:
|
|||||||
)
|
)
|
||||||
self._fitted = False
|
self._fitted = False
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def version() -> str:
|
||||||
|
"""Return the version of the package."""
|
||||||
|
return __version__
|
||||||
|
|
||||||
def _initialize(self, X, y):
|
def _initialize(self, X, y):
|
||||||
"""Initialize the attributes so support multiple calls using same
|
"""Initialize the attributes so support multiple calls using same
|
||||||
object
|
object
|
||||||
@@ -128,7 +134,7 @@ class MUFS:
|
|||||||
k = len(features)
|
k = len(features)
|
||||||
for pair in list(combinations(features, 2)):
|
for pair in list(combinations(features, 2)):
|
||||||
rff += self._compute_su_features(*pair)
|
rff += self._compute_su_features(*pair)
|
||||||
return rcf / sqrt(k + (k ** 2 - k) * rff)
|
return rcf / sqrt(k + (k**2 - k) * rff)
|
||||||
|
|
||||||
def cfs(self, X, y):
|
def cfs(self, X, y):
|
||||||
"""Correlation-based Feature Selection
|
"""Correlation-based Feature Selection
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
from .Selection import MUFS
|
from .Selection import MUFS
|
||||||
|
|
||||||
__version__ = "0.1.2"
|
|
||||||
__author__ = "Ricardo Montañana Gómez"
|
__author__ = "Ricardo Montañana Gómez"
|
||||||
__author_email__ = "Ricardo.Montanana@alu.uclm.es"
|
__author_email__ = "Ricardo.Montanana@alu.uclm.es"
|
||||||
__copyright__ = "Copyright 2021, Ricardo Montañana Gómez"
|
__copyright__ = "Copyright 2021-2022, Ricardo Montañana Gómez"
|
||||||
__license__ = "MIT License"
|
__license__ = "MIT License"
|
||||||
|
|
||||||
__all__ = ["MUFS"]
|
__all__ = ["MUFS"]
|
||||||
|
1
mufs/_version.py
Normal file
1
mufs/_version.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
__version__ = "0.1.3"
|
@@ -4,8 +4,8 @@ import pandas as pd
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from mdlp import MDLP
|
from mdlp import MDLP
|
||||||
from sklearn.datasets import load_wine, load_iris
|
from sklearn.datasets import load_wine, load_iris
|
||||||
|
|
||||||
from ..Selection import MUFS
|
from ..Selection import MUFS
|
||||||
|
from .._version import __version__
|
||||||
|
|
||||||
|
|
||||||
class MUFSTest(unittest.TestCase):
|
class MUFSTest(unittest.TestCase):
|
||||||
@@ -18,6 +18,11 @@ class MUFSTest(unittest.TestCase):
|
|||||||
mdlp = MDLP(random_state=1)
|
mdlp = MDLP(random_state=1)
|
||||||
self.X_i = mdlp.fit_transform(self.X_ic, self.y_i).astype("int64")
|
self.X_i = mdlp.fit_transform(self.X_ic, self.y_i).astype("int64")
|
||||||
|
|
||||||
|
def test_version(self):
|
||||||
|
"""Check package version."""
|
||||||
|
mufs = MUFS()
|
||||||
|
self.assertEqual(__version__, mufs.version())
|
||||||
|
|
||||||
def assertListAlmostEqual(self, list1, list2, tol=7):
|
def assertListAlmostEqual(self, list1, list2, tol=7):
|
||||||
self.assertEqual(len(list1), len(list2))
|
self.assertEqual(len(list1), len(list2))
|
||||||
for a, b in zip(list1, list2):
|
for a, b in zip(list1, list2):
|
||||||
|
15
setup.py
15
setup.py
@@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
|
|
||||||
@@ -6,9 +7,10 @@ def readme():
|
|||||||
return f.read()
|
return f.read()
|
||||||
|
|
||||||
|
|
||||||
def get_data(field: str):
|
def get_data(field):
|
||||||
item = ""
|
item = ""
|
||||||
with open("mufs/__init__.py") as f:
|
file_name = "_version.py" if field == "version" else "__init__.py"
|
||||||
|
with open(os.path.join("mufs", file_name)) as f:
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
if line.startswith(f"__{field}__"):
|
if line.startswith(f"__{field}__"):
|
||||||
delim = '"' if '"' in line else "'"
|
delim = '"' if '"' in line else "'"
|
||||||
@@ -19,6 +21,11 @@ def get_data(field: str):
|
|||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
|
def get_requirements():
|
||||||
|
with open("requirements/production.txt") as f:
|
||||||
|
return f.read().splitlines()
|
||||||
|
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="MUFS",
|
name="MUFS",
|
||||||
version=get_data("version"),
|
version=get_data("version"),
|
||||||
@@ -38,11 +45,13 @@ setuptools.setup(
|
|||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 4 - Beta",
|
||||||
"License :: OSI Approved :: " + get_data("license"),
|
"License :: OSI Approved :: " + get_data("license"),
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
|
"Programming Language :: Python :: 3.9",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
"Natural Language :: English",
|
"Natural Language :: English",
|
||||||
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
||||||
"Intended Audience :: Science/Research",
|
"Intended Audience :: Science/Research",
|
||||||
],
|
],
|
||||||
install_requires=["scikit-learn"],
|
install_requires=get_requirements(),
|
||||||
test_suite="mufs.tests",
|
test_suite="mufs.tests",
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
)
|
)
|
||||||
|
1
sonar-project.properties
Normal file
1
sonar-project.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
sonar.projectKey=mufs
|
Reference in New Issue
Block a user