1
$\begingroup$

model_pred_gender 0 1 # Confusion matrix structure is not corresct. it is issue. 1 314 698

model_pred_gender[pred>0.6] <- "1" # Now I changed pred > 0.6

tab<-table(model_pred_gender,vdata$Gender) # Confusion matrix creation print(tab)

model_pred_gender 0 1 0 32 33 1 282 665

$\endgroup$
2

1 Answer 1

2
$\begingroup$

Here is how you can do it. Make 2 parts of your dataset: a) where gender information is present b) where gender information is missing.

Now dataset from a is the one, on which you will build your model and dataset from part b is the one you are going to predict.

For the dataset from a, treat your gender as (1/0) 2 classes and apply binary logistic model with InterestID as independent variable.Note that you need to transform your InterestID into indicators for each of the category and then remove duplicates for customer ID. If it turns out to be good predictor. Use the estimates of the model to predict the probability of the gender being male or female in dataset from b.

So your train dataset will be like:

  UserID  Gender(this is target) InterestID_1 InterestID_2 InterestID_3...
    3            1                      1            0            0
    4            1                      1            1            0 
........
$\endgroup$
18
  • $\begingroup$ I created 2 type data set .First dataset have userID with respective Gender infrmation and user selected InterestID .Another dataset have userID with respective missing Gender infrmation(NA) and user selected InterestID. For first dataset, I removed userID and based on user's gender (0/1) and their selected interested ID . created 2 cluster. $\endgroup$
    – Kumar P
    Dec 7, 2016 at 8:31
  • $\begingroup$ I don't think this will work. Going on the data summary it appears that InterestID is measured repeatably for users. Making a binary logistic model that predicts Gender from InterestID will make it possible for a single person to be assigned multiple genders. A logistic mixed model may do the trick, but is predicting Gender from InterestID your ultimate goal? Or is it a step in between to deal with missing data? If your ultimate goal is to predict InterestID from Gender than doing the reverse first to deal with missing data will bias your results. $\endgroup$
    – Niek
    Dec 7, 2016 at 8:50
  • $\begingroup$ My ultimate goal is predicting Gender from InterestID. $\endgroup$
    – Kumar P
    Dec 7, 2016 at 9:19
  • $\begingroup$ @Niek You are right. So I suggested him to make indicators for various categories of InterestID and remove the duplicates at User Level. that should do the trick. $\endgroup$
    – muni
    Dec 7, 2016 at 9:24
  • $\begingroup$ I have 2 type data set .First dataset have userID with respective Gender infrmation and user selected InterestID .Another dataset have userID with respective missing Gender infrmation(NA) and user selected InterestID. For first dataset, in data cleaning process,I removed userID. Now I have user's gender (0/1) and their selected interested ID. My ultimate goal is predict Gender based on selected InterestID for second dataset (unlabeled Gender). $\endgroup$
    – Kumar P
    Dec 7, 2016 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.