chore: use iwyu on machine_learning/**.cpp

This commit is contained in:
realstealthninja
2024-09-13 15:38:42 +05:30
parent 0c6611a835
commit c3897d3763
5 changed files with 54 additions and 42 deletions

View File

@@ -19,15 +19,21 @@
* values having minimum F(state).
* @author [Ashish Daulatabad](https://github.com/AshishYUO)
*/
#include <algorithm> /// for `std::reverse` function
#include <array> /// for `std::array`, representing `EightPuzzle` board
#include <cassert> /// for `assert`
#include <functional> /// for `std::function` STL
#include <iostream> /// for IO operations
#include <map> /// for `std::map` STL
#include <memory> /// for `std::shared_ptr`
#include <set> /// for `std::set` STL
#include <vector> /// for `std::vector` STL
#include <stdint.h> // for uint32_t, int8_t
#include <algorithm> // for max, min
#include <array> // for array, operator==
#include <cassert> // for assert
#include <cstddef> // for size_t
#include <functional> // for function
#include <iostream> // for operator<<, basic_ostream, char_traits, cout
#include <map> // for operator!=, map, operator==
#include <memory> // for shared_ptr, make_shared, operator!=
#include <set> // for set
#include <tuple> // for tie, tuple
#include <utility> // for pair, move, make_pair, swap
#include <vector> // for vector
/**
* @namespace machine_learning
* @brief Machine learning algorithms

View File

@@ -26,15 +26,14 @@
* computed using stochastic gradient descent method.
*/
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <numeric>
#include <vector>
#include <bits/std_abs.h> // for abs
#include <array> // for array
#include <cassert> // for assert
#include <cstdlib> // for rand, exit, srand, strtof, EXIT_FAILURE
#include <ctime> // for time
#include <iostream> // for basic_ostream, operator<<, char_traits, cout
#include <numeric> // for inner_product
#include <vector> // for vector
/** Maximum number of iterations to learn */
constexpr int MAX_ITER = 500; // INT_MAX

View File

@@ -9,13 +9,16 @@
* the K-nearest neighbors.
*/
#include <algorithm> /// for std::transform and std::sort
#include <cassert> /// for assert
#include <cmath> /// for std::pow and std::sqrt
#include <iostream> /// for std::cout
#include <numeric> /// for std::accumulate
#include <unordered_map> /// for std::unordered_map
#include <vector> /// for std::vector
#include <algorithm> // for sort, transform
#include <cassert> // for assert
#include <cmath> // for sqrt, pow
#include <cstddef> // for size_t
#include <iostream> // for basic_ostream, operator<<, char_traits, cout
#include <iterator> // for back_inserter
#include <numeric> // for accumulate
#include <unordered_map> // for unordered_map, _Node_iterator
#include <utility> // for pair
#include <vector> // for vector
/**
* @namespace machine_learning
@@ -65,7 +68,7 @@ class Knn {
* @param Y labels vector
*/
explicit Knn(std::vector<std::vector<double>>& X, std::vector<int>& Y)
: X_(X), Y_(Y){};
: X_(X), Y_(Y) {};
/**
* Copy Constructor for class Knn.

View File

@@ -27,18 +27,20 @@
* MSE as loss function. Bias is also not included.
*/
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <valarray>
#include <vector>
#include <bits/chrono.h> // for duration, duration_cast, high_resolution_c...
#include <algorithm> // for max, min
#include <cassert> // for assert
#include <cmath> // for exp
#include <fstream> // for basic_ostream, operator<<, endl, basic_ist...
#include <iostream> // for cerr, cout
#include <sstream> // for basic_stringstream
#include <string> // for char_traits, basic_string, operator<<, ope...
#include <valarray> // for valarray
#include <vector> // for vector
#include <cstdlib> // for exit, size_t, EXIT_FAILURE
#include <utility> // for pair, make_pair
#include "vector_ops.hpp" // Custom header file for vector operations
#include "vector_ops.hpp" // for argmax, apply_function, get_shape, multiply
/** \namespace machine_learning
* \brief Machine learning algorithms

View File

@@ -9,11 +9,13 @@
*
* \author [Krishna Vedala](https://github.com/kvedala)
*/
#include <cassert>
#include <cmath> // for std::abs
#include <iomanip> // for print formatting
#include <iostream>
#include <vector>
#include <bits/std_abs.h> // for abs
#include <cassert> // for assert
#include <cstddef> // for size_t
#include <iomanip> // for operator<<, setfill, setw, _Setfill, _Setw
#include <iostream> // for basic_ostream, operator<<, char_traits, cout
#include <vector> // for vector
/**
* operator to print a matrix