Git Product home page Git Product logo

Comments (6)

opennca avatar opennca commented on June 9, 2024

I am not able to recreate this issue as of the latest commit, down below is what I executed after getting the files from the OneDrive:

> data_tc71 <- read.csv(file = "B3461056.in.csv")
> map_tc71 <- read.csv(file = "tc071_mct_updated.csv", stringsAsFactors = FALSE)
> flag_tc71 <- read.csv(file = "B3461056_flag_data.in.csv", stringsAsFactors = FALSE)
> res_tc71 <- openNCA::run_computation(data = data_tc71, map = map_tc71, flag = flag_tc71, parameterset = "PARAMETERLIST")
unit_conversion : Unit Class 1 (Time) time_col:  TMAX1 TMIN1 TLAST TLAG KELTMLO KELTMHI THALF LASTTIME MRTEVIFO1 MRTEVIFP1 TAU1  parameters are scaled from  1  to  HR  via scaling factor:  1 
unit_conversion : Unit Class 3 (Dose) dose_col:  DOSE1  parameters are scaled from  1  to  MG  via scaling factor:  1 
unit_conversion : Unit Class 4 (Volume) volume_col:  VZFTAU1  parameters are scaled from  ML  to  L  via scaling factor:  0.001 
unit_conversion : Unit Class 5 (Amount/Volume) conc_col:  CMAX1 CMIN1 CLAST1 CTROUGH1 CTROUGHEND1 CAV1  parameters are scaled from  NG/ML  to  NG/ML  via scaling factor:  1 
unit_conversion : Unit Class 6 (1/Time) kel_col:  KEL  parameters are scaled from  1/HR  to  1/HR  via scaling factor:  1 
unit_conversion : Unit Class 7 (Volume/Time) cl_col:  CLFTAU1  parameters are scaled from  ML/HR  to  L/HR  via scaling factor:  0.001 
unit_conversion : Unit Class 8: (Amount.Time/Volume) auc_col:  AUCALL AUCLAST AUCLAST1 AUCLASTC1 AUC1 AUC2 AUC3 AUC4 AUC5 AUC6 AUC7 AUC8 AUC9 AUC0_12 AUC0_26 AUC0_24 AUCINFO AUCINFOC AUCINFP AUCINFPC AUCTAU1  parameters are scaled from  NG.HR/ML  to  NG.HR/ML  via scaling factor:  1 
unit_conversion : Unit Class 9: (Amount.Time.Time/Volume) aumc_col:  AUMCTAU1  parameters are scaled from  NG.HR.HR/ML  to  NG.HR.HR/ML  via scaling factor:  1 
unit_conversion : Unit Class 12: ([Amount/Volume]/Amount) concdn_col:  CMAXDN1  parameters are scaled from  NG/ML/MG  to  NG/ML/MG  via scaling factor:  1 
Warning messages:
1: In unit_conversion(data = data_data, map = map_data, result = computation_df,  :
  'AMOUNTU' #2# is not present in the dataset provided via 'map'
2: In unit_conversion(data = data_data, map = map_data, result = computation_df,  :
  'CONCU' and 'DOSEU' values provided via 'map' is not present in the dataset provided via 'data'
3: In unit_conversion(data = data_data, map = map_data, result = computation_df,  :
  'PKPTMU' and 'CONCU' #10# are not present in the dataset provided via 'map'
4: In unit_conversion(data = data_data, map = map_data, result = computation_df,  :
  'CONCU' and 'NORMBSU' value provided via 'map' #13# are not present in the dataset provided via 'data'
5: In unit_conversion(data = data_data, map = map_data, result = computation_df,  :
  'CONCU', 'PKPTMU and 'NORMBSU' #19# are not present in the dataset provided via 'map'
> test <- res_tc71$data_out[,c("SDEID", "AUCLAST", "AUC0_24")]
> test$AUCLAST == test$AUC0_24
 [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
[44] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
> all(test$AUCLAST == test$AUC0_24)
[1] TRUE

from opennca.

tensfeldt avatar tensfeldt commented on June 9, 2024

I've compared the mct between the local version and the one on sharepoint. The only difference is the presence of mct$FLGEMESIS=="FLGEMESIS" in the local version. I've updated the version on Sharepoint. Please retest with that. I still get the same issue locally. Remains open.

from opennca.

jhhughes256 avatar jhhughes256 commented on June 9, 2024

Update

The output from this test for commit is provided below. This better than test output from the original comment.

> compare(y, x, tolerance=10^-16)
58/60 mismatches (average diff: 8.25)
[1] 158495 - 158495 == -4.95e-10
[2] 176507 - 176498 ==  9.34e+00
[3] 157744 - 157734 ==  9.83e+00
[4] 132723 - 132723 ==  3.78e-10
[5] 150481 - 150481 == -8.44e-10
[6] 132118 - 132138 == -1.97e+01
[7] 136703 - 136756 == -5.28e+01
[8] 137539 - 137539 == -4.37e-10
[9] 176346 - 176346 == -6.98e-10
...
> x <- r$AUCLAST
> y <- results_list$ref$AUCLAST[k]
> compare(y, x, tolerance=10^-16)
58/60 mismatches (average diff: 24.5)
[1] 158495 - 158495 == -4.95e-10
[2] 176507 - 176498 ==  9.34e+00
[3] 157833 - 157734 ==  9.82e+01
[4] 132723 - 132723 ==  3.78e-10
[5] 150481 - 150481 == -8.44e-10
[6] 132118 - 132138 == -1.97e+01
[7] 136703 - 136756 == -5.28e+01
[8] 137539 - 137539 == -4.37e-10
[9] 176346 - 176346 == -6.98e-10
...

To replicate this test I have provided the code I use to read this in.

### Load Libraries
library(readr)
library(jsonlite)
library(testthat)

### Load specific code-base for OpenNCA
pkgload::load_all(path = "codebase/openNCA-5a9f91aa0d/openNCA")  # 12/20

### Clean environment
rm(params, conc, vlist, results, results_list, r, e, mct, d, flags, p, klist, n, 
  ninc, nexc, k, rlist, dlist, nlist, slist, df, xmin, xmax, dk, flag_data, 
  est_data, outputdir)

profileid <- "SDEID"
args = commandArgs(trailingOnly=TRUE)
params = c()

### Create params file
# tc071 M1 SS
# p <- "C:/Users/tensfeldt/Box Sync/EQuIP Computation Engine/Rudraya_executed_test_cases/tc071"
testcase.id <- "tc071"
p <- "testcase/tc071_M1SS"
params["INPUT1"] = file.path(p, "B3461056.in.csv")
params["parameterset"] ="PARAMETERLIST"
params["map"] = file.path(p, "tc071_mct_updated.csv")
params["flags"] = file.path(p, "B3461056_flag_data.in.csv")
params["OUTPUT"] ="."
print(params)

mct <- read_csv(params["map"])
write_file(toJSON(mct, na="string"), path=file.path(p, "tc071_mct_updated.json"))
params["map"] = file.path(p, "tc071_mct_updated.json")

flags <- read_csv(params["flags"])
write_file(toJSON(flags, na="string"), path=file.path(p, "tc071_flags.json"))
params["flags"] = file.path(p, "tc071_flags.json")

### This is the part where I define the path of the reference values
params["REFERENCERESULTS"] = file.path(p, "B3461056_pp_calc.xml.csv")

### Read in concentration data
# Read conc
conc <- read.csv(file=params["INPUT1"], header=TRUE, sep=",", as.is=TRUE)
vlist <- c("PKDATAROWID", "PKPTMS", "PKCNCN", "PERIOD", "TREATXT")

# Read mct
mct <- params["map"]
mct <- fromJSON(mct)

# Read flags
flags <- params["flags"]
flags <- fromJSON(flags)

# ParameterSet
if(is.na(params["parameterset"])) { params["parameterset"] <- "PARAMETERDISPLAYLIST" }
parameterset <- params["parameterset"]

# FLAGS is a subset for the specific profile, subset concentration dataframe 
#  to those records by PKDATAROWID
d <- conc[is.element(conc$PKDATAROWID, flags$PKDATAROWID),]

if (p == "testcase/tc110_B2901001_M3SS_AN13354") {
  d <- d[,-match(c("TAU2", "TOLD2"), names(d))]
}

# Add in missing required parameters for virtual compute call
klist <- c("KEL", "KELRSQ", "KELNOPT", "THALFF")
if(!is.element("PARAMETERDISPLAYLIST", names(mct))) { mct$PARAMETERDISPLAYLIST <- "" }
for(i in klist) {
  ###if(regexpr(i, mct$PARAMETERDISPLAYLIST, ignore.case=TRUE)==-1) { mct$PARAMETERDISPLAYLIST <- c(mct$PARAMETERDISPLAYLIST, i) }
  if(regexpr(i, mct$PARAMETERDISPLAYLIST, ignore.case=TRUE)==-1) { mct$PARAMETERDISPLAYLIST <- paste(mct$PARAMETERDISPLAYLIST, i, sep=";") }
}

# Remove any leading semi-colons ";"
mct$PARAMETERDISPLAYLIST <- gsub("^;*", "", mct$PARAMETERDISPLAYLIST, ignore.case=TRUE, perl=TRUE)

# For virtual compute call only: Subset the parameters to be calculated to those in parameterdisplaylist
if(!is.element("PARAMETERLIST", names(mct))) { mct$PARAMETERLIST <- "" }

# Check whether TIME selection has been set in MCT - default to NOMINAL
if(!is.element("TIME", names(mct))) { mct$TIME <- "NOMINAL" }

# Determine whether there are any points selected for inclusion in the terminal elimination phase via 
#  FLGEXKEL (0=not excluded/included; 1=excluded/not included)
#  ***What happens if there are no flags provided?***
n <- factor(flags$FLGEXKEL, levels=c(0,1))
ninc <- length(n[n==0])
nexc <- length(n[n==1])

### Run computation
# pretime <- Sys.time()
results_list <- run_computation(data = d, map = mct, flag = flags, 
  parameterset = parameterset)
# Sys.time() - pretime

### Save results to objects
r <- results_list$data_out
e <- results_list$est_data
f <- results_list$flag_data

### This is where I read the reference values in using the path from params
results_list$ref <- read.csv(file=params["REFERENCERESULTS"],
  header=TRUE, sep=",", as.is=TRUE)

### Review reference results
k <- match(r$SDEID, results_list$ref$SDEID)
x <- r$AUC0_24
y <- results_list$ref$AUC0..24[k]
compare(y, x, tolerance=10^-16)
x <- r$AUCLAST
y <- results_list$ref$AUCLAST[k]
compare(y, x, tolerance=10^-16)

from opennca.

jhhughes256 avatar jhhughes256 commented on June 9, 2024

The following results are from commit a1fb2f9. There appears to be little change in mismatches since 5a9f91a.

> compare(y, x, tolerance=10^-16)
58/60 mismatches (average diff: 8.25)
[1] 158495 - 158495 == -4.95e-10
[2] 176507 - 176498 ==  9.34e+00
[3] 157744 - 157734 ==  9.83e+00
[4] 132723 - 132723 ==  3.78e-10
[5] 150481 - 150481 == -8.44e-10
[6] 132118 - 132138 == -1.97e+01
[7] 136703 - 136756 == -5.28e+01
[8] 137539 - 137539 == -4.37e-10
[9] 176346 - 176346 == -6.98e-10
...> x <- r$AUCLAST
> y <- results_list$ref$AUCLAST[k]
> compare(y, x, tolerance=10^-16)
58/60 mismatches (average diff: 24.5)
[1] 158495 - 158495 == -4.95e-10
[2] 176507 - 176498 ==  9.34e+00
[3] 157833 - 157734 ==  9.82e+01
[4] 132723 - 132723 ==  3.78e-10
[5] 150481 - 150481 == -8.44e-10
[6] 132118 - 132138 == -1.97e+01
[7] 136703 - 136756 == -5.28e+01
[8] 137539 - 137539 == -4.37e-10
[9] 176346 - 176346 == -6.98e-10

from opennca.

opennca avatar opennca commented on June 9, 2024

Just to keep everyone updated, we noticed the same difference when comparing to reference results mentioned above. But this difference is close to none when compared to the reference results that were provided from our side earlier today, please let me know your thoughts (if this is sufficient to close this issue):

> compare(test_auc$AUC9, test_auc$AUC0_24, tolerance=10^-16)
60/60 mismatches (average diff: 2.36e-05)
[1] 158495 - 158495 == -1.34e-05
[2] 176498 - 176498 ==  3.64e-06
[3] 157734 - 157734 == -1.93e-05
[4] 132723 - 132723 ==  1.17e-05
[5] 150481 - 150481 ==  1.15e-05
[6] 132138 - 132138 ==  1.08e-05
[7] 136756 - 136756 ==  9.63e-06
[8] 137539 - 137539 == -3.46e-05
[9] 176346 - 176346 ==  1.75e-05
> compare(test_auclast$AUClast, test_auclast$AUCLAST, tolerance=10^-16)
60/60 mismatches (average diff: 2.36e-05)
[1] 158495 - 158495 == -1.34e-05
[2] 176498 - 176498 ==  3.64e-06
[3] 157734 - 157734 == -1.93e-05
[4] 132723 - 132723 ==  1.17e-05
[5] 150481 - 150481 ==  1.15e-05
[6] 132138 - 132138 ==  1.08e-05
[7] 136756 - 136756 ==  9.63e-06
[8] 137539 - 137539 == -3.46e-05
[9] 176346 - 176346 ==  1.75e-05

from opennca.

tensfeldt avatar tensfeldt commented on June 9, 2024

Re-executed with commit 4097880 and inspected the differences carefully on a percentage basis. For AUC0-24 they range from -0.051650 to 0.038594 % and for AUCLAST range from -0.159013 to 0.038594 % which is an acceptable deviation. This issue can be closed.

from opennca.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.