Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmduarte committed Feb 3, 2019
1 parent 3c67158 commit b849b3f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
9 changes: 6 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions install_miniconda3.sh
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 5 additions & 0 deletions keras-to-hls/extract_roc.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,23 @@ 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))

## Expected AUC from FPGA run
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))

Expand Down

0 comments on commit b849b3f

Please sign in to comment.