Fix some more lint warnings

This commit is contained in:
2023-07-30 00:04:18 +02:00
parent 8b2ed26ab7
commit b882569169
5 changed files with 18 additions and 28 deletions

View File

@@ -21,9 +21,7 @@ namespace platform {
vector<string> Datasets::getNames()
{
vector<string> result;
for (auto& d : datasets) {
result.push_back(d.first);
}
transform(datasets.begin(), datasets.end(), back_inserter(result), [](const auto& d) { return d.first; });
return result;
}
vector<string> Datasets::getFeatures(string name)
@@ -79,7 +77,7 @@ namespace platform {
}
return datasets[name]->getTensors();
}
bool Datasets::isDataset(string name)
bool Datasets::isDataset(const string& name)
{
return datasets.find(name) != datasets.end();
}
@@ -193,9 +191,8 @@ namespace platform {
yv = arff.getY();
// Get className & Features
className = arff.getClassName();
for (auto feature : arff.getAttributes()) {
features.push_back(feature.first);
}
auto attributes = arff.getAttributes();
transform(attributes.begin(), attributes.end(), back_inserter(features), [](const auto& attribute) { return attribute.first; });
}
void Dataset::load()
{

View File

@@ -49,7 +49,7 @@ namespace platform {
bool discretize;
void load(); // Loads the list of datasets
public:
Datasets(const string& path, bool discretize = false, fileType_t fileType = ARFF) : path(path), discretize(discretize), fileType(fileType) { load(); };
explicit Datasets(const string& path, bool discretize = false, fileType_t fileType = ARFF) : path(path), discretize(discretize), fileType(fileType) { load(); };
vector<string> getNames();
vector<string> getFeatures(string name);
int getNSamples(string name);
@@ -58,7 +58,7 @@ namespace platform {
pair<vector<vector<float>>&, vector<int>&> getVectors(string name);
pair<vector<vector<int>>&, vector<int>&> getVectorsDiscretized(string name);
pair<torch::Tensor&, torch::Tensor&> getTensors(string name);
bool isDataset(string name);
bool isDataset(const string& name);
};
};