Regenerate R parity cache for NNS 13.1 #10
Workflow file for this run
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
| name: PR118 live R internal diagnostics | |
| on: | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| diagnose: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: release | |
| use-public-rspm: true | |
| - run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgsl-dev libjpeg-dev libpng-dev libtiff5-dev libfreetype6-dev libharfbuzz-dev libfribidi-dev xorg-dev | |
| curl -fL https://raw.githubusercontent.com/OVVO-Financial/NNS/1d4d1e9ccc872ccc25eacfc7153a5ff8c4abd172/NNS_13.1.tar.gz -o /tmp/NNS_13.1.tar.gz | |
| mkdir -p /tmp/nns && tar -xzf /tmp/NNS_13.1.tar.gz -C /tmp/nns --strip-components=1 | |
| Rscript -e "options(repos=c(CRAN='https://cloud.r-project.org')); install.packages(c('remotes','jsonlite')); remotes::install_deps('/tmp/nns', dependencies=NA, upgrade='never')" | |
| R CMD INSTALL /tmp/NNS_13.1.tar.gz | |
| python -m pip install -U pip | |
| python -m pip install build scikit-build-core nanobind pytest 'numpy<2.5' scipy hypothesis pytest-benchmark pytest-xdist | |
| python -m pip install -e . --force-reinstall --no-deps | |
| - name: Compare unresolved internals | |
| continue-on-error: true | |
| run: | | |
| Rscript - <<'RS' > live-r-debug.txt 2>&1 | |
| library(NNS) | |
| a <- c(1,2,3,4,5); b <- c(1,2,1,4,3); cc <- c(2,1,3,5,4) | |
| cat('R copula3 continuous',NNS.copula(cbind(a,b,cc),continuous=TRUE,plot=FALSE),'\n') | |
| cat('R copula3 discrete',NNS.copula(cbind(a,b,cc),continuous=FALSE,plot=FALSE),'\n') | |
| dx <- cbind(c(-2,-1,0,1,2),c(1,3,5,7,9)); dy <- dx[,1]^2 + sin(dx[,2]) | |
| cat('R dy1 first',dy.d_(dx,dy,wrt=1,eval.points='mean',messages=FALSE)$First,'\n') | |
| cat('R dy1 second',dy.d_(dx,dy,wrt=1,eval.points='mean',messages=FALSE)$Second,'\n') | |
| cat('R dy2 first',dy.d_(dx,dy,wrt=2,eval.points='mean',messages=FALSE)$First,'\n') | |
| cat('R dy2 second',dy.d_(dx,dy,wrt=2,eval.points='mean',messages=FALSE)$Second,'\n') | |
| t <- 1:70; x <- sin(2*pi*t/7); y <- c(tail(x,1),head(x,-1)) + .05*cos(t/3); tau <- 7 | |
| make_tau <- function(v,tau){n<-length(v);z<-vector('list',tau+1);for(i in 0:tau)z[[i+1]]<-v[(tau-i+1):(n-i)];do.call(cbind,z)} | |
| xn <- unlist(NNS.norm(make_tau(x,tau))[,1]); yn <- unlist(NNS.norm(make_tau(y,tau))[,1]); xy <- NNS.norm(cbind(xn,yn)) | |
| cat('R xn head',head(xn,8),'\n'); cat('R yn head',head(yn,8),'\n'); cat('R xy head',as.numeric(head(xy,4)),'\n') | |
| cat('R Uni xy',NNS:::Uni.caus(x,y,tau,plot=FALSE),'\n'); cat('R Uni yx',NNS:::Uni.caus(y,x,tau,plot=FALSE),'\n'); cat('R caus',NNS.caus(x,y,tau='ts',plot=FALSE),'\n') | |
| RS | |
| python - <<'PY' >> live-r-debug.txt 2>&1 | |
| import numpy as np | |
| from nns import dy_d,nns_causation,nns_copula,nns_norm | |
| from nns.causation import _tau_normalized,_uni_caus | |
| a=np.array([1,2,3,4,5.]); b=np.array([1,2,1,4,3.]); c=np.array([2,1,3,5,4.]); a3=np.column_stack((a,b,c)) | |
| print('PY copula3 continuous',nns_copula(a3,continuous=True)); print('PY copula3 discrete',nns_copula(a3,continuous=False)) | |
| dx=np.column_stack((np.array([-2,-1,0,1,2.]),np.array([1,3,5,7,9.]))); dy=dx[:,0]**2+np.sin(dx[:,1]) | |
| print('PY dy1',dy_d(dx,dy,wrt=1,eval_points='mean')); print('PY dy2',dy_d(dx,dy,wrt=2,eval_points='mean')) | |
| t=np.arange(1,71,dtype=float); x=np.sin(2*np.pi*t/7); y=np.roll(x,1)+.05*np.cos(t/3) | |
| xn,yn=_tau_normalized(x,y,7); xy=nns_norm(np.column_stack((xn,yn))) | |
| print('PY xn head',xn[:8].tolist()); print('PY yn head',yn[:8].tolist()); print('PY xy head',xy[:4].ravel(order='F').tolist()) | |
| print('PY Uni xy',_uni_caus(x,y,7)); print('PY Uni yx',_uni_caus(y,x,7)); print('PY caus',list(nns_causation(x,y,tau='ts').values())) | |
| PY | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: pr118-live-r-debug | |
| path: live-r-debug.txt | |
| if-no-files-found: warn |