12 Commits
ci ... v0.9.1

8 changed files with 36 additions and 15 deletions

View File

@@ -32,13 +32,15 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
language: ["cpp", "python"] language: ["python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
submodules: recursive
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
@@ -61,6 +63,8 @@ jobs:
- if: matrix.language == 'cpp' - if: matrix.language == 'cpp'
name: Build CPP name: Build CPP
run: | run: |
pip install -q --upgrade pip
pip install -q scikit-learn cython
make install make install
# Command-line programs to run using the OS shell. # Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

View File

@@ -2,9 +2,9 @@ name: CI
on: on:
push: push:
branches: [master, ci] branches: [main]
pull_request: pull_request:
branches: [master] branches: [main]
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@@ -16,7 +16,9 @@ jobs:
python: ["3.10"] python: ["3.10"]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ matrix.python }} - name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
@@ -24,7 +26,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
pip install -q --upgrade pip pip install -q --upgrade pip
pip install -q scikit-learn pip install -q scikit-learn cython
pip install -q --upgrade codecov coverage black flake8 codacy-coverage pip install -q --upgrade codecov coverage black flake8 codacy-coverage
- name: Build and install - name: Build and install
run: | run: |

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "src/cppmdlp"]
path = src/cppmdlp
url = https://github.com/rmontanana/mdlp.git

View File

@@ -15,6 +15,10 @@ coverage:
make test make test
coverage report -m coverage report -m
submodule:
git submodule update --remote src/cppmdlp
git submodule update --merge
lint: ## Lint and static-check lint: ## Lint and static-check
black src black src
flake8 --per-file-ignores="__init__.py:F401" src flake8 --per-file-ignores="__init__.py:F401" src

View File

@@ -1,6 +1,10 @@
# FImdlp # FImdlp
[![CI](https://github.com/Doctorado-ML/FImdlp/actions/workflows/main.yml/badge.svg)](https://github.com/Doctorado-ML/FImdlp/actions/workflows/main.yml)
[![CodeQL](https://github.com/Doctorado-ML/FImdlp/actions/workflows/codeql.yml/badge.svg)](https://github.com/Doctorado-ML/FImdlp/actions/workflows/codeql.yml)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/8b4d784fee13401588aa8c06532a2f6d)](https://www.codacy.com/gh/Doctorado-ML/FImdlp/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Doctorado-ML/FImdlp&utm_campaign=Badge_Grade) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/8b4d784fee13401588aa8c06532a2f6d)](https://www.codacy.com/gh/Doctorado-ML/FImdlp/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Doctorado-ML/FImdlp&utm_campaign=Badge_Grade)
[![codecov](https://codecov.io/gh/Doctorado-ML/FImdlp/branch/main/graph/badge.svg?token=W8I45B5Z3J)](https://codecov.io/gh/Doctorado-ML/FImdlp)
[![pypy](https://img.shields.io/pypi/v/FImdlp?color=g)](https://img.shields.io/pypi/v/FImdlp?color=g)
![https://img.shields.io/badge/python-3.9%2B-blue](https://img.shields.io/badge/python-3.9%2B-brightgreen)
Discretization algorithm based on the paper by Usama M. Fayyad and Keki B. Irani Discretization algorithm based on the paper by Usama M. Fayyad and Keki B. Irani
@@ -8,6 +12,12 @@ Discretization algorithm based on the paper by Usama M. Fayyad and Keki B. Irani
Multi-Interval Discretization of Continuous-Valued Attributes for Classification Learning. In Proceedings of the 13th International Joint Conference on Artificial Intelligence (IJCAI-95), pages 1022-1027, Montreal, Canada, August 1995. Multi-Interval Discretization of Continuous-Valued Attributes for Classification Learning. In Proceedings of the 13th International Joint Conference on Artificial Intelligence (IJCAI-95), pages 1022-1027, Montreal, Canada, August 1995.
``` ```
## Installation
```bash
git clone --recurse-submodules https://github.com/doctorado-ml/FImdlp.git
```
## Build and usage sample ## Build and usage sample
### Python sample ### Python sample

View File

@@ -50,9 +50,5 @@ int main(int argc, char** argv)
cout << item << endl; cout << item << endl;
} }
} }
mdlp::indices_t indices = test.sortIndices(X[0]);
for (auto item : indices) {
cout << setw(3) << item << " " << X[0][item] << " " << y[item] << endl;
}
return 0; return 0;
} }

1
src/cppmdlp Submodule

Submodule src/cppmdlp added at e21482900b

View File

@@ -60,11 +60,12 @@ class FImdlpTest(unittest.TestCase):
self.assertEqual(clf.n_features_, 4) self.assertEqual(clf.n_features_, 4)
self.assertTrue(np.array_equal(X, clf.X_)) self.assertTrue(np.array_equal(X, clf.X_))
self.assertTrue(np.array_equal(y, clf.y_)) self.assertTrue(np.array_equal(y, clf.y_))
expected = [ expected = [
[5.5, 5.800000190734863], [5.5, 5.800000190734863],
[3.0999999046325684], [2.9000000953674316, 3.3499999046325684],
[2.450000047683716, 4.800000190734863, 5.099999904632568], [2.450000047683716, 4.800000190734863],
[0.800000011920929, 1.7000000476837158], [0.800000011920929, 1.7999999523162842],
] ]
self.assertListEqual(expected, clf.get_cut_points()) self.assertListEqual(expected, clf.get_cut_points())
self.assertListEqual([0, 1, 2, 3], clf.features_) self.assertListEqual([0, 1, 2, 3], clf.features_)
@@ -108,11 +109,11 @@ class FImdlpTest(unittest.TestCase):
) )
expected = [ expected = [
[0, 0, 1, 1], [0, 0, 1, 1],
[2, 0, 1, 1], [2, 1, 1, 1],
[1, 0, 1, 1], [1, 0, 1, 1],
[0, 0, 1, 1], [0, 0, 1, 1],
[1, 0, 1, 1], [1, 0, 1, 1],
[1, 0, 1, 1], [1, 1, 1, 1],
[1, 0, 1, 1], [1, 0, 1, 1],
] ]
self.assertTrue(np.array_equal(clf.transform(X[90:97]), expected)) self.assertTrue(np.array_equal(clf.transform(X[90:97]), expected))