Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Estelle ARRICAU
Embedded Machine Learning
Commits
0bf48fa2
Commit
0bf48fa2
authored
Jan 16, 2022
by
Estelle ARRICAU
Browse files
add new README
parent
afaf8481
Changes
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
0bf48fa2
cmake_minimum_required
(
VERSION 3.16
)
project
(
EML
)
# set(CMAKE_C_COMPILER "/usr/bin/gcc-11")
#
set(CMAKE_CXX_COMPILER "/usr/bin/g++-11")
set
(
CMAKE_CXX_COMPILER
"/usr/bin/g++-11"
)
# cmake -DCMAKE_CXX_COMPILER=/usr/bin/g++-11 ..
set
(
CMAKE_CXX_STANDARD 20
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-O3 -Wall -Wextra -std=c++20"
)
...
...
READMETOO.md
0 → 100644
View file @
0bf48fa2
## Pre requisites
Necessary python librairies:
*
keras
*
sklearn
*
graphviz
*
pandas
*
tensorflow
Donwload the database
[
here
](
https://www.kaggle.com/carlthome/gtzan-genre-collection
)
. Then, from the root of the project:
````
cd DATASETS/
````
Then decompress the archive here.
## Compile the projet
From the root of the project:
````
mkdir build
cd build/
cmake ..
make
````
## Extract features from database
From the root of the project:
````
cd build/Extraction/
./EXTRACTION
````
A file
**features.csv**
has been written into the folder
```build/Extraction/```
.
## Classify data
### Train the classifier
Launch the python file in the folder of the classifier to train.
A file
**file_test.csv**
has been written into the folder
```classifier_name/```
.
### Apply the classifier
From the root of the project
*
Example with a music sample:
````
cd build/RF/
./RF ../../DATASETS/genres/jazz/jazz.00022.au
````
*
Example for all the test data:
````
cd build/RF/
./RF
````
\ No newline at end of file
RF/Python/RF_training.py
View file @
0bf48fa2
...
...
@@ -4,37 +4,18 @@ from time import time
import
sys
import
warnings
import
sklearn
from
sklearn.utils.multiclass
import
unique_labels
from
sklearn.metrics
import
confusion_matrix
from
sklearn.model_selection
import
train_test_split
from
sklearn
import
svm
,
datasets
from
sklearn.metrics
import
roc_curve
,
auc
from
sklearn.preprocessing
import
label_binarize
from
sklearn.preprocessing
import
StandardScaler
from
sklearn.base
import
clone
from
sklearn.preprocessing
import
LabelEncoder
from
sklearn
import
preprocessing
from
sklearn
import
metrics
import
seaborn
as
sns
import
matplotlib.pyplot
as
plt
import
numpy
as
np
from
numpy.random
import
rand
import
scipy
as
sp
from
scipy
import
interp
import
pandas
as
pd
from
sklearn
import
linear_model
from
sklearn.neural_network
import
MLPClassifier
from
sklearn.ensemble
import
RandomForestClassifier
from
sklearn.svm
import
SVC
from
sklearn.model_selection
import
train_test_split
from
sklearn.model_selection
import
learning_curve
from
sklearn.model_selection
import
GridSearchCV
from
sklearn.datasets
import
fetch_lfw_people
from
sklearn.metrics
import
classification_report
from
sklearn.decomposition
import
PCA
from
sklearn.model_selection
import
cross_val_score
from
sklearn.metrics
import
ConfusionMatrixDisplay
from
sklearn.metrics
import
accuracy_score
from
sklearn.tree
import
export_graphviz
,
export_text
# ---------------------------------------->
...
...
@@ -219,17 +200,6 @@ def train_RF(saveAlgo=False, path=""):
display_model_performance_metrics
(
labelInd_test
,
prediction_random_best
,
labelIndices_unique
)
# print(prediction_random_best)
# print(model_best.apply(X_train))
# print(model_best.decision_path(X_train))
# for e in model_best.estimators_:
# print(e.tree_)
# print(e.classes_)
# print(e.n_classes_)
# print(e.n_outputs_)
# report = export_text(e)
# print(report)
# help(sklearn.tree._tree.Tree)
file
=
path
+
'RF/RFTrained.h'
open
(
file
,
'w'
).
close
()
with
open
(
file
,
'a'
)
as
f
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment