BayesNet/bayesnet/feature_selection/CFS.h

26 lines
1015 B
C
Raw Permalink Normal View History

2024-04-11 16:02:49 +00:00
// ***************************************************************
// SPDX-FileCopyrightText: Copyright 2024 Ricardo Montañana Gómez
// SPDX-FileType: SOURCE
// SPDX-License-Identifier: MIT
// ***************************************************************
2023-10-11 19:17:26 +00:00
#ifndef CFS_H
#define CFS_H
#include <torch/torch.h>
#include <vector>
2024-03-08 21:20:54 +00:00
#include "bayesnet/feature_selection/FeatureSelect.h"
2023-10-11 19:17:26 +00:00
namespace bayesnet {
class CFS : public FeatureSelect {
2023-10-11 19:17:26 +00:00
public:
2023-11-08 17:45:35 +00:00
// dataset is a n+1xm tensor of integers where dataset[-1] is the y std::vector
CFS(const torch::Tensor& samples, const std::vector<std::string>& features, const std::string& className, const int maxFeatures, const int classNumStates, const torch::Tensor& weights) :
FeatureSelect(samples, features, className, maxFeatures, classNumStates, weights)
{
}
2023-10-11 19:17:26 +00:00
virtual ~CFS() {};
void fit() override;
2023-10-11 19:17:26 +00:00
private:
2023-11-08 17:45:35 +00:00
bool computeContinueCondition(const std::vector<int>& featureOrder);
2023-10-11 19:17:26 +00:00
};
}
#endif