Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
SermetPekin committed Dec 9, 2024
1 parent 18006ba commit ae9ff09
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions include/datasetType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ inline DatasetType convert_to_dataset(const vv_double &data, int target_column =
continue; // Skip empty rows
}

// Determine target column index
// target column index
int target_idx = (target_column == -1) ? row.size() - 1 : target_column;
// Create inputs and targets
// inputs and targets
std::vector<std::shared_ptr<Value>> inputs;
std::vector<std::shared_ptr<Value>> targets;
for (size_t i = 0; i < row.size(); ++i)
Expand All @@ -58,7 +58,7 @@ inline DatasetType convert_to_dataset(const vv_double &data, int target_column =
}
}

// Add the pair to the dataset

dataset.emplace_back(inputs, targets);
}

Expand All @@ -75,12 +75,12 @@ inline DatasetType convert_to_dataset(const DataFrame &df, int target_column = -
{
if (row.empty())
{
continue; // Skip empty rows
continue;
}

// Determine target column index

int target_idx = (target_column == -1) ? row.size() - 1 : target_column;
// Create inputs and targets

std::vector<std::shared_ptr<Value>> inputs;
std::vector<std::shared_ptr<Value>> targets;
for (size_t i = 0; i < row.size(); ++i)
Expand All @@ -95,7 +95,7 @@ inline DatasetType convert_to_dataset(const DataFrame &df, int target_column = -
}
}

// Add the pair to the dataset

dataset.emplace_back(inputs, targets);
}

Expand All @@ -118,27 +118,27 @@ inline void write_dataset_to_csv(const DatasetType &dataset, const std::string &
return;
}

// Write the header
// the header
size_t num_features = dataset[0].first.size();
for (size_t i = 0; i < num_features; ++i)
{
file << "Feature" << i + 1 << ",";
}
file << "Target" << std::endl;

// Write the data
// the data
for (const auto &sample : dataset)
{
const auto &features = sample.first;
const auto &targets = sample.second;

// Write features
// features
for (const auto &feature : features)
{
file << feature->data << ",";
}

// Write target (assuming one target per sample)
// target
if (!targets.empty())
{
file << targets[0]->data;
Expand Down

0 comments on commit ae9ff09

Please sign in to comment.