12-22-2023
Edoedoedo
Pyrite | Level 9
Member since
12-07-2013
- 125 Posts
- 18 Likes Given
- 3 Solutions
- 20 Likes Received
-
Latest posts by Edoedoedo
Subject Views Posted 1296 12-22-2023 06:13 AM 1003 09-27-2023 05:49 AM 1114 09-22-2023 05:04 AM 780 09-14-2023 08:58 AM 6089 01-13-2023 05:32 AM 6177 01-09-2023 07:47 AM 6355 12-27-2022 12:33 PM 6387 12-27-2022 08:43 AM 6399 12-27-2022 06:25 AM 6503 12-22-2022 12:10 PM -
Activity Feed for Edoedoedo
- Got a Like for Re: Reuse SASLogon user/pass authentication to get an oauth token for API. 02-21-2025 04:41 AM
- Got a Like for Re: Recove from error. 06-25-2024 04:51 PM
- Posted proc ssm and sarimax on SAS Forecasting and Econometrics. 12-22-2023 06:13 AM
- Got a Like for Action to list all tables in a given caslib (loaded tables, not files). 10-27-2023 08:14 AM
- Posted Re: Allow access only to a given group for a SASContent folder and deny to authenticated users on Administration and Deployment. 09-27-2023 05:49 AM
- Liked Re: Allow access only to a given group for a SASContent folder and deny to authenticated users for gwootton. 09-27-2023 05:47 AM
- Posted Allow access only to a given group for a SASContent folder and deny to authenticated users on Administration and Deployment. 09-22-2023 05:04 AM
- Posted Working with caslibs in different cas servers on SAS Viya. 09-14-2023 08:58 AM
- Got a Like for Re: uniTimeSeries.arima results are different (and worse) than statsmodels SARIMA. 01-13-2023 11:11 AM
- Posted Re: uniTimeSeries.arima results are different (and worse) than statsmodels SARIMA on SAS Forecasting and Econometrics. 01-13-2023 05:32 AM
- Liked Re: uniTimeSeries.arima results are different (and worse) than statsmodels SARIMA for TammyJackson. 01-09-2023 07:48 AM
- Posted Re: uniTimeSeries.arima results are different (and worse) than statsmodels SARIMA on SAS Forecasting and Econometrics. 01-09-2023 07:47 AM
- Posted Re: uniTimeSeries.arima results are different (and worse) than statsmodels SARIMA on SAS Forecasting and Econometrics. 12-27-2022 12:33 PM
- Posted Re: uniTimeSeries.arima results are different (and worse) than statsmodels SARIMA on SAS Forecasting and Econometrics. 12-27-2022 08:43 AM
- Posted Re: uniTimeSeries.arima results are different (and worse) than statsmodels SARIMA on SAS Forecasting and Econometrics. 12-27-2022 06:25 AM
- Posted uniTimeSeries.arima results are different (and worse) than statsmodels SARIMA on SAS Forecasting and Econometrics. 12-22-2022 12:10 PM
- Liked Re: SMAPE calculation in tsmodel/utlstat seems to give wrong result for SASCom1. 07-22-2021 03:19 AM
- Posted Re: SMAPE calculation in tsmodel/utlstat seems to give wrong result on SAS Forecasting and Econometrics. 07-12-2021 09:19 AM
- Posted SMAPE calculation in tsmodel/utlstat seems to give wrong result on SAS Forecasting and Econometrics. 07-09-2021 05:12 AM
- Posted Re: TSA STATIONARITYTEST gives null pvalue on SAS Forecasting and Econometrics. 06-17-2021 02:04 PM
-
Posts I Liked
Subject Likes Author Latest Post 1 4 2 1 1 -
My Liked Posts
Subject Likes Posted 1 01-09-2019 03:52 AM 1 05-07-2019 04:20 AM 1 01-13-2023 05:32 AM 1 06-25-2019 07:25 AM 1 04-26-2019 04:46 AM
01-16-2020
01:01 PM
I have a dataset which has GROUP | TIMESTAMP | VALUE.
GROUP can be 'A' or 'B'
TIMESTAMP is a timestamp
VALUE is a number
Note: the groups does not overlap in time. For instance, group 'A' has timestamps from jan18 to jun18, while group 'B' has timestamps from nov19 to dec19.
I want to plot with sgplot these two time series aside, in "the same row", one on the left one on the right. I tried with sgpanel, but since with sgpanel the time axis is in common it spans from jan18 to dic19, so there is a huge hole in the middle. Instead, I just need to have the first graph on the left with the series 'A' centered in jan18-jun18, and a second graph on the right with the series 'B' centered in nov19-dec19 (so larger, since the timespan is smaller), and with the Y axis "the value" in common.
How can I do that?
I hope I made myself clear.
Thanks
Regards
T
... View more
01-03-2020
06:54 AM
You can't, at least up to VA 8.5 (as far as I know). Every time you need to change the custom graph, reimport it in your report, and replace your object. There is something that can be done with BIRD to change the embedded code of the custom graph (it's just a string) but is way too complicate.
... View more
01-03-2020
06:20 AM
I'm looking at "layers" and "layersOut" but it's not working, the output is weird with columns like "_layeract_0_img_0_" which contain characters. It seems something related to images but my model has nothing to do with images. What's wrong? Any help?
EDIT: Even with the example I couldn't find a way to see all the layers values row by row: https://documentation.sas.com/?docsetId=casdlpg&docsetTarget=p024gf3bj0rmwcn1tfkyy68dzs4g.htm&docsetVersion=8.5&locale=en
Thank you very much
Regards
... View more
12-24-2019
07:18 AM
Thanks a lot!
Just as an exercise I'm trying to recreate the standard MLP Autoencoder. Here's what I did:
cas session sessopts=(caslib="CASUSER");
libname CASUSER cas caslib="CASUSER";
data CASUSER.TRAIN;
do id=1 to 10000;
x=id/10000; /* Fake relation */
y=x+2;
z=x*2-sqrt(x);
output;
end;
run;
data CASUSER.SCORE;
set CASUSER.TRAIN;
if id = 1 then z=z*10; /* anomaly */
if id > 10 then delete;
run;
proc cas;
deepLearn.buildModel /
modelTable={name="MODELTABLE" replace=true}
type="DNN";
run;
deepLearn.addLayer /
layer={type="INPUT" std="STD"}
modelTable={name="MODELTABLE"}
name="LInput";
run;
deepLearn.addLayer /
layer={type="FC" n=1}
modelTable={name="MODELTABLE"}
name="LHidden"
srcLayers="LInput";
run;
deepLearn.addLayer /
layer={type="OUTPUT"}
modelTable={name="MODELTABLE"}
name="LOutput"
srcLayers="LHidden";
run;
deepLearn.modelInfo /
modelTable={name="MODELTABLE"};
run;
deepLearn.dlTrain /
inputs={"x" "y" "z"}
modelTable={name="MODELTABLE"}
modelWeights={name="MODELWEIGHTS" replace=true}
table={name="TRAIN"}
optimizer={loglevel=1};
run;
quit;
proc cas;
deepLearn.dlScore /
initWeights={name="MODELWEIGHTS"}
modelTable={name="MODELTABLE"}
table={name="SCORE"}
casout={name="SCORED" replace=true}
copyvars={"id"};
run;
quit;
However I can't see the scored layers values to calculate the mse row by row. What am I doing wrong? Is this simple code correct?
Thanks!
... View more
12-18-2019
01:25 PM
Thanks, however nnet seems to support only the standard Autoencoder and not the LSTM form.
I believe the model should be created "by hand" layer per layer with the deepLearn action set, but I don't know how to implement it.
... View more
12-18-2019
05:40 AM
I need to implement a LSTM Autoencoder neural network in CAS. How can it be done?
https://towardsdatascience.com/step-by-step-understanding-lstm-autoencoder-layers-ffab055b6352
Thank you
... View more
09-24-2019
06:04 AM
You're right, thank you very much I didn't thing to run the linearExplainer one predictedTarget at time.
It works great!
Regards
... View more
09-22-2019
12:13 PM
I've successfully created an autoencoder model using the annTrain action.
Now I want to add explanation to a single prediction using SHAP method (as in https://arxiv.org/pdf/1903.02407.pdf).
I see that the linearExplainer action supports the SHAP method (https://documentation.sas.com/?docsetId=casactml&docsetTarget=casactml_linearexplainer_syntax.htm&docsetVersion=8.4&locale=en) but it requires a target variable.
Since the autoencoder model does not have a target variable (i.e. the input variables are the targets), what can I do?
Thanks
Regards
... View more
09-18-2019
02:52 PM
AFAIK, there is no way to massively update a CAS table "in place" (i.e. without dropping it and recreating it), as well as DELETE rows.
I understand CAS is for analytical, but I believe it lacks A LOT of database features.
I really hope that in the next releases the CAS will be more robust from this point of view, we had to rewrite tons of processes that worked correctly in LASR environment (which supports the UPDATE for instance) to implement workarounds for the things that cannot be made in CAS.
... View more
08-26-2019
05:44 AM
Hi,
I need to perform a DBSCAN clustering on a dataset loaded in CAS. As far as I read, there is no DBSCAN algorithm implemented neither in CAS nor in SAS 9.4. The only clustering method I found in CAS is the K-MEANS but that's inappropriate for my application since I'm working on anomaly detection.
Did I miss something? If DBSCAN is indeed not implemented anywhere in SAS/CAS, what would you recommend me to do? Develop it in CASL? Develop it in SAS Base? Develop it in Python with SWAT?
Thank you for any advice.
PS: the DBSCAN implementation should be with high performance, my dataset has a dozen features and some million rows; I tried the sklearn DBSCAN on my machine and it takes forever, I need to use CAS distributed environment I guess.
... View more
07-08-2019
03:11 AM
Yes the constraints are nonlinear, but they are "nice" (in the sense that they are almost always polynomials and in general continuous and derivable, that is why I expect this sense of continuity of the solutions over the grid).
I picked up these two instances:
1)
P=6, H=85.
With nlp: Q1=9.58, Q2=0.00, Q=9.58 (status=OPTIMAL).
With lso: Q1=5.30, Q2=7.60, Q=12.90 (status=MAXGEN).
2)
P=10, H=91.5.
With nlp: Q1=13.63, Q2=0.00, Q=13.63 (status=OPTIMAL).
With lso: Q1=7.26, Q2=9.52, Q=16.78 (status=ABSFCON).
I'll try to rerun it with the double solve command.
In the mean time I think I'll start to implement approach no.2, let's see if it's reliable.
Thanks again for all you suggestions!
Regards
... View more
07-06-2019
02:42 PM
Unfortunately the solution got worse...
Here's the result, and most of the points have status MAXGEN instead of ABSFCON.
... View more
07-05-2019
04:29 AM
Thanks, we are getting closer
About the first approach with lso. I tried to run the model without changing the constraints (so my original problem) to see what are the results comparing nlp with lso.
Let me explain the result: the variables the model finds are Q1 and Q2, for every P and H in a grid (as you can see in the code); then I calculate P1 and P2, and since P1+P2=P I calculate the ratio P1/P to get one number as result; in this way, when the ratio is 100% it means that P1=P and P2=0, when it is 0% it means that P1=0 and P2=P, otherwise 0 < P1,P2 < P.
In the following graph I display in the P,H grid, this ratio with color: yellow (ratio=100%) blue (ratio=0%) brownish (0 < ratio < 100).
Here's the solution with nlp:
Here's the solution with lso:
The solution with nlp makes a lot of sense (from the physical point of view of the thing I'm optimizing): when P is low, P1=P and P2=0; when P is medium, P1=0 and P2=P; when P is high, a combination of P1 and P2 is used. And you can see from the picture a sense of "continuity" in the grid. I know it may sound obscure but trust me this result is good!
Now the solution with lso seems a lot more noisy: the sense of "continuity" seems not to apply, and also the P low/medium/high is unclear. So before modify the constraint to fit the new problem of this thread, I'd like to get a more stable solution with lso, as "good" as the nlp one. Do you know if the lso can be configured to be more accurate? I read the doc and I saw a lot of parameters, I'm not sure about what to do to improve the results.
As for the second approach: yes I taught about this, and I believe it works fine. However for now I wrote the model with two "units" (you can see the reference to indexes "1" and "2" all over the code), but I'm sure I will be asked later to generalize it to work with N "units". So with N "units", I should have to solve 2^N-1 problems with all the combinations of P_i (zero or non zero) and then compare them, and it sounds hard...
As for the thirds approach, I haven't tried yet, but I think it will not be accurate at all since in this way the error on constraints won't have a metric to see how wrong it is, it would only get a flag "correct" "incorrect".
Thanks again,
Regards
... View more
07-04-2019
02:25 PM
Here is the whole model:
proc fcmp outlib=work.funcs.f;
function f1(Q, H);
return (
(7.18895803108255)+(Q)*(0.90898166129053)+(H)*(-0.52518338771685)+(Q**2)*(-0.07243939757267)+(Q)*(H)*(-0.0101157174044)+(H**2)*(0.01140027697845)+(Q**3)*(0.00271247731414)+(Q**2)*(H)*(0.00078575662965)+(Q)*(H**2)*(-8.0331130545237E-7)+(H**3)*(-0.00010011945215)+(Q**4)*(-0.00005707623607)+(Q**3)*(H)*(-0.0000145464761)+(Q**2)*(H**2)*(-4.0740624504878E-6)+(Q)*(H**3)*(5.6715539778245E-7)+(H**4)*(3.0399728809992E-7)+(Q**5)*(6.2706019750555E-7)+(Q**4)*(H)*(-4.9275589970883E-8)+(Q**3)*(H**2)*(1.1402170133176E-7)+(Q**2)*(H**3)*(-1.1450221400824E-8)
);
endsub;
function f2(Q, H);
return (
(9.56532591440209)+(Q)*(1.56477959347719)+(H)*(-0.58834848839521)+(Q**2)*(-0.14923333670627)+(Q)*(H)*(-0.02042582402532)+(H**2)*(0.01042030607175)+(Q**3)*(0.00551139580932)+(Q**2)*(H)*(0.00200710134061)+(Q)*(H**2)*(0.00006229314138)+(H**3)*(-0.00006493899805)+(Q**4)*(-0.00009774971067)+(Q**3)*(H)*(-0.00004756024059)+(Q**2)*(H**2)*(-0.00001062838926)+(Q)*(H**3)*(3.7950591182214E-7)+(Q**5)*(8.5938390272548E-7)+(Q**4)*(H)*(1.7658335207072E-7)+(Q**3)*(H**2)*(2.2050828738805E-7)+(H**5)*(8.7276517928309E-10)
);
endsub;
function g1(Q1,Q2); return ( 0.003134 * ((Q1+Q2)**2) + 0.003089 * (Q1**2) ); endsub;
function g2(Q1,Q2); return ( 0.003134 * ((Q1+Q2)**2) + 0.003089 * (Q2**2) ); endsub;
run;
%let Q1max = 30.4;
%let Q2max = 29.5;
%let P1min = 2.5;
%let P2min = 3.3;
%let P1max = 21.7;
%let P2max = 21.6;
%let PSETL = 1;
%let PSETR = 43;
%let HSETL = 70;
%let HSETR = 94;
%let STEP = 0.5;
options cmplib=work.funcs;
proc optmodel nthreads=64;
number P;
number H;
var Q1 >= 0 <= &Q1max;
var Q2 >= 0 <= &Q2max;
impvar HL1 = H - g1(Q1,Q2);
impvar HL2 = H - g2(Q1,Q2);
impvar P1 = Q1 * HL1 * f1(Q1, HL1) * 9.81 / 1000;
impvar P2 = Q2 * HL2 * f2(Q2, HL2) * 9.81 / 1000;
minimize Q = Q1 + Q2;
constraint P = P1 + P2;
constraint 0 <= P1 <= &P1max; /* (*) */
constraint 0 <= P2 <= &P2max; /* (*) */
set PSET = &PSETL .. &PSETR by &STEP;
set HSET = &HSETL .. &HSETR by &STEP;
num Qopt {PSET, HSET};
num Q1opt {PSET, HSET};
num Q2opt {PSET, HSET};
num P1opt {PSET, HSET};
num P2opt {PSET, HSET};
str solstatus {PSET, HSET};
num opterror {PSET, HSET};
do P = PSET;
do H = HSET;
solve with nlp / maxiter=10000 multistart=(maxstarts=10) seed=54321;
put P= H= HL1= HL2= P1= P2= Q1= Q2= _solution_status_=;
Qopt[P,H] = Q.sol;
Q1opt[P,H] = Q1.sol;
Q2opt[P,H] = Q2.sol;
P1opt[P,H] = P1;
P2opt[P,H] = P2;
solstatus[P,H] = _solution_status_;
opterror[P,H] = _OROPTMODEL_NUM_['OPTIMALITY_ERROR'];
end;
end;
create data Qdata from [P H] P1opt P2opt Q1opt Q2opt Qopt solstatus opterror;
quit;
Look at the rows marked with (*)
constraint 0 <= P1 <= &P1max; /* (*) */
constraint 0 <= P2 <= &P2max; /* (*) */
As you can see, P1 and P2 have 0 as lower bound, and it worked very well. Now I'm asked to restrict P1 and P2 interval from [0,PMAX] to [PMIN, PMAX], but zero must remain allowed, so the constraints should become
(P1 = 0) OR (&P1min <= P1 <= &P1max)
(P2 = 0) OR (&P2min <= P2 <= &P2max)
Hence this question. I hope I made myself clear now!
Thanks again,
Regards
... View more
07-04-2019
01:58 PM
Thanks! Unfortunately my problem is non linear, so the solver is nlp.
And using binary variables, it says:
ERROR: The NLP solver does not allow integer variables.
... View more