mirror of
https://github.com/rmontanana/mdlp.git
synced 2025-08-16 16:05:57 +00:00
Fix 2 code smell
This commit is contained in:
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"sonarlint.connectedMode.project": {
|
"sonarlint.connectedMode.project": {
|
||||||
"connectionId": "sonarcloud",
|
"connectionId": "rmontanana",
|
||||||
"projectKey": "rmontanana_mdlp"
|
"projectKey": "rmontanana_mdlp"
|
||||||
},
|
},
|
||||||
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
|
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
|
||||||
|
"cmake.configureOnOpen": true,
|
||||||
|
"sonarlint.pathToCompileCommands": "${workspaceFolder}/build/compile_commands.json"
|
||||||
}
|
}
|
@@ -15,7 +15,7 @@ namespace mdlp {
|
|||||||
CPPFImdlp::CPPFImdlp() = default;
|
CPPFImdlp::CPPFImdlp() = default;
|
||||||
CPPFImdlp::~CPPFImdlp() = default;
|
CPPFImdlp::~CPPFImdlp() = default;
|
||||||
|
|
||||||
size_t CPPFImdlp::compute_max_num_cut_points()
|
size_t CPPFImdlp::compute_max_num_cut_points() const
|
||||||
{
|
{
|
||||||
// Set the actual maximum number of cut points as a number or as a percentage of the number of samples
|
// Set the actual maximum number of cut points as a number or as a percentage of the number of samples
|
||||||
if (proposed_cuts == 0) {
|
if (proposed_cuts == 0) {
|
||||||
@@ -25,8 +25,8 @@ namespace mdlp {
|
|||||||
throw invalid_argument("wrong proposed num_cuts value");
|
throw invalid_argument("wrong proposed num_cuts value");
|
||||||
}
|
}
|
||||||
if (proposed_cuts < 1)
|
if (proposed_cuts < 1)
|
||||||
return (int)round(X.size() * proposed_cuts);
|
return static_cast<size_t>(round(X.size() * proposed_cuts));
|
||||||
return (int)proposed_cuts;
|
return static_cast<size_t>(proposed_cuts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPPFImdlp::fit(samples_t& X_, labels_t& y_)
|
void CPPFImdlp::fit(samples_t& X_, labels_t& y_)
|
||||||
@@ -174,7 +174,7 @@ namespace mdlp {
|
|||||||
sort(cutPoints.begin(), cutPoints.end());
|
sort(cutPoints.begin(), cutPoints.end());
|
||||||
return cutPoints;
|
return cutPoints;
|
||||||
}
|
}
|
||||||
int CPPFImdlp::get_depth()
|
int CPPFImdlp::get_depth() const
|
||||||
{
|
{
|
||||||
return depth;
|
return depth;
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ namespace mdlp {
|
|||||||
void computeCutPoints(size_t, size_t, int);
|
void computeCutPoints(size_t, size_t, int);
|
||||||
bool mdlp(size_t, size_t, size_t);
|
bool mdlp(size_t, size_t, size_t);
|
||||||
size_t getCandidate(size_t, size_t);
|
size_t getCandidate(size_t, size_t);
|
||||||
size_t compute_max_num_cut_points();
|
size_t compute_max_num_cut_points() const;
|
||||||
pair<precision_t, size_t> valueCutPoint(size_t, size_t, size_t);
|
pair<precision_t, size_t> valueCutPoint(size_t, size_t, size_t);
|
||||||
public:
|
public:
|
||||||
CPPFImdlp();
|
CPPFImdlp();
|
||||||
@@ -30,7 +30,7 @@ namespace mdlp {
|
|||||||
~CPPFImdlp();
|
~CPPFImdlp();
|
||||||
void fit(samples_t&, labels_t&);
|
void fit(samples_t&, labels_t&);
|
||||||
cutPoints_t getCutPoints();
|
cutPoints_t getCutPoints();
|
||||||
int get_depth();
|
int get_depth() const;
|
||||||
inline string version() { return "1.1.1"; };
|
inline string version() { return "1.1.1"; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user