mirror of
https://github.com/rmontanana/mdlp.git
synced 2025-08-16 07:55:58 +00:00
Fix BinDisc quantile mistakes (#9)
* Fix BinDisc quantile mistakes * Fix FImdlp tests * Fix tests, samples and remove uneeded support files * Add coypright header to sources Fix coverage report Add coverage badge to README * Update sonar github action * Move sources to a folder and change ArffFiles files to library * Add recursive submodules to github action
This commit is contained in:
committed by
GitHub
parent
7b0673fd4b
commit
e36d9af8f9
@@ -2,5 +2,10 @@ set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
add_executable(sample sample.cpp ../tests/ArffFiles.cpp)
|
||||
include_directories(
|
||||
${mdlp_SOURCE_DIR}/src
|
||||
${mdlp_SOURCE_DIR}/tests/lib/Files
|
||||
)
|
||||
|
||||
add_executable(sample sample.cpp )
|
||||
target_link_libraries(sample mdlp "${TORCH_LIBRARIES}")
|
||||
|
@@ -1,3 +1,9 @@
|
||||
// ****************************************************************
|
||||
// SPDX - FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
|
||||
// SPDX - FileType: SOURCE
|
||||
// SPDX - License - Identifier: MIT
|
||||
// ****************************************************************
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <iomanip>
|
||||
@@ -6,10 +12,10 @@
|
||||
#include <cstring>
|
||||
#include <getopt.h>
|
||||
#include <torch/torch.h>
|
||||
#include "../Discretizer.h"
|
||||
#include "../CPPFImdlp.h"
|
||||
#include "../BinDisc.h"
|
||||
#include "../tests/ArffFiles.h"
|
||||
#include <ArffFiles.hpp>
|
||||
#include "Discretizer.h"
|
||||
#include "CPPFImdlp.h"
|
||||
#include "BinDisc.h"
|
||||
|
||||
const string PATH = "tests/datasets/";
|
||||
|
||||
@@ -144,7 +150,7 @@ void process_file(const string& path, const string& file_name, bool class_last,
|
||||
auto result = test.fit_transform_t(Xt, yt);
|
||||
std::cout << "Transformed data (torch)...: " << std::endl;
|
||||
for (int i = 130; i < 135; i++) {
|
||||
std::cout << std::fixed << std::setprecision(1) << Xt[i].item<float>() << " " << result[i].item<int>() << std::endl;
|
||||
std::cout << std::fixed << std::setprecision(1) << Xt[i].item<mdlp::precision_t>() << " " << result[i].item<int>() << std::endl;
|
||||
}
|
||||
auto disc = mdlp::BinDisc(3);
|
||||
auto res_v = disc.fit_transform(X[0], y);
|
||||
@@ -152,7 +158,7 @@ void process_file(const string& path, const string& file_name, bool class_last,
|
||||
auto res_t = disc.transform_t(Xt);
|
||||
std::cout << "Transformed data (BinDisc)...: " << std::endl;
|
||||
for (int i = 130; i < 135; i++) {
|
||||
std::cout << std::fixed << std::setprecision(1) << Xt[i].item<float>() << " " << res_v[i] << " " << res_t[i].item<int>() << std::endl;
|
||||
std::cout << std::fixed << std::setprecision(1) << Xt[i].item<mdlp::precision_t>() << " " << res_v[i] << " " << res_t[i].item<int>() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user