Stub project

This commit is contained in:
2021-05-12 12:53:01 +02:00
parent 2701fa4914
commit 705981dd4b
11 changed files with 185 additions and 1 deletions

13
.coveragerc Normal file
View File

@@ -0,0 +1,13 @@
[run]
branch = True
source = cfs
[report]
exclude_lines =
if self.debug:
pragma: no cover
raise NotImplementedError
if __name__ == .__main__.:
ignore_errors = True
omit =
cfs/__init__.py

36
.github/workflows/main.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
python: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
pip install -q --upgrade pip
pip install -q -r requirements.txt
pip install -q --upgrade codecov coverage black flake8 codacy-coverage
- name: Lint
run: |
black --check --diff stree
flake8 --count stree
- name: Tests
run: |
coverage run -m unittest -v stree.tests
coverage xml

35
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3.8
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
#- repo: https://github.com/pre-commit/mirrors-mypy
# rev: 'v0.782' # Use the sha / tag you want to point at
# hooks:
# - id: mypy
# args: [--strict]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: trailing-whitespace
- id: check-case-conflict
- id: check-ast
- id: trailing-whitespace
- repo: local
hooks:
- id: tests
name: tests
language: system
entry: coverage run -m unittest
pass_filenames: false
- id: coverage
name: coverage
language: system
entry: coverage report -m --fail-under=100
pass_filenames: false

View File

@@ -1 +1,5 @@
# cfs
# CFS
## Correlation-based Feature Selection
Based on the work of Mark Andrew Hall

3
cfs/Selection.py Normal file
View File

@@ -0,0 +1,3 @@
class CFS:
def __init__(self, a):
self.a = a

9
cfs/__init__.py Normal file
View File

@@ -0,0 +1,9 @@
from .Selection import CFS
__version__ = "0.1"
__author__ = "Ricardo Montañana Gómez"
__author_email__ = "Ricardo.Montanana@alu.uclm.es"
__copyright__ = "Copyright 2021, Ricardo Montañana Gómez"
__license__ = "MIT License"
__all__ = ["CFS"]

16
cfs/tests/CFS_test.py Normal file
View File

@@ -0,0 +1,16 @@
import unittest
from ..Selection import CFS
class CFS_test(unittest.TestCase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# @classmethod
# def setup(cls):
# pass
def test_initial(self):
cfs = CFS(a=1)
self.assertEqual(cfs.a, 1)

3
cfs/tests/__init__.py Normal file
View File

@@ -0,0 +1,3 @@
from .CFS_test import CFS_test
__all__ = ["CFS_test"]

16
pyproject.toml Normal file
View File

@@ -0,0 +1,16 @@
[tool.black]
line-length = 79
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''

1
requirements.txt Normal file
View File

@@ -0,0 +1 @@
scikit-learn>0.24

48
setup.py Normal file
View File

@@ -0,0 +1,48 @@
import setuptools
def readme():
with open("README.md") as f:
return f.read()
def get_data(field: str):
item = ""
with open("stree/__init__.py") as f:
for line in f.readlines():
if line.startswith(f"__{field}__"):
delim = '"' if '"' in line else "'"
item = line.split(delim)[1]
break
else:
raise RuntimeError(f"Unable to find {field} string.")
return item
setuptools.setup(
name="CFS",
version=get_data("version"),
license=get_data("license"),
description="Correlation-based Feature Selection",
long_description=readme(),
long_description_content_type="text/markdown",
packages=setuptools.find_packages(),
url="https://github.com/Doctorado-ML/cfs#cfs",
project_urls={
"Code": "https://github.com/Doctorado-ML/cfs",
},
author=get_data("author"),
author_email=get_data("author_email"),
keywords="feature-selection",
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: " + get_data("license"),
"Programming Language :: Python :: 3.8",
"Natural Language :: English",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Intended Audience :: Science/Research",
],
install_requires=["scikit-learn"],
test_suite="cfs.tests",
zip_safe=False,
)