-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathml_security_zoo.sh
executable file
·81 lines (66 loc) · 2.33 KB
/
ml_security_zoo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# parse and validate arguments
PHASE=$1
DSOURCE=$2
FDATE=$3
YR=${FDATE:0:4}
MH=${FDATE:4:2}
DY=${FDATE:6:2}
INPUT_TYPE=$4
if [[ -z "${PHASE}" || -z "${DSOURCE}" || "${#FDATE}" != "8" ]]; then
echo "ml_security.sh syntax error"
echo "Please run ml_security.sh again with the correct syntax:"
echo "./ml_security.sh PHASE TYPE YYYYMMDD"
echo "for example:"
echo "./ml_security.sh train flow 20160122"
echo "./ml_security.sh test flow 20160122"
exit
fi
# read in variables (except for date) from etc/.conf file
# note: FDATE and DSOURCE *must* be defined prior sourcing this conf file
source ./ml.conf
# pass the user domain designation if not empty
if [ ! -z $USER_DOMAIN ] ; then
USER_DOMAIN_CMD="--userdomain $USER_DOMAIN"
else
USER_DOMAIN_CMD=''
fi
FEEDBACK_PATH=${HPATH}/feedback/ml_feedback.csv
if [ "$PHASE" == "train" ]; then
RAWDATA_PATH=${TESTING_PATH}
HDFS_SCORED_CONNECTS=${TRAINING_PATH}
else
RAWDATA_PATH=${TESTING_PATH}
HDFS_SCORED_CONNECTS=${HPATH}/scores
fi
CONTAMINATION=0.05
NUMBER_OUTLIERS=100
ANALYTICS_ZOO_ROOT=./dependencies
ANALYTICS_ZOO_HOME=${ANALYTICS_ZOO_ROOT}/zoo
ANALYTICS_ZOO_PY_ZIP=${ANALYTICS_ZOO_HOME}/lib/analytics-zoo-bigdl_0.6.0-spark_2.2.0-0.2.0-python-api.zip
ANALYTICS_ZOO_JAR=${ANALYTICS_ZOO_HOME}/lib/analytics-zoo-bigdl_0.6.0-spark_2.2.0-0.2.0-jar-with-dependencies.jar
ANALYTICS_ZOO_CONF=${ANALYTICS_ZOO_HOME}/conf/spark-analytics-zoo.conf
PYTHONPATH=${ANALYTICS_ZOO_PY_ZIP}:$PYTHONPATH
VENV_HOME=${ANALYTICS_ZOO_HOME}/bin
time spark2-submit \
--conf spark.yarn.appMasterEnv.PYSPARK_PYTHON=./venv.zip/venv/bin/python \
--conf spark.yarn.maxAppAttempts=1 \
--master yarn \
--deploy-mode cluster\
--executor-memory 10g \
--driver-memory 10g \
--executor-cores 2 \
--num-executors 8 \
--properties-file ${ANALYTICS_ZOO_CONF} \
--jars ${ANALYTICS_ZOO_JAR} \
--py-files ${ANALYTICS_ZOO_PY_ZIP},transformers_deep_learning.py \
--archives ${VENV_HOME}/venv.zip \
--conf spark.driver.extraClassPath=${ANALYTICS_ZOO_JAR} \
--conf spark.executor.extraClassPath=${ANALYTICS_ZOO_JAR} \
deep_learning_zoo.py \
--mode ${PHASE} \
--input ${RAWDATA_PATH} \
--output ${HDFS_SCORED_CONNECTS} \
--network ${TRAINING_PATH} \
--contamination ${CONTAMINATION} \
--number_outliers ${NUMBER_OUTLIERS} \