SlideShare a Scribd company logo
Train with Python,
predict with C++
Pavel Filonov
+
+ +
+
+
+
+
About me
Pavel Filonov
Research Development Team Lead at
Kaspersky Lab
01
CoreHard. Train with Python, predict with C++
Machine Learning everywhere!
02
CoreHard. Train with Python, predict with C++
• Mobile
• Embedded
• Automotive
• Desktops
• Games
• Finance
• Etc.
Image from [1]
Machine Learning face the real world
03
CoreHard. Train with Python, predict with C++
Image from [2]
CRISP-DM
04
CoreHard. Train with Python, predict with C++
Image from [3]
Dream team
05
CoreHard. Train with Python, predict with C++
Developer Data Scientist
Dream team – synergy way
06
CoreHard. Train with Python, predict with C++
Developer Data Scientist Research Developer
Dream team – process way
07
CoreHard. Train with Python, predict with C++
Developer Data Scientist
Communications
Machine learning sample cases
08
CoreHard. Train with Python, predict with C++
1. Energy efficiency prediction
2. Intrusion detection system
3. Image classification
Buildings Energy Efficiency
09
CoreHard. Train with Python, predict with C++
ref: [4]
● Input attributes
○ Relative Compactness
○ Surface Area
○ Wall Area
○ etc.
● Outcomes
○ Heating Load
Regression problem
10
CoreHard. Train with Python, predict with C++
Regression problem
11
CoreHard. Train with Python, predict with C++
Regression problem
12
CoreHard. Train with Python, predict with C++
Quality metric
13
CoreHard. Train with Python, predict with C++
●
Baseline model
14
CoreHard. Train with Python, predict with C++
●
class Predictor {
public:
using features = std::vector<double>;
virtual ~Predictor() {};
virtual double predict(const features&) const = 0;
};
class MeanPredictor: public Predictor {
public:
MeanPredictor(double mean);
double predict(const features&) const override { return mean_; }
protected:
double mean_;
};
Linear regression
15
CoreHard. Train with Python, predict with C++
●
class LinregPredictor: public Predictor {
public:
LinregPredictor(const std::vector<double>&);
double predict(const features& feat) const override {
assert(feat.size() + 1 == coef_.size());
return std::inner_product(feat.begin(), feat.end(), ++coef_.begin(),
coef_.front());
}
protected:
std::vector<double> coef_;
};
Polynomial regression
16
CoreHard. Train with Python, predict with C++
●
class PolyPredictor: public LinregPredictor {
public:
using LinregPredictor::LinregPredictor;
double predict(const features& feat) const override {
features poly_feat{feat};
const auto m = feat.size();
poly_feat.reserve(m*(m+1)/2);
for (size_t i = 0; i < m; ++i) {
for (size_t j = i; j < m; ++j) {
poly_feat.push_back(feat[i]*feat[j]);
}
}
return LinregPredictor::predict(poly_feat);
}
};
Integration testing
17
CoreHard. Train with Python, predict with C++
● you always have a lot of data for testing
● use python model output as expected values
● beware of floating point arithmetic problems
TEST(LinregPredictor, compare_to_python) {
auto predictor = LinregPredictor{coef};
double y_pred_expected = 0.0;
std::ifstream test_data{"../train/test_data_linreg.csv"};
while (read_features(test_data, features)) {
test_data >> y_pred_expected;
auto y_pred = predictor.predict(features);
EXPECT_NEAR(y_pred_expected, y_pred, 1e-4);
}
}
Intrusion detection system
18
CoreHard. Train with Python, predict with C++
● input - network traffic features
○ protocol_type
○ connection duration
○ src_bytes
○ dst_bytes
○ etc.
● Output
○ normal
○ network attack
ref: [5]
Classification problem
19
CoreHard. Train with Python, predict with C++
Quality metrics
20
CoreHard. Train with Python, predict with C++
● Receive operation characteristics (ROC) curve
Baseline model
21
CoreHard. Train with Python, predict with C++
● always predict most frequent class
● ROC area under the curve = 0.5
Logistic regression
22
CoreHard. Train with Python, predict with C++
●
Logistic regression
23
CoreHard. Train with Python, predict with C++
● easy to implement
template<typename T>
auto sigma(T z) {
return 1/(1 + std::exp(-z));
}
class LogregClassifier: public BinaryClassifier {
public:
float predict_proba(const features_t& feat) const override {
auto z = std::inner_product(feat.begin(), feat.end(),
++coef_.begin(), coef_.front());
return sigma(z);
}
protected:
std::vector<float> coef_;
};
Gradient boosting
24
CoreHard. Train with Python, predict with C++
● de facto standard universal method
● multiple well known C++ implementations with python bindings
○ XGBoost
○ LigthGBM
○ CatBoost
● each implementation has its own custom model format
CatBoost
25
CoreHard. Train with Python, predict with C++
● C API and C++ wrapper
● own build system (ymake)
class CatboostClassifier: public BinaryClassifier {
public:
CatboostClassifier(const std::string& modepath);
~CatboostClassifier() override;
double predict_proba(const features_t& feat) const override {
double result = 0.0;
if (!CalcModelPredictionSingle(model_, feat.data(), feat.size(),
nullptr, 0, &result, 1)) {
throw std::runtime_error{"CalcModelPredictionFlat error message:" +
GetErrorString()};
}
return result;
}
private:
ModelCalcerHandle* model_;
}
CatBoost
26
CoreHard. Train with Python, predict with C++
● ROC-AUC = 0.9999
Image classification
27
CoreHard. Train with Python, predict with C++
● Handwritten digits recognizer – MNIST
● input – gray-scale pixels 28x28
● output – digit on picture (0, 1, … 9)
Multilayer perceptron
28
CoreHard. Train with Python, predict with C++
Image from: [6]
Quality metrics
29
CoreHard. Train with Python, predict with C++
●
Multilayer perceptron
30
CoreHard. Train with Python, predict with C++
●
auto MlpClassifier::predict_proba(const features_t& feat) const {
VectorXf x{feat.size()};
auto o1 = sigmav(w1_ * x);
auto o2 = softmax(w2_ * o1);
return o2;
}
Multilayer perceptron
31
CoreHard. Train with Python, predict with C++
●
auto MlpClassifier::predict_proba(const features_t& feat) const {
VectorXf x{feat.size()};
auto o1 = sigmav(w1_ * x);
auto o2 = softmax(w2_ * o1);
return o2;
}
Convolutional networks
31
CoreHard. Train with Python, predict with C++
● State of the Art algorithms in image processing
● a lot of C++ implementation with python bindings
○ TensorFlow
○ Caffe
○ MXNet
○ CNTK
Tensorflow
31
CoreHard. Train with Python, predict with C++
● C++ API
● Bazel build system
● Hint – prebuild C API
Conclusion
31
CoreHard. Train with Python, predict with C++
● Don’t be fear of the ML
● Try simpler things first
● Get benefits from different languages
References
02
CoreHard. Train with Python, predict with C++
1. Andrew Ng, Machine Learning – coursera
2. How to Get the Right Creative Requirements From Your Client
3. The Forgotten Step in CRISP-DM and ASUM-DM Methodologies
4. Energy efficiency Data Set
5. KDD Cup 1999
6. MNIST training with Multi Layer Perceptron
7. Code samples
+
+
+
+
+
+
+
Many thanks!
Let’s talk
Pavel Filonov Pavel.Filonov@kaspersky.com +7(966)077-32-80
+

More Related Content

PPTX
Graphics in C++
PDF
Juan josefumeroarray14
PPTX
Introduction to graphics programming in c
PDF
PPTX
Make2win 線上課程分析
PPTX
Advance Multimedia Tech. Augmented reality. Pertemuan 2
PPT
Graphics in C++
Juan josefumeroarray14
Introduction to graphics programming in c
Make2win 線上課程分析
Advance Multimedia Tech. Augmented reality. Pertemuan 2

What's hot (20)

DOCX
PDF
Brief Introduction to Cython
PPTX
Egor Bogatov - .NET Core intrinsics and other micro-optimizations
PPTX
Games no Windows (FATEC 2015)
DOCX
C graphics programs file
PPTX
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
DOCX
analog clock C#
PPTX
Part - 2 Cpp programming Solved MCQ
PDF
Value-Based Manufacturing Optimisation in Serverless Clouds for Industry 4.0
PPTX
Operator overloading2
PPTX
C++ via C#
PDF
Early Results of OpenMP 4.5 Portability on NVIDIA GPUs & CPUs
PDF
C programs Set 2
PPTX
Computer Engineering (Programming Language: Swift)
PDF
Tech Talks @NSU: DLang: возможности языка и его применение
PDF
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
TXT
Firefox content
DOCX
C++ file
PDF
Exploiting vectorization with ISPC
PDF
Android Developer Days: Increasing performance of big arrays processing on An...
Brief Introduction to Cython
Egor Bogatov - .NET Core intrinsics and other micro-optimizations
Games no Windows (FATEC 2015)
C graphics programs file
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
analog clock C#
Part - 2 Cpp programming Solved MCQ
Value-Based Manufacturing Optimisation in Serverless Clouds for Industry 4.0
Operator overloading2
C++ via C#
Early Results of OpenMP 4.5 Portability on NVIDIA GPUs & CPUs
C programs Set 2
Computer Engineering (Programming Language: Swift)
Tech Talks @NSU: DLang: возможности языка и его применение
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
Firefox content
C++ file
Exploiting vectorization with ISPC
Android Developer Days: Increasing performance of big arrays processing on An...
Ad

Similar to C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов (20)

DOCX
Course Title CS591-Advance Artificial Intelligence
PDF
Disease Prediction Using Machine Learning
PPTX
Introduction & Hands-on with H2O Driverless AI
PDF
Introduction To Machine Learning With Python A Guide For Data Scientists 1st ...
PPTX
Jay Yagnik at AI Frontiers : A History Lesson on AI
PDF
Neural Networks in the Wild: Handwriting Recognition
PDF
EKON22 Introduction to Machinelearning
PDF
Pycon tati gabru
PPTX
Keras on tensorflow in R & Python
PDF
Deep learning with Keras
PDF
OpenPOWER Workshop in Silicon Valley
PDF
Introduction to Machine Learning with Python ( PDFDrive.com ).pdf
PPTX
Building largescalepredictionsystemv1
PPTX
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
PPTX
Image classification using convolutional neural network
PDF
IRJET- Python Libraries and Packages for Deep Learning-A Survey
PDF
Heart Disease Prediction using Machine Learning
PPTX
Notes on Deploying Machine-learning Models at Scale
PPTX
Supervised learning
PPTX
Classification: MNIST, training a Binary classifier, performance measure, mul...
Course Title CS591-Advance Artificial Intelligence
Disease Prediction Using Machine Learning
Introduction & Hands-on with H2O Driverless AI
Introduction To Machine Learning With Python A Guide For Data Scientists 1st ...
Jay Yagnik at AI Frontiers : A History Lesson on AI
Neural Networks in the Wild: Handwriting Recognition
EKON22 Introduction to Machinelearning
Pycon tati gabru
Keras on tensorflow in R & Python
Deep learning with Keras
OpenPOWER Workshop in Silicon Valley
Introduction to Machine Learning with Python ( PDFDrive.com ).pdf
Building largescalepredictionsystemv1
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
Image classification using convolutional neural network
IRJET- Python Libraries and Packages for Deep Learning-A Survey
Heart Disease Prediction using Machine Learning
Notes on Deploying Machine-learning Models at Scale
Supervised learning
Classification: MNIST, training a Binary classifier, performance measure, mul...
Ad

More from corehard_by (20)

PPTX
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
PPTX
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
PDF
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
PPTX
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
PPTX
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
PPTX
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
PPTX
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
PPTX
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
PPTX
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
PPTX
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
PDF
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
PPTX
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
PDF
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
PDF
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
PDF
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
PDF
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
PPTX
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
PDF
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
PDF
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
PDF
Статичный SQL в С++14. Евгений Захаров ➠ CoreHard Autumn 2019
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
Статичный SQL в С++14. Евгений Захаров ➠ CoreHard Autumn 2019

Recently uploaded (20)

PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Machine learning based COVID-19 study performance prediction
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Cloud computing and distributed systems.
PPT
Teaching material agriculture food technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Unlocking AI with Model Context Protocol (MCP)
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Big Data Technologies - Introduction.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation_ Review paper, used for researhc scholars
MIND Revenue Release Quarter 2 2025 Press Release
MYSQL Presentation for SQL database connectivity
Machine learning based COVID-19 study performance prediction
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Building Integrated photovoltaic BIPV_UPV.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Cloud computing and distributed systems.
Teaching material agriculture food technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Unlocking AI with Model Context Protocol (MCP)
“AI and Expert System Decision Support & Business Intelligence Systems”
Big Data Technologies - Introduction.pptx
Spectral efficient network and resource selection model in 5G networks
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Spectroscopy.pptx food analysis technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation_ Review paper, used for researhc scholars

C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов

  • 1. Train with Python, predict with C++ Pavel Filonov + + + + + + +
  • 2. About me Pavel Filonov Research Development Team Lead at Kaspersky Lab 01 CoreHard. Train with Python, predict with C++
  • 3. Machine Learning everywhere! 02 CoreHard. Train with Python, predict with C++ • Mobile • Embedded • Automotive • Desktops • Games • Finance • Etc. Image from [1]
  • 4. Machine Learning face the real world 03 CoreHard. Train with Python, predict with C++ Image from [2]
  • 5. CRISP-DM 04 CoreHard. Train with Python, predict with C++ Image from [3]
  • 6. Dream team 05 CoreHard. Train with Python, predict with C++ Developer Data Scientist
  • 7. Dream team – synergy way 06 CoreHard. Train with Python, predict with C++ Developer Data Scientist Research Developer
  • 8. Dream team – process way 07 CoreHard. Train with Python, predict with C++ Developer Data Scientist Communications
  • 9. Machine learning sample cases 08 CoreHard. Train with Python, predict with C++ 1. Energy efficiency prediction 2. Intrusion detection system 3. Image classification
  • 10. Buildings Energy Efficiency 09 CoreHard. Train with Python, predict with C++ ref: [4] ● Input attributes ○ Relative Compactness ○ Surface Area ○ Wall Area ○ etc. ● Outcomes ○ Heating Load
  • 11. Regression problem 10 CoreHard. Train with Python, predict with C++
  • 12. Regression problem 11 CoreHard. Train with Python, predict with C++
  • 13. Regression problem 12 CoreHard. Train with Python, predict with C++
  • 14. Quality metric 13 CoreHard. Train with Python, predict with C++ ●
  • 15. Baseline model 14 CoreHard. Train with Python, predict with C++ ● class Predictor { public: using features = std::vector<double>; virtual ~Predictor() {}; virtual double predict(const features&) const = 0; }; class MeanPredictor: public Predictor { public: MeanPredictor(double mean); double predict(const features&) const override { return mean_; } protected: double mean_; };
  • 16. Linear regression 15 CoreHard. Train with Python, predict with C++ ● class LinregPredictor: public Predictor { public: LinregPredictor(const std::vector<double>&); double predict(const features& feat) const override { assert(feat.size() + 1 == coef_.size()); return std::inner_product(feat.begin(), feat.end(), ++coef_.begin(), coef_.front()); } protected: std::vector<double> coef_; };
  • 17. Polynomial regression 16 CoreHard. Train with Python, predict with C++ ● class PolyPredictor: public LinregPredictor { public: using LinregPredictor::LinregPredictor; double predict(const features& feat) const override { features poly_feat{feat}; const auto m = feat.size(); poly_feat.reserve(m*(m+1)/2); for (size_t i = 0; i < m; ++i) { for (size_t j = i; j < m; ++j) { poly_feat.push_back(feat[i]*feat[j]); } } return LinregPredictor::predict(poly_feat); } };
  • 18. Integration testing 17 CoreHard. Train with Python, predict with C++ ● you always have a lot of data for testing ● use python model output as expected values ● beware of floating point arithmetic problems TEST(LinregPredictor, compare_to_python) { auto predictor = LinregPredictor{coef}; double y_pred_expected = 0.0; std::ifstream test_data{"../train/test_data_linreg.csv"}; while (read_features(test_data, features)) { test_data >> y_pred_expected; auto y_pred = predictor.predict(features); EXPECT_NEAR(y_pred_expected, y_pred, 1e-4); } }
  • 19. Intrusion detection system 18 CoreHard. Train with Python, predict with C++ ● input - network traffic features ○ protocol_type ○ connection duration ○ src_bytes ○ dst_bytes ○ etc. ● Output ○ normal ○ network attack ref: [5]
  • 20. Classification problem 19 CoreHard. Train with Python, predict with C++
  • 21. Quality metrics 20 CoreHard. Train with Python, predict with C++ ● Receive operation characteristics (ROC) curve
  • 22. Baseline model 21 CoreHard. Train with Python, predict with C++ ● always predict most frequent class ● ROC area under the curve = 0.5
  • 23. Logistic regression 22 CoreHard. Train with Python, predict with C++ ●
  • 24. Logistic regression 23 CoreHard. Train with Python, predict with C++ ● easy to implement template<typename T> auto sigma(T z) { return 1/(1 + std::exp(-z)); } class LogregClassifier: public BinaryClassifier { public: float predict_proba(const features_t& feat) const override { auto z = std::inner_product(feat.begin(), feat.end(), ++coef_.begin(), coef_.front()); return sigma(z); } protected: std::vector<float> coef_; };
  • 25. Gradient boosting 24 CoreHard. Train with Python, predict with C++ ● de facto standard universal method ● multiple well known C++ implementations with python bindings ○ XGBoost ○ LigthGBM ○ CatBoost ● each implementation has its own custom model format
  • 26. CatBoost 25 CoreHard. Train with Python, predict with C++ ● C API and C++ wrapper ● own build system (ymake) class CatboostClassifier: public BinaryClassifier { public: CatboostClassifier(const std::string& modepath); ~CatboostClassifier() override; double predict_proba(const features_t& feat) const override { double result = 0.0; if (!CalcModelPredictionSingle(model_, feat.data(), feat.size(), nullptr, 0, &result, 1)) { throw std::runtime_error{"CalcModelPredictionFlat error message:" + GetErrorString()}; } return result; } private: ModelCalcerHandle* model_; }
  • 27. CatBoost 26 CoreHard. Train with Python, predict with C++ ● ROC-AUC = 0.9999
  • 28. Image classification 27 CoreHard. Train with Python, predict with C++ ● Handwritten digits recognizer – MNIST ● input – gray-scale pixels 28x28 ● output – digit on picture (0, 1, … 9)
  • 29. Multilayer perceptron 28 CoreHard. Train with Python, predict with C++ Image from: [6]
  • 30. Quality metrics 29 CoreHard. Train with Python, predict with C++ ●
  • 31. Multilayer perceptron 30 CoreHard. Train with Python, predict with C++ ● auto MlpClassifier::predict_proba(const features_t& feat) const { VectorXf x{feat.size()}; auto o1 = sigmav(w1_ * x); auto o2 = softmax(w2_ * o1); return o2; }
  • 32. Multilayer perceptron 31 CoreHard. Train with Python, predict with C++ ● auto MlpClassifier::predict_proba(const features_t& feat) const { VectorXf x{feat.size()}; auto o1 = sigmav(w1_ * x); auto o2 = softmax(w2_ * o1); return o2; }
  • 33. Convolutional networks 31 CoreHard. Train with Python, predict with C++ ● State of the Art algorithms in image processing ● a lot of C++ implementation with python bindings ○ TensorFlow ○ Caffe ○ MXNet ○ CNTK
  • 34. Tensorflow 31 CoreHard. Train with Python, predict with C++ ● C++ API ● Bazel build system ● Hint – prebuild C API
  • 35. Conclusion 31 CoreHard. Train with Python, predict with C++ ● Don’t be fear of the ML ● Try simpler things first ● Get benefits from different languages
  • 36. References 02 CoreHard. Train with Python, predict with C++ 1. Andrew Ng, Machine Learning – coursera 2. How to Get the Right Creative Requirements From Your Client 3. The Forgotten Step in CRISP-DM and ASUM-DM Methodologies 4. Energy efficiency Data Set 5. KDD Cup 1999 6. MNIST training with Multi Layer Perceptron 7. Code samples
  • 37. + + + + + + + Many thanks! Let’s talk Pavel Filonov Pavel.Filonov@kaspersky.com +7(966)077-32-80 +