-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.sh
executable file
·129 lines (113 loc) · 6.58 KB
/
demo.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
echo "
#############################################################################################################################
Clear all numpy and plotly data? (y/n)
#############################################################################################################################"
read -p "Enter your choice: " choice
if [ "$choice" == "y" ]; then
chmod +x ./clean.sh
./clean.sh
else
echo "Skip cleaning."
fi
echo "#############################################################################################################################"
echo "# Demo script for Creation Portfolio #"
echo "#############################################################################################################################"
echo "In this demo, we will show some possible scenarios for optimizing the promoting post portfolio from simple to complex."
echo "We will show the result of the portfolio in the form of heatmap."
echo "#############################################################################################################################"
echo "# Demo Start #"
echo "#############################################################################################################################"
read -p "
Select demo scenario:
1. Scenario with plain objective function and budget + voice constraints
2. Scenario with regularized objective function and budget + voice constraints
3. Scenario with regularized objective function and budget + voice constraints + post constraints
4. Scenario with regularized objective function and budget + voice constraints + post constraints + KOL constraints
5. Scenario same as 4 but with unsatisfied constraints that need to adjust the weights.
Enter your choice: " scenario
echo
echo "#############################################################################################################################"
echo "# Change mode for execute scripts #"
echo "#############################################################################################################################"
chmod +x execute_scripts/*.sh
echo
if [ "$scenario" == 1 ]; then
echo "Demo 1: Scenario with plain objective function and budget + voice constraints"
echo
echo "In this demo, we will show the result of the portfolio with plain objective function and budget + voice constraints."
echo "The portfolio will be optimized with the following parameters:"
echo " - Number of KOLs choosed: 20"
echo " - Obj function: plain"
echo " - Budget: 700"
echo " - Voice: 8000"
echo " - Post constraints: 0 0 0 0"
echo " - KOL constraints: None"
echo " - Weights: 0.167 0.833"
echo " - Candidate: 100"
echo "The result will be saved in the file: all_20_plain.npy"
## echo "The heatmap will be saved in the file: heatmap_10_plain.png"
execute_scripts/execute_1.sh
elif [ "$scenario" == 2 ]; then
echo "Demo 2: Scenario with regularized objective function (Ridge) and budget + voice constraints"
echo "In this demo, we will show the result of the portfolio with regularized objective function (Ridge) and budget + voice constraints."
echo "The portfolio will be optimized with the following parameters:"
echo " - Number of KOLs choosed: 20"
echo " - Obj function: L2 (Ridge)"
echo " - Budget: 700"
echo " - Voice: 8000"
echo " - Post constraints: 0 0 0 0"
echo " - KOL constraints: None"
echo " - Weights: 0.167 0.833"
echo " - Candidate: 100"
echo "The result will be saved in the file: all_20_l2.npy"
## echo "The heatmap will be saved in the file: heatmap_10_reg.png"
execute_scripts/execute_2.sh
elif [ "$scenario" == 3 ]; then
echo "Demo 3: Scenario with plain objective function and budget + voice constraints + post constraints"
echo "In this demo, we will show the result of the portfolio with plain objective function and budget + voice constraints + post constraints."
echo "The portfolio will be optimized with the following parameters:"
echo " - Number of KOLs choosed: 20"
echo " - Obj function: plain"
echo " - Budget: 700"
echo " - Voice: 8000"
echo " - Post constraints: 5 7 5 7"
echo " - KOL constraints: None"
echo " - Weights: 0.167 0.833"
echo " - Candidate: 100"
echo "The result will be saved in the file: all_20_plain.npy"
## echo "The heatmap will be saved in the file: heatmap_10_reg_post.png"
execute_scripts/execute_3.sh
elif [ "$scenario" == 4 ]; then
echo "Demo 4: Scenario with regularized objective function (Ridge) and budget + voice constraints + post constraints + KOL constraints"
echo "In this demo, we will show the result of the portfolio with regularized objective function (Ridge) and budget + voice constraints + post constraints + KOL constraints."
echo "The portfolio will be optimized with the following parameters:"
echo " - Number of KOLs choosed: 20"
echo " - Obj function: L2 (Ridge)"
echo " - Budget: 700"
echo " - Voice: 6000"
echo " - Post constraints: 5 7 5 7"
echo " - KOL constraints: 1 2 7 8 9"
echo " - Weights: 0.167 0.833"
echo " - Candidate: 100"
echo "The result will be saved in the file: all_20_plain.npy"
## echo "The heatmap will be saved in the file: heatmap_10_reg_post_kol.png"
execute_scripts/execute_4.sh
elif [ "$scenario" == 5 ]; then
echo "Demo 5: Scenario same as 4 but with unsatisfied constraints that need to adjust the weights. In this case, we increase the budget from 6000 to 8000."
echo "In this demo, we will show the result of the portfolio with regularized objective function (Ridge) and budget + voice constraints + post constraints + KOL constraints."
echo "The portfolio will be optimized with the following parameters:"
echo " - Number of posts: 20"
echo " - Obj function: L2 (Ridge)"
echo " - Budget: 700"
echo " - Voice: 8000"
echo " - Post constraints: 5 7 5 7"
echo " - KOL constraints: 1 2 7 8 9"
echo " - Weights: 0.167 0.833"
echo " - Candidate: 100"
echo "The result will be saved in the file: all_20_plain.npy"
## echo "The heatmap will be saved in the file: heatmap_10_reg_post_kol.png"
execute_scripts/execute_5.sh
else
echo "Invalid input. Please try again."
fi