Machine learning with Sklearn Python

How to made a supervisioned classifier with python

22 Giugno 2022

In the previous article, Data Mining for industrial 4.0 was described to train the machine learning system for the recognition of the topics (or sensors) of an industrial machine.

There are four datasets for machine learning training and testing in the format described above: topic, datetime_start, datetime_end, occurs, min, max, avg and dev\.stand.

For the recognition of the topic of an industrial machine I used a supervisioning learning machine learning.

To implement supervised learning I used the Python sklearn library.

To implement supervised learning I used the Python sklearn library in particular I used four types of classifiers: SVM (support-vector machine), KNN (k-nearest neighbors), TREE (decision tree) and GaussianNB (gaussian naive bayes).

The X training of machine learning are: occurs, min, max, avg and dev_stand and the Y training is the topic.

Therefore, to recap, given the X's as input, we want to recognize the Y's.

I created a python class "Predict()" where i training the X and Y values and i include the "sklearn" modules and wrap the methods to get the following indicators: accurency, precision, recall, F1 (macro and micro average), hamming loss, zero one loss, the list of label predicted, the confuzion matrix and the reporto of the pki. Below is an example of using the Predict() class.

code python

In figure 1 the example of analisys result of method that given the X and Y inputs and executes the p.getPredicionsAnalysis() on topic motorstop with the KNN classifier.

code python Figure 1: The result of the prediciont analisys
Copyright © All rights reserved | This template is made with by Colorlib
Contents edited by Giuseppe De Martino
Licenza Creative Commons