trevb11 / asd3-coding Goto Github PK
View Code? Open in Web Editor NEWCommentary on ASD3 Coding Related Project
Commentary on ASD3 Coding Related Project
> test.accuracies.list <- list()
> for (prediction in all.predictions.list){
+ count_ones <- sum(all.predictions.list[[prediction]] == 1)
+ predicted.rate <- count_ones / nrow(all.predictions.list[[prediction]])
+ test.accuracy <- predicted.rate / true.rate
+ test.accuracies.list[[prediction]] <- test.accuracy
+
+ }
Error in all.predictions.list[[prediction]] :
attempt to select less than one element in get1index <real>
Intended to fill test.accuracies.list with 6 test accuracy calculations to then make a datatable and plot.
In the main branch code of this repository, the very last for loop
input.columns <- subset.with.autism.cols %>%
select(-one_of(columns_to_exclude))
output.column <- one_hotted_data[["K2Q35A_1"]]
glm.model.list <- list()
for(test_fold in 1:n.folds){
folded_data <- OneFold(input.columns, n.folds, test_fold)
train.set <- folded_data[i = Set == "train"]
train.inputs <- train.set[,input.columns]
train.output <- train.set[,output.column]
my.model.for.fold.k <- cv.glmnet(as.matrix(train.inputs), train.output)
glm.model.list[[test_fold]] <- my.model.for.fold.k
}
is returning the error
Error in [.data.table
(train.set, , input.columns) :
j (the 2nd argument inside [...]) is a single symbol but column name 'input.columns' is not found. Perhaps you intended DT[, ..input.columns]. This difference to data.frame is deliberate and explained in FAQ 1.1.
I intended for it to generate the models and store them in glm.model.list for each test_fold.
I'm not sure what to try at this point.
@trevb11 For readability of code please make sure to follow my R general usage rubric https://docs.google.com/document/d/1W6-HdQLgHayOFXaQtscO5J5yf05G7E6KeXyiBJFcT7A/edit#heading=h.pekgvy78tviz
In particular please remove parts of your code which are not necessary for computing the final result. (un-used code is potentially confusing when re-reading code)
For reproducibility please run your R script with --vanilla to make sure it can run start to finish without any un-documented items in the environment.
shell$ R --vanilla < your_script.R
@tdhock I used type = "response" for the predictions and got something reasonable. Most values for class 0 are 0.98 or 0.99, with very sparse values for class 1 in contrast being 0.34, 0.41, or even 0.69. Here's 3 rows of the predictions result showing the 0.69 value for 1.
0 1
[339,] 0.9915761 0.008423913
[340,] 0.9143789 0.085621051
[341,] 0.3023492 0.697650754
What do I do now with these values to compute test accuracies?
Additionally, I am confused if I am getting the featureless predictions correctly with this code
most.frequent.class <- train.output[, .(count=.N), by = main.autism.output.column.name][order(-count)][[main.autism.output.column.name]][1]
featureless.list <- list()
for(fold in 1:n.folds){
featureless <- folded_data[i = Fold == fold]
output <- featureless[["K2Q35A_1"]]
featureless.list[[fold]] <- output
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.