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
39
src/Discretizer.h
Normal file
39
src/Discretizer.h
Normal file
@@ -0,0 +1,39 @@
|
||||
// ****************************************************************
|
||||
// SPDX - FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
|
||||
// SPDX - FileType: SOURCE
|
||||
// SPDX - License - Identifier: MIT
|
||||
// ****************************************************************
|
||||
|
||||
#ifndef DISCRETIZER_H
|
||||
#define DISCRETIZER_H
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include "typesFImdlp.h"
|
||||
#include <torch/torch.h>
|
||||
|
||||
namespace mdlp {
|
||||
enum class bound_dir_t {
|
||||
LEFT,
|
||||
RIGHT
|
||||
};
|
||||
const auto torch_label_t = torch::kInt32;
|
||||
class Discretizer {
|
||||
public:
|
||||
Discretizer() = default;
|
||||
virtual ~Discretizer() = default;
|
||||
inline cutPoints_t getCutPoints() const { return cutPoints; };
|
||||
virtual void fit(samples_t& X_, labels_t& y_) = 0;
|
||||
labels_t& transform(const samples_t& data);
|
||||
labels_t& fit_transform(samples_t& X_, labels_t& y_);
|
||||
void fit_t(const torch::Tensor& X_, const torch::Tensor& y_);
|
||||
torch::Tensor transform_t(const torch::Tensor& X_);
|
||||
torch::Tensor fit_transform_t(const torch::Tensor& X_, const torch::Tensor& y_);
|
||||
static inline std::string version() { return "1.2.3"; };
|
||||
protected:
|
||||
labels_t discretizedData = labels_t();
|
||||
cutPoints_t cutPoints; // At least two cutpoints must be provided, the first and the last will be ignored in transform
|
||||
bound_dir_t direction; // used in transform
|
||||
};
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user