trevb11 / ASD3-Coding

Commentary on ASD3 Coding Related Project
1 stars 2 forks source link

Prediction Values #4

Open trevb11 opened 11 months ago

trevb11 commented 11 months ago

@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
}
tdhock commented 11 months ago

This is not a Minimal Reproducible Example so it is difficult for me to understand, because I can not run your code. Next time please try to make a MRE https://stackoverflow.com/help/minimal-reproducible-example

As I said yesterday, please consult the man page for the function you are using, which I believe is:

> ?glmnet::predict.glmnet
...
    type: Type of prediction required. Type '"link"' gives the linear
          predictors for '"binomial"', '"multinomial"', '"poisson"' or
          '"cox"' models; for '"gaussian"' models it gives the fitted
          values. Type '"response"' gives the fitted probabilities for
          '"binomial"' or '"multinomial"', fitted mean for '"poisson"'
          and the fitted relative-risk for '"cox"'; for '"gaussian"'
          type '"response"' is equivalent to type '"link"'. Type
          '"coefficients"' computes the coefficients at the requested
          values for 's'.  Note that for '"binomial"' models, results
          are returned only for the class corresponding to the second
          level of the factor response. Type '"class"' applies only to
          '"binomial"' or '"multinomial"' models, and produces the
          class label corresponding to the maximum probability. Type
          '"nonzero"' returns a list of the indices of the nonzero
          coefficients for each value of 's'.

In particular, try type="class"