[Packages]
numpy==1.16.2
scikit-learn==0.20.2
pydotplus==2.0.2
dtreeviz==0.6
matplotlib==3.1.1
memory-profiler==0.55.0
pandas==0.24.1
seaborn==0.9.1
scipy==1.2.1
tensorflow==1.8.0
tensorboard==1.8.0
pickleshare==0.7.5

[Usage]
1. Training neural network
python twodomain_train.py '1' 'gradient_reversal(0~1)' 'dataset_dir_name' 'domain1' 'class1domain1' 'class2domain1' 'domain2' 'class1domain2' 'class2domain2'
gradient_reversal(0~1): parameter mu in gradient reversal layers
dataset_dir_name: directory containing normalized feature (speed) files
domain1: name of the 1st domain
class1domain1: name of the 1st class of the 1st domain (dir name in dataset_dir_name)
class2domain1: name of the 2nd class of the 1st domain (dir name in dataset_dir_name)
domain2: name of the 2nd domain
class1domain2: name of the 1st class of the 2nd domain (dir name in dataset_dir_name)
class2domain2: name of the 2nd class of the 2nd domain (dir name in dataset_dir_name)

2. Outputting attention values
python get_attention.py 'model_filename' 'model_stepname' 'dataset_dir_name' 'class1_dir' 'class2_dir'
model_filename: session name (found in 'model' dir created in the 1st procedure)
model_stepname: epoch number used
dataset_dir_name: directory containing normalized feature (speed) files
class1_dir: name of the 1st class of a domain of interest
class2_dir: name of the 2nd class of a domain of interest

3. Training decision trees
python dicision_tree_check.py 'model_filename' 'layer_node' 'input_type' 'output_type' 'eval_model_type' 'tree_depth'
model_filename: session name
layer_node: specify 'attention-layer'
input_type, output_type: specify 'various_feature' and 'attention_speed_high' for a decision tree for detecting attended segments. specify 'various_feature_speed_ft_xmean' and 'normal_prob_classify' for a decision tree for classifying each trajectory. 
eval_model_type: specify 'classifier'
tree_depth: depth of tree

4. Generating graphs
python plot_highlight.py 'model_filename' 'data_type'
model_filename: session name
data_type: specify 'original' or folder name in normalized_dataset

python show_images.py 'model_filename' 'output_format' 'images_max'　'output_dir' 'image_dir'
model_filename: session name
output_format: 'svg' or 'png'
images_max: number images shown in generated HTML files
output_dir: name of output directory
image_dir: name of folder of highlighted images generated by the previous command (normally specify 'svg_output')

See also supplementary information about demo.

[Parameter setting]
The 30-40 lines in twodomain_train.py specify model parameters of the neural network. See also 'model_params.txt'. We recommend to find good parameters (giving high class accuracy and low domain accuracy) using grid search or optimizer.


