From b849b3f6e0f8397cba9a441a4c3e549f8c20593d Mon Sep 17 00:00:00 2001 From: Javier Duarte Date: Sun, 3 Feb 2019 15:52:03 +0000 Subject: [PATCH] small fixes --- install.sh | 9 ++++++--- install_miniconda3.sh | 4 ++-- keras-to-hls/extract_roc.py | 5 +++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 8623154931..15cf261ffe 100644 --- a/install.sh +++ b/install.sh @@ -1,9 +1,12 @@ -conda create --copy --name hls4ml-env python=3.6 +conda create -y --copy --name hls4ml-env python=3.6 source activate hls4ml-env ## CPU version of pytorch for now #conda install pytorch torchvision -c pytorch -conda install pytorch-cpu torchvision-cpu -c pytorch +conda install -y pytorch-cpu torchvision-cpu -c pytorch -conda install -c anaconda scikit-learn h5py pyyaml +conda install -y -c anaconda scikit-learn h5py pyyaml + +# for plotting ROC curves, etc. +pip install matplotlib diff --git a/install_miniconda3.sh b/install_miniconda3.sh index bd66ce0735..c7383fc51e 100644 --- a/install_miniconda3.sh +++ b/install_miniconda3.sh @@ -1,3 +1,3 @@ -wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -bash Miniconda3-latest-Linux-x86_64.sh +wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O Miniconda3-latest-Linux-x86_64.sh +bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda3 export PATH="$CONDA_PREFIX/miniconda3/bin:$PATH" diff --git a/keras-to-hls/extract_roc.py b/keras-to-hls/extract_roc.py index d81bb2c14e..a1cc50c681 100644 --- a/keras-to-hls/extract_roc.py +++ b/keras-to-hls/extract_roc.py @@ -52,11 +52,14 @@ def extract_roc(yamlConfig,opts): ## Expected AUC from keras efpr, etpr, ethreshold = roc_curve(truth_df[:,i],predict_df[:,i]) eauc = auc(efpr, etpr) + print('Output %i: Keras auc = %.1f%%'%(i, eauc * 100)) plt.plot(etpr,efpr,label='Keras auc = %.1f%%'%(eauc * 100)) ## Expected AUC from HLS dfpr, dtpr, dthreshold = roc_curve(truth_df[:,i],output_df[:,i]) dauc = auc(dfpr, dtpr) + print('Output %i: HLS auc = %.1f%%'%(i, dauc * 100)) + print('Output {}: Ratio HLS/Keras = {:.2f}'.format(i, dauc / eauc)) plt.plot(dtpr,dfpr,label='HLS auc = %.1f%%'%(dauc * 100)) plt.plot([], [], ' ', label="Ratio HLS/Keras = {:.2f}".format(dauc / eauc)) @@ -64,6 +67,8 @@ def extract_roc(yamlConfig,opts): if opts.useFPGA!="": dfpr, dtpr, dthreshold = roc_curve(truth_df[:,i],fpga_output_df[:,i]) fauc = auc(dfpr, dtpr) + print('Output %i: FPGA auc = %.1f%%'%(i, fauc * 100)) + print('Output {}: Ratio FPGA/HLS = {:.2f}'.format(i, fauc / dauc)) plt.plot(dtpr,dfpr,label='FPGA auc = %.1f%%'%(fauc * 100)) plt.plot([], [], ' ', label="Ratio FPGA/HLS = {:.2f}".format(fauc / dauc))