prediction

R: how to make a confusion matrix for a predictive model?

大兔子大兔子 提交于 2019-12-17 19:34:07
问题 I have a dataframe. first column contains my the predictive score (range from 0 to 100, smaller values is expected to be in class A, larger values is expected to be in class B) for my model, 2nd column contains the real classification of the entries (either "class A" or "class B"). How to get confusion matrix with R for different cut off values, as I cannot decide where I should define values < 20 or < 50 as class A yet? How to do this comparison efficiently with R? 回答1: There's a number of

ValueError: Wrong number of items passed - Meaning and suggestions?

感情迁移 提交于 2019-12-17 18:45:28
问题 I am receiving the error: ValueError: Wrong number of items passed 3, placement implies 1 , and I am struggling to figure out where, and how I may begin addressing the problem. I don't really understand the meaning of the error; which is making it difficult for me to troubleshoot. I have also included the block of code that is triggering the error in my Jupyter Notebook. The data is tough to attach; so I am not looking for anyone to try and re-create this error for me. I am just looking for

how to debug “factor has new levels” error for linear model and prediction

若如初见. 提交于 2019-12-17 13:36:19
问题 I am trying to make and test a linear model as follows: lm_model <- lm(Purchase ~., data = train) lm_prediction <- predict(lm_model, test) This results in the following error, stating that the Product_Category_1 column has values that exist in the test data frame but not the train data frame): factor Product_Category_1 has new levels 7, 9, 14, 16, 17, 18 However, if I check these they definitely look to appear in both data frames: > nrow(subset(train, Product_Category_1 == "7")) [1] 2923 >

how to debug “factor has new levels” error for linear model and prediction

和自甴很熟 提交于 2019-12-17 13:34:09
问题 I am trying to make and test a linear model as follows: lm_model <- lm(Purchase ~., data = train) lm_prediction <- predict(lm_model, test) This results in the following error, stating that the Product_Category_1 column has values that exist in the test data frame but not the train data frame): factor Product_Category_1 has new levels 7, 9, 14, 16, 17, 18 However, if I check these they definitely look to appear in both data frames: > nrow(subset(train, Product_Category_1 == "7")) [1] 2923 >

Working with neuralnet in R for the first time: get “requires numeric/complex matrix/vector arguments”

好久不见. 提交于 2019-12-17 09:22:09
问题 I'm in the process of attempting to learn to work with neural networks in R. As a learning problem, I've been using the following problem over at Kaggle: Don't worry, this problem is specifically designed for people to learn with, there's no reward tied to it. I started with a simple logistic regression, which was great for getting my feet wet. Now I'd like to learn to work with neural networks. My training data looks like this (Column:Row): - survived: 1 - pclass: 3 - sex: male - age: 22.0 -

Working with neuralnet in R for the first time: get “requires numeric/complex matrix/vector arguments”

ε祈祈猫儿з 提交于 2019-12-17 09:22:07
问题 I'm in the process of attempting to learn to work with neural networks in R. As a learning problem, I've been using the following problem over at Kaggle: Don't worry, this problem is specifically designed for people to learn with, there's no reward tied to it. I started with a simple logistic regression, which was great for getting my feet wet. Now I'd like to learn to work with neural networks. My training data looks like this (Column:Row): - survived: 1 - pclass: 3 - sex: male - age: 22.0 -

Keep same dummy variable in training and testing data

ぐ巨炮叔叔 提交于 2019-12-17 07:11:59
问题 I am building a prediction model in python with two separate training and testing sets. The training data contains numerical type categorical variable, e.g., zip code,[91521,23151,12355, ...], and also string categorical variables, e.g., city ['Chicago', 'New York', 'Los Angeles', ...]. To train the data, I first use the 'pd.get_dummies' to get dummy variable of these variable, and then fit the model with the transformed training data. I do the same transformation on my test data and predict

Deep learning to predict the temperature

巧了我就是萌 提交于 2019-12-14 03:37:47
问题 Let's say I have a training data. I train the model for whole number temperatures like 1,2,3,4,5 degrees. Basically, Those output temperatures are the labels. How can I predict the values that lies between two temperatures like 2.5 degree. It is not possible to train for every values of temperature. How can I achieve this? 回答1: It wounds as if you've trained to a discrete classification, but you want continuous output. Switch your algorithm to do regression, rather than classification.

How to predict probability in logistic regression in SAS?

泪湿孤枕 提交于 2019-12-14 03:15:40
问题 I am very new to SAS and trying to predict probabilities using logistic regression in SAS. I got the code below from SAS Support web site: data vaso; length Response $12; input Volume Rate Response @@; LogVolume=log(Volume); LogRate=log(Rate); datalines; 3.70 0.825 constrict 3.50 1.09 constrict 1.25 2.50 constrict 0.75 1.50 constrict 0.80 3.20 constrict 0.70 3.50 constrict 0.60 0.75 no_constrict 1.10 1.70 no_constrict 0.90 0.75 no_constrict 0.90 0.45 no_constrict 0.80 0.57 no_constrict 0.55 2

NameError: name 'classifier' is not defined

别来无恙 提交于 2019-12-13 23:44:04
问题 I am new to machine learning. I was trying to predict on a dataset but when I run the program it give me following error: NameError: name 'classifier' is not defined Here is my code: import numpy as np from keras.preprocessing import image test_image = image.load_img('dataset/single_prediction/1.jpg', target_size = (64, 64)) test_image = image.img_to_array(test_image) test_image = np.expand_dims(test_image, axis = 0) result = classifier.predict(test_image) training_set.class_indices if result