This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data fmtmapping; | |
infile datalines delimiter=','; | |
input Column1 Column2 $; | |
datalines; | |
1,City | |
2,Country | |
3,Town | |
; | |
run; | |
data fmtdata; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%let p_path = /home/xxxxx/yyyyy/; | |
%macro print_to_log(f_name=); | |
proc printto log="&p_path.&f_name..log"; | |
run; | |
%mend print_to_log; | |
/* Comment the next line to disable logging */ | |
%print_to_log(f_name=logfile); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title "User-generated Macro Variables"; | |
proc sql; | |
select * | |
from sashelp.vmacro | |
where name like "PREFIX_%"; | |
quit; | |
title; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%let p_path = /home/xxxxx/yyyyy/; | |
%let cur_date = %sysfunc(today(), yymmddn8.); | |
%let cur_hh = %sysfunc(hour(%sysfunc(time()))); | |
%let cur_mm = %sysfunc(minute(%sysfunc(time()))); | |
%let d_name = &cur_date._&cur_hh._&cur_mm.; | |
%put NOTE: folder name = &d_name; | |
data _null_; | |
rc = dcreate("&d_name", "&p_path"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%let macro_var1 = ' '; | |
%let macro_var2 = ' '; | |
proc sql noprint; | |
select distinct quote(strip(column1), "'"), quote(strip(column2), "'") | |
into :macro_var1 separated by ',', :macro_var2 separated by ',' | |
from table; | |
quit; | |
%put macro_var1=¯o_var1; | |
%put macro_var2=¯o_var2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
REM Change the title of CMD window to script name | |
TITLE %~nx0 | |
SET year=%DATE:~10,4% | |
SET month=%DATE:~4,2% | |
SET day=%DATE:~7,2% | |
SET hour=%TIME:~0,2% | |
SET minute=%TIME:~3,2% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generator (G) | |
class ganGenerator(nn.Module): | |
""" | |
Generator function | |
:param int p_latent: The dimension of the latent space | |
""" | |
def __init__(self, p_latent: int = p_f): | |
super(ganGenerator, self).__init__() | |
self.fc1 = nn.Linear(in_features=p_latent, out_features=c * 2 * 7 * 7) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# VAE attack - input space | |
# objective function | |
li_delta = [] | |
def obj_attack(delta, x, x_target, C): | |
h_temp = encoder(x + delta)[:, :10] | |
f1 = torch.sum((decoder(h_temp) - x_target) **2) | |
f2 = C*torch.sqrt(torch.sum(delta ** 2)) | |
return f1 + f2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
X <- sim.es(mu=2, p=5, k=3, alpha=0.3, max.time=50, init.yhat=1, init.m=1.5) | |
ggplot(data=X) + geom_point(aes(t, y, colour='y')) + | |
geom_line(aes(t, m, colour='m')) + | |
geom_line(aes(t, yhat, colour='yhat'), size=1.5) + | |
xlab('Time (t)') + | |
ylab('Demand forecast') + | |
theme(legend.position='bottom') + | |
scale_color_manual(name='Legend', values=c('y'='darkblue', | |
'm'='black', | |
'yhat'='red')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sim.es <- function(mu, p, k, alpha, max.time, init.yhat, init.m) { | |
y <- demand.ts(mu, p, max.time) | |
e <- vector(mode="numeric", length=max.time) | |
yhat <- vector(mode="numeric", length=max.time) | |
m <- vector(mode="numeric", length=max.time) | |
R <- vector(mode="numeric", length=max.time) | |
yhat[1] <- init.yhat | |
m[1] <- init.m | |
NewerOlder