Skip to content

Commit

Permalink
working challenge with python and R
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas HOMBERG committed Jul 25, 2024
1 parent bfb0227 commit f1d0479
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 19 deletions.
73 changes: 66 additions & 7 deletions docker/codabench_hadaca3_pyr/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Python requirements
# FROM debian:11.0
FROM mambaorg/micromamba:1.5.8

# WORKDIR /app
Expand All @@ -12,17 +10,78 @@ RUN micromamba env create -f environment-r.yml && micromamba clean --all --yes

SHELL ["micromamba", "run", "-n", "h3", "/bin/bash", "-c"]

# RUN echo 'source /opt/conda/etc/profile.d/conda.sh && micromamba activate h3' >> ~/.bashrc
RUN echo 'micromamba activate h3' >> ~/.bashrc



ENV PATH /opt/conda/bin:$PATH
ENV R_LIBS=/usr/local/lib/R/site-library


ENTRYPOINT ["micromamba", "run", "-n", "h3"]

USER root
RUN apt-get update && apt-get install -y --fix-missing r-base
RUN apt-get update && apt-get upgrade -y && apt-get install -y gzip
# USER 1001



# # Python requirements
# FROM debian:11.0

# RUN apt update --fix-missing

# # # Install anaconda
# # RUN apt-get update --fix-missing && apt-get install -y wget bzip2 ca-certificates \
# # libglib2.0-0 libxext6 libsm6 libxrender1 \
# # git mercurial subversion
# # RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && \
# # wget --quiet https://repo.continuum.io/archive/Anaconda3-2022.05-Linux-x86_64.sh && \
# # /bin/bash /Anaconda3-2022.05-Linux-x86_64.sh -b -p /opt/conda && \
# # rm /Anaconda3-2022.05-Linux-x86_64.sh

# # RUN apt-get install -y curl grep sed dpkg tini

# ENV PATH /opt/conda/bin:$PATH
# ENV R_LIBS=/usr/local/lib/R/site-library

# # C#, R, etc. requirements
# RUN apt-get update && apt-get install -y --fix-missing r-base
# #mono-runtime libgomp1 libc6

# # Fix for 'xgboost' missing
# # RUN conda install libgcc
# #RUN conda install -c conda-forge tensorflow

# # RUN echo "deb http://http.us.debian.org/debian/ testing non-free contrib main" > /etc/apt/sources.list && \
# # apt-get update
# # apt-get -y -t testing install python3.9 python3-pip

# RUN apt-get install gzip
# RUN apt-get -y install pandoc && apt-get clean && apt-get auto-clean && apt-get -y auto-remove

# # RUN pip3 install \
# # theano==1.0.5 \
# # Cython==0.29.30 \
# # numpy==1.22.4 \
# # scipy==1.8.1 \
# # scikit-learn==1.1.1 \
# # pandas==1.4.2 \
# # pyyaml==6.0 \
# # imutils==0.5.4 \
# # numba==0.55.2 \
# # tensorflow==2.9.1


# RUN Rscript -e 'install.packages(pkgs = "BiocManager")'

# RUN Rscript -e 'BiocManager::install(pkgs = "Biobase")'
# RUN Rscript -e 'install.packages(pkgs = "zip")'
# RUN Rscript -e 'install.packages(pkgs=c("utf8", "farver", "labeling", "munsell", "R6", "viridisLite", "fansi", "pillar", "pkgconfig", "cli", "glue", "lifecycle", "magrittr", "rlang", "stringi", "vctrs", "iterators", "gtable", "isoband", "scales", "tibble", "withr", "plyr", "Rcpp", "registry", "rngtools", "stringr", "digest", "gridBase", "colorspace", "RColorBrewer", "foreach", "doParallel", "ggplot2", "reshape2"))'
# RUN Rscript -e 'install.packages(pkgs=c("fs", "rappdirs", "base64enc", "cachem", "fastmap", "memoise", "mime", "sass", "highr", "bslib", "evaluate", "fontawesome", "htmltools", "jquerylib", "jsonlite", "knitr", "tinytex", "xfun", "yaml"))'
# RUN Rscript -e 'install.packages(pkgs=c( "combinat", "rmarkdown", "clue","infotheo"))'

# RUN Rscript -e 'install.packages(pkgs = "NMF", repos = "https://cloud.r-project.org")'

# RUN Rscript -e 'install.packages(pkgs=c( "bitops", "caTools", "gplots","viridis"))'

# COPY environment/requirements.txt .

# RUN pip3 install --no-cache-dir -r requirements.txt
21 changes: 15 additions & 6 deletions docker/codabench_hadaca3_pyr/environment/environment-r.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: h3
channels:
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- _r-mutex=1.0.0=anacondar_1
- _sysroot_linux-64_curr_repodata_hack=3=haa98f57_10
- binutils_impl_linux-64=2.38=h2a08ee3_1
Expand Down Expand Up @@ -44,11 +45,11 @@ dependencies:
- libev=4.33=h7f8727e_1
- libffi=3.4.4=h6a678d5_1
- libgcc-devel_linux-64=11.2.0=h1234567_1
- libgcc-ng=11.2.0=h1234567_1
- libgcc-ng=14.1.0=h77fa898_0
- libgfortran-ng=11.2.0=h00389a5_1
- libgfortran5=11.2.0=h1234567_1
- libglib=2.78.4=hdc74915_0
- libgomp=11.2.0=h1234567_1
- libgomp=14.1.0=h77fa898_0
- libiconv=1.16=h5eee18b_3
- libnghttp2=1.57.0=h2d74bed_0
- libopenblas=0.3.21=h043d6bf_0
Expand All @@ -59,7 +60,7 @@ dependencies:
- libtiff=4.5.1=h6a678d5_0
- libuuid=1.41.5=h5eee18b_0
- libwebp-base=1.3.2=h5eee18b_0
- libxcb=1.15=h7f8727e_0
- libxcb=1.16=hd590300_0
- libxml2=2.10.4=hfdd30dd_2
- lz4-c=1.9.4=h6a678d5_1
- make=4.2.1=h1bed415_1
Expand All @@ -75,19 +76,21 @@ dependencies:
- pcre2=10.42=hebb0a14_1
- pip=24.0=py311h06a4308_0
- pixman=0.40.0=h7f8727e_1
- pthread-stubs=0.3=h0ce48e5_1
- pybind11-abi=4=hd3eb1b0_1
- pycparser=2.21=pyhd3eb1b0_0
- python=3.11.9=h955ad1f_0
- python-dateutil=2.9.0post0=py311h06a4308_2
- python-tzdata=2023.3=pyhd3eb1b0_0
- pytz=2024.1=py311h06a4308_0
- r-assertthat=0.2.1=r43h6115d3f_0
- r-base=4.3.1=h1ae530e_0
# - r-base=4.3.1=h1ae530e_0
- r-base64enc=0.1_3=r43h76d94ec_4
- r-biocmanager=1.30.22=r43h142f84f_0
- r-bitops=1.0_7=r43h76d94ec_0
- r-bslib=0.5.1=r43h6115d3f_0
- r-cachem=1.0.8=r43h76d94ec_0
- r-cairo=1.6_1=r43hec52ca5_0
- r-catools=1.18.2=r43h884c59f_0
- r-cli=3.6.1=r43h884c59f_0
- r-clue=0.3_65=r43h76d94ec_0
Expand Down Expand Up @@ -173,6 +176,12 @@ dependencies:
- tzdata=2024a=h04d1e81_0
- tzlocal=5.2=py311h06a4308_0
- wheel=0.43.0=py311h06a4308_0
- xorg-kbproto=1.0.7=h7f98852_1002
- xorg-libx11=1.8.9=hb711507_1
- xorg-libxau=1.0.11=hd590300_0
- xorg-libxdmcp=1.1.3=h7f98852_0
- xorg-xextproto=7.3.0=h0b41bf4_1003
- xorg-xproto=7.0.31=h27cfd23_1007
- xz=5.4.6=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- zstd=1.5.5=hc292b87_2
Expand Down
19 changes: 13 additions & 6 deletions scoring_program/detailed_results.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ output:
toc_depth: 5
---



```{r label = "header", echo = FALSE, eval = TRUE}
knitr::opts_chunk$set(collapse = TRUE, comment = "", echo = FALSE)
Expand All @@ -21,10 +23,12 @@ remove(list = "package")
library(package = "ggplot2")
```


```{r}
#read output from prediction
prediction = readRDS("../input/res/prediction.rds")
ground_truth = readRDS("../input/ref/ground_truth.rds")
nb_datasets<- 4
all_prediction <- readRDS("../input/res/prediction.rds")
ground_truth <- readRDS("../input/ref/ground_truth.rds")
```
## Summary of the prediction
Expand All @@ -34,15 +38,18 @@ ground_truth = readRDS("../input/ref/ground_truth.rds")
### Heatmap of the absolute error

```{r}
colors=viridis::viridis(5)
colors = viridis::viridis(5)
cols = colorRampPalette(colors)(50)
dim(prediction)
#image(as.matrix(pred), axes=FALSE, col = cols , ylab = colnames(pred), xlab = rownames(pred))
for (dataset_name in 1:nb_datasets){
prediction <- all_prediction[[dataset_name]]
print(dim(prediction) )
print(paste0("generating prediction for dataset:",toString(dataset_name) ))
Aerr <- data.frame(
abserror = as.numeric(
Expand Down Expand Up @@ -100,7 +107,7 @@ dim(prediction)
}
print(x = p)
}
```
Expand Down
8 changes: 8 additions & 0 deletions scoring_program/scoring.R
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,14 @@ for (dataset_name in 1:nb_datasets){
# cat(paste0("Time: ", profiling["elapsed"], "\n"), file = output_file, append = TRUE )
cat(paste0("Time: ", profiling, "\n"), file = output_file, append = TRUE )

rmarkdown::render(
input = paste0(program, .Platform$file.sep, "detailed_results.Rmd")
, envir = parent.frame( )
, output_dir = output
# , output_file = "scores.html"
, output_file = "detailed_results.html"
)

print(x = "Output :")
print(x = list.files(path = output , all.files = TRUE, full.names = TRUE, recursive = TRUE) )
print(x = "")

0 comments on commit f1d0479

Please sign in to comment.