{"id":28725839,"url":"https://github.com/khofesh/machine-learning-cpp","last_synced_at":"2025-06-15T12:08:09.271Z","repository":{"id":293217097,"uuid":"983318841","full_name":"khofesh/machine-learning-cpp","owner":"khofesh","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-11T15:42:19.000Z","size":234,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T16:50:47.602Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khofesh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-14T07:53:24.000Z","updated_at":"2025-06-11T15:42:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2f75af8-a4d2-4d63-84b6-913a0c423d61","html_url":"https://github.com/khofesh/machine-learning-cpp","commit_stats":null,"previous_names":["khofesh/machine-learning-cpp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/khofesh/machine-learning-cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khofesh%2Fmachine-learning-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khofesh%2Fmachine-learning-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khofesh%2Fmachine-learning-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khofesh%2Fmachine-learning-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khofesh","download_url":"https://codeload.github.com/khofesh/machine-learning-cpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khofesh%2Fmachine-learning-cpp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259971374,"owners_count":22940012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-15T12:08:08.703Z","updated_at":"2025-06-15T12:08:09.264Z","avatar_url":"https://github.com/khofesh.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hands-on machine learning with C++ 2nd edition\n\n## local development environment\n\ninstalling several dependencies\n\n```shell\n# Basic tools and development packages\nsudo dnf install -y unzip\nsudo dnf install -y gcc gcc-c++ make  # equivalent to build-essential\nsudo dnf install -y gdb\nsudo dnf install -y git\nsudo dnf install -y cmake\nsudo dnf install -y cmake-gui  # equivalent to cmake-curses-gui\nsudo dnf install -y python3\nsudo dnf install -y python3-pip\nsudo dnf install -y blas-devel  # equivalent to libblas-dev\nsudo dnf install -y openblas-devel  # equivalent to libopenblas-dev\nsudo dnf install -y fftw-devel  # equivalent to libfftw3-dev\nsudo dnf install -y atlas-devel  # equivalent to libatlas-base-dev\nsudo dnf install -y lapack-devel  # equivalent to liblapack-dev and liblapacke-dev\nsudo dnf install -y boost-devel  # equivalent to libboost-all-dev\n\n# OpenCV packages - these may need adjustment based on version available in repos\nsudo dnf install -y opencv-core  # equivalent to libopencv-core4.5d\nsudo dnf install -y opencv-devel # development files\nsudo dnf install -y opencv  # main package\n\n# Additional libraries\nsudo dnf install -y hdf5-devel  # equivalent to libhdf5-dev\nsudo dnf install -y json-c-devel  # equivalent to libjson-c-dev\nsudo dnf install -y libX11-devel  # equivalent to libx11-dev\nsudo dnf install -y java-1.8.0-openjdk-devel  # equivalent to openjdk-8-jdk\nsudo dnf install -y wget\nsudo dnf install -y ninja-build\nsudo dnf install -y gnuplot\nsudo dnf install -y vim\nsudo dnf install -y python3-virtualenv  # equivalent to python3-venv\n\n\nsudo dnf install ocl-icd-devel opencl-headers\n\nsudo dnf install fmt-devel\nsudo dnf install nnpack-devel\nsudo dnf install mlpack-devel\n\n# arrayfire\nsudo dnf install spdlog-devel\n\npip3 install pyyaml\npip3 install typing\npip3 install typing_extensions\n```\n\n## flashlight\n\n```shell\ncat \u003e flashlight_algo_fix.patch \u003c\u003c 'EOF'\ndiff --git a/flashlight/fl/tensor/backend/af/ArrayFireReductions.cpp b/flashlight/fl/tensor/backend/af/ArrayFireReductions.cpp\nindex xxxxxxx..xxxxxxx 100644\n--- a/flashlight/fl/tensor/backend/af/ArrayFireReductions.cpp\n+++ b/flashlight/fl/tensor/backend/af/ArrayFireReductions.cpp\n@@ -13,6 +13,7 @@\n #include \"flashlight/fl/tensor/backend/af/ArrayFireTensor.h\"\n\n #include \u003cstdexcept\u003e\n+#include \u003calgorithm\u003e\n\n #include \"flashlight/fl/tensor/Index.h\"\n #include \"flashlight/fl/tensor/backend/af/Utils.h\"\ndiff --git a/flashlight/fl/tensor/TensorBase.cpp b/flashlight/fl/tensor/TensorBase.cpp\nindex xxxxxxx..xxxxxxx 100644\n--- a/flashlight/fl/tensor/TensorBase.cpp\n+++ b/flashlight/fl/tensor/TensorBase.cpp\n@@ -10,6 +10,7 @@\n #include \"flashlight/fl/tensor/TensorBase.h\"\n\n #include \u003ccstring\u003e\n+#include \u003calgorithm\u003e\n #include \u003cmemory\u003e\n #include \u003cnumeric\u003e\n #include \u003csstream\u003e\nEOF\n\ncd /media/wdhome/github/khofesh/machine-learning-cpp/development/libs/sources/flashlight/\npatch -p1 \u003c /path/to/flashlight_algo_fix.patch\n```\n\n### nccl\n\ndownload nccl from here https://developer.nvidia.com/nccl\n\n```shell\nsudo dnf install nccl-local-repo-rhel9-2.26.5-cuda12.9-1.0-1.x86_64.rpm\nsudo dnf  install libnccl-2.26.5-1+cuda12.9 libnccl-devel-2.26.5-1+cuda12.9 libnccl-static-2.26.5-1+cuda12.9\n```\n\n### pytorch\n\ndown the zip file here https://pytorch.org/get-started/locally/\n\nor https://download.pytorch.org/libtorch/cu128/libtorch-cxx11-abi-shared-with-deps-2.7.0%2Bcu128.zip\n\n```shell\nwget https://download.pytorch.org/libtorch/cu128/libtorch-cxx11-abi-shared-with-deps-2.7.0%2Bcu128.zip\nmv libtorch-cxx11-abi-shared-with-deps-2.7.0+cu128.zip development/libs\ncd development/libs\nunzip libtorch-cxx11-abi-shared-with-deps-2.7.0+cu128.zip\n```\n\nI'm using cuda 12.9, so pay attention to this PR https://github.com/pytorch/pytorch/issues/152756 and make some changes accordingly\n\nrun `check_torch` if the lib is working\n\n### arrayfire\n\ndownload arrayfire here https://arrayfire.com/binaries/\n\n```shell\ncd development\nmkdir arrayfire\nwget https://arrayfire.gateway.scarf.sh/linux/3.9.0/ArrayFire.sh\nchmod +x ArrayFire-v3.9.0_Linux_x86_64.sh\n\n./ArrayFire-v3.9.0_Linux_x86_64.sh\n\n# say \"no\" during\n## Do you accept the license? [yn]:\n## y\n## By default the ArrayFire will be installed in:\n##   \"/path/to/development/arrayfire/ArrayFire-3.9.0-Linux\"\n## Do you want to include the subdirectory ArrayFire-3.9.0-Linux?\n## Saying no will install in: \"/path/to/development/arrayfire\" [Yn]:\n##\n```\n\n### vcpkg\n\n```shell\ngit clone https://github.com/Microsoft/vcpkg.git\ncd vcpkg\n\n./bootstrap-vcpkg.sh  # on linux\n./vcpkg install dlib\n```\n\nVS Code Settings\n\n1. Open VS Code settings (Ctrl+, or Cmd+,)\n2. Search for \"cmake configure environment\"\n3. Add the environment variable in CMake: Configure Environment:\n\n```\njson{\n  \"VCPKG_ROOT\": \"/home/fahmad/vcpkg\"\n}\n```\n\nchapter 2\n\n```shell\n# cd to your vcpkg\ncd /to/your/path\n# optional\n./vcpkg upgrade --no-dry-run\n\n# json\n./vcpkg install nlohmann-json\n# fast-cpp-csv-parser\n./vcpkg install fast-cpp-csv-parser\n\n```\n\n## folder structure\n\n```shell\ntree -I \"Hands-on-Machine-learning-with-C-Second-Edition|LearningModCppFinance\" -L 4\n```\n\n## references\n\n- C++ Implementation of PyTorch Tutorials for Everyone - https://github.com/prabhuomkar/pytorch-cpp\n- Learning Modern C++ for Finance - https://github.com/QuantDevHacks/LearningModCppFinance/\n- distrobox - https://github.com/89luca89/distrobox?tab=readme-ov-file\n\n## TODO\n\n- [ ] use vcpkg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhofesh%2Fmachine-learning-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhofesh%2Fmachine-learning-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhofesh%2Fmachine-learning-cpp/lists"}