mirror of
https://github.com/Doctorado-ML/FImdlp.git
synced 2025-08-17 16:35:52 +00:00
Fix cutPoints computation
This commit is contained in:
5
Makefile
5
Makefile
@@ -4,7 +4,8 @@ SHELL := /bin/bash
|
|||||||
|
|
||||||
clean: ## Clean up
|
clean: ## Clean up
|
||||||
rm -rf build dist *.egg-info
|
rm -rf build dist *.egg-info
|
||||||
for name in fimdlp/cfimdlp.cpp fimdlp/fimdlp.cpython-310-darwin.so;do if [ -f $name ]; then rm $name; fi; done
|
if [ -f fimdlp/cfimdlp.cpp ]; then rm fimdlp/cfimdlp.cpp; fi;
|
||||||
|
if [ -f fimdlp/cppfimdlp.cpython-310-darwin.so ]; then rm fimdlp/cppfimdlp.cpython-310-darwin.so; fi;
|
||||||
|
|
||||||
lint: ## Lint and static-check
|
lint: ## Lint and static-check
|
||||||
black fimdlp
|
black fimdlp
|
||||||
@@ -21,7 +22,9 @@ build: ## Build package
|
|||||||
buildext: ## Build extension
|
buildext: ## Build extension
|
||||||
rm -fr dist/*
|
rm -fr dist/*
|
||||||
rm -fr build/*
|
rm -fr build/*
|
||||||
|
make clean
|
||||||
python setup.py build_ext
|
python setup.py build_ext
|
||||||
|
echo "Build extension success"; mv build/lib.macosx-12-x86_64-cpython-310/cppfimdlp.cpython-310-darwin.so fimdlp;
|
||||||
|
|
||||||
audit: ## Audit pip
|
audit: ## Audit pip
|
||||||
pip-audit
|
pip-audit
|
||||||
|
@@ -10,14 +10,18 @@ namespace CPPFImdlp
|
|||||||
std::vector<float> CPPFImdlp::cutPoints(std::vector<int> &X, std::vector<int> &y)
|
std::vector<float> CPPFImdlp::cutPoints(std::vector<int> &X, std::vector<int> &y)
|
||||||
{
|
{
|
||||||
std::vector<float> cutPts;
|
std::vector<float> cutPts;
|
||||||
int i, ant = X.at(0);
|
int i, ant = X.at(0), anty = y.at(0);
|
||||||
int n = X.size();
|
int n = X.size();
|
||||||
for (i = 1; i < n; i++)
|
for (i = 1; i < n; i++)
|
||||||
{
|
{
|
||||||
if (X.at(i) != ant)
|
if (X.at(i) != ant)
|
||||||
|
{
|
||||||
|
if (y.at(i) != anty)
|
||||||
{
|
{
|
||||||
cutPts.push_back(float(X.at(i) + ant) / 2);
|
cutPts.push_back(float(X.at(i) + ant) / 2);
|
||||||
ant = X.at(i);
|
ant = X.at(i);
|
||||||
|
anty = y.at(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cutPts;
|
return cutPts;
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user