ezoic

Tuesday, March 24, 2020

how to fix R's error Error: variables "xxx" were specified with different types from the fit

In R's predicting modeling, sometimes there is an error:

 Error: variables ‘xxx"  were specified with different types from the fit

How to fix it?

Mainly the reason for it is that in the data where we did the predicting  the data type for some variables are different from the data type for some variables from the modeling.

You can check the data types in the data where we will do the predicting.

Once I found that , there were some quotes in the data which made the data into character. Then I unquoted the data and made the data types into numerical. problem solved.

Sample script:

newData=noquote(newData)

newData$in_dream1<-as.numeric(newData$in_dream1)
newData$selected_by1<-as.numeric(newData$selected_by1)
newData$form1<-as.numeric(newData$form1)
newData$points_game1<-as.numeric(newData$points_game1)
newData$element_type1<-as.factor(newData$element_type1)

inc.com is an interesting webpage

inc.com is an interesting webpage.

there is a 5000 companies list every year:

https://www.inc.com/inc5000/2019/top-private-companies-2019-inc5000.html 

Sunday, March 22, 2020

10 linux simple free games

Linux offers some free games. Here are 10 free linux games:

1. Card game, kpatience



2. Brutal Chess



3. SuperTuxKart




4. SDL-Ball




5. KBlocks



6. Secret Maryo Chronicles




7. Gweled




8 Zaz



9. Frozen Bubble



10. Torcs




Tuesday, March 10, 2020

Not able to install kernlab package in R, how to resolve the problem

Tried to install kernlab package in R, tried install.packages("kernlab")  but failed.

Tried to install it by install.packages("kernlab", type="source"), but failed.

And download from

https://cran.r-project.org/web/packages/kernlab/index.html

And install on a terminal

R CMD INSTALL kernlab_0.9-19.tar
And library(kernlab)





Monday, March 9, 2020

model selection caret in R

caret is a package in R.

Caret is the short for Classification And REgression Training.

How to do the predictive modeling in caret/R, steps

https://towardsdatascience.com/create-predictive-models-in-r-with-caret-12baf9941236


How to do the classification modeling in caret/R, steps:

https://rpubs.com/ezgi/classification




Working with json file using R


https://blog.exploratory.io/working-with-json-data-in-very-simple-way-ad7ebcc0bb89


read in a json file from webpage using the package in R rjson:
newElements<-fromJSON(file("https://fantasy.premierleague.com/api/bootstrap-static/"))

the data we needed is an element in json file , how to read it and make it a data frame

newElements <- as.data.frame(newElements$elements)

R rds and rda models

https://www.mydatahack.com/how-to-save-machine-learning-models-in-r/


commands:

save rda model

save(model_nnet, file = "/tmp/model_nnet.rda")

load rda model

load(file = "/tmp/model_nnet.rda")

save rds 

saveRDS(model_nnet, file = "/tmp/model_nnet2.rda")

load rds 

model2 <- readRDS("/tmp/model_nnet2.rda")





Sunday, March 8, 2020

Top 10 programming languages used in web development

Top 10 programming languages used in web development 

Java
Python
C
SQL
Go

JavaScript

CSS / HTML

C++

PHP

Ruby



statistics' application on medical area


1. Clinical trial sample size and power analysis



2. cox proportional hazards model

Saturday, March 7, 2020

Things about classification AUC, ROC, recall, precision, sensitivity, specificity and F1

Classification methods predict the probability of the values of  a categorical  responsible variable  given some predictors.

There are a lot of classification methods. logistic, support vector machine, random forest

In R, there is a package called caret , classification and regression training . There are a lot of built-in classification methods :

https://rdrr.io/cran/caret/man/models.html

To measure the effectiveness of a classification method, there are some metrics :

AUC, ROC, recall, precision, sensitivity, specificity and F1

1.  ROC and AUC

A receiver operating characteristic curve or ROC curve, is a graphical plot that illustrates the diagnostic ability of binary classifier system as its discrimination threshold is varied.

The ROC curve is created by plotting the true positive rate against the false positive rate at various threshold settings. True positive rate is also known as sensitivity, recall or probability of detection. The false positive rate is also known as probability of false alarm, and can be calculated as (1-specificity).  It can also be thought of as a plot of the power as a function of the Type I Error of the decision rule.

AUC means area under the ROC curve. It is a value between 0 and 1.  The closer AUC is to 1, the more accurate the classification prediction is.


2. Recall, precision , sensitivity , specificity , F1





The values are from confusion matrix

precision=true positive/(true positive + false positive)

recall ( sensitivity) =true positive /(true positive + false negative)

specificity =true negative /(true negative + false positive)

F1 Score = 2*(Recall * Precision) / (Recall + Precision)

High recall and high precision show that the classifier is returning accurate  results ( high precision ) , as well as returning a majority of all positive results ( high recall).

specificity is the true negative rate. high specificity means that the classifier is retuning a majority of all negative results.








looking for a man

 I am a mid aged woman.  I was born in 1980. I do not have any kid. no complicated  dating before . I am looking for a man here for marriage...