Git Product home page Git Product logo

asd3-coding's People

Contributors

trevb11 avatar

Stargazers

Daniel Agyapong avatar

Watchers

 avatar

asd3-coding's Issues

Test Accuracies

> 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.

For Loop Over cv.glmnet Models

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.

reproducibility and readability

@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

Prediction Values

@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
}

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.